Package ptolemy.data

Examples of ptolemy.data.FixToken


                    || !dataIn.hasToken(0)) {
                return;
            }

            // Consume tokens from all input ports.
            FixToken in = ((FixToken) dataIn.get(0));

            FixToken addressToken = (FixToken) address.get(0);
            FixPoint addressFixValue = addressToken.fixValue();

            FixToken writeEnableToken = (FixToken) writeEnable.get(0);
            FixPoint writeEnableValue = writeEnableToken.fixValue();

            _checkFixTokenWidth(writeEnableToken, 1);
            _checkFixTokenWidth(addressToken, _addressWidth);
            _checkFixTokenWidth(in, _dataWidth);
View Full Code Here


                        .isKnown()))) {

            _currentCount = _previousCount;

            if (enable.getContainer() != null && enable.hasToken(0)) {
                FixToken enableToken = (FixToken) enable.get(0);

                _checkFixTokenWidth(enableToken, 1);

                boolean enableValue = enableToken.fixValue().toBitString()
                        .equals("1");

                if (enableValue) {
                    _currentCount++;
                }
            } else if (enable.getContainer() == null) {
                _currentCount++;
            }

            if (reset.hasToken(0)) {
                FixToken resetToken = (FixToken) reset.get(0);

                _checkFixTokenWidth(resetToken, 1);

                boolean resetValue = resetToken.fixValue().toBitString()
                        .equals("1");

                if (resetValue) {
                    _currentCount = 0;
                }
            }

            // Produce an output if we consumed an input.
            FixPoint result = new FixPoint(_currentCount);
            Token outputToken = new FixToken(result);
            sendOutput(output, 0, outputToken);

        } else {

            ((QueuedTypedIOPort) output).resend(0);
View Full Code Here

            FixPoint valueA = ((FixToken) A.get(0)).fixValue();
            bitsInResult = valueA.getPrecision().getNumberOfBits();
            BigInteger bigIntA = valueA.getUnscaledValue();
            intResult = bigIntA.not();
            Precision precision = new Precision(1, bitsInResult, 0);
            FixToken result = new FixToken(intResult.doubleValue(), precision);
            sendOutput(output, 0, result);
        } else {
            output.resend(0);
        }
    }
View Full Code Here

        FixPoint result = new FixPoint(((ScalarToken) value.getToken())
                .doubleValue(), new FixPointQuantization(precision, overflow,
                rounding));

        sendOutput(output, 0, new FixToken(result));
    }
View Full Code Here

     *  DoubleToken to the output port.
     * @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        FixToken in = (FixToken) input.get(0);
        FixPoint value = in.fixValue();
        output.send(0, new DoubleToken(value.doubleValue()));
    }
View Full Code Here

        } else if (result instanceof Boolean) {
            resultToken = new BooleanToken(((Boolean) result).booleanValue());
        } else if (result instanceof Complex) {
            resultToken = new ComplexToken((Complex) result);
        } else if (result instanceof FixPoint) {
            resultToken = new FixToken((FixPoint) result);
        } else {
            throw new IllegalActionException(this, "Result of method call "
                    + port.getName() + " is not a supported type: boolean, "
                    + "complex, fixpoint, double, int, long  and String, "
                    + "or a Token.");
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        super.fire();
        DoubleToken in = (DoubleToken) input.get(0);
        FixPoint fixValue = new FixPoint(in.doubleValue(), _quantization);
        FixToken result = new FixToken(fixValue);
        output.send(0, result);
    }
View Full Code Here

     *  and rounding strategy given by the <i>rounding</i> parameter.
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        FixToken in = (FixToken) input.get(0);
        FixPoint fixValue = in.fixValue().quantize(_quantization);
        FixToken result = new FixToken(fixValue);
        output.send(0, result);
    }
View Full Code Here

                            .getExpression().toLowerCase());

            FixPoint result = new FixPoint(((ScalarToken) initialValue
                    .getToken()).doubleValue(), new FixPointQuantization(
                    precision, overflow, rounding));
            output.setInitToken(new FixToken(result));
        }
        if (attribute == initialValue) {
            Precision precision = new Precision(
                    ((Parameter) getAttribute("outputPrecision"))
                            .getExpression());

            Overflow overflow = Overflow
                    .getName(((Parameter) getAttribute("outputOverflow"))
                            .getExpression().toLowerCase());

            Rounding rounding = Rounding
                    .getName(((Parameter) getAttribute("outputRounding"))
                            .getExpression().toLowerCase());

            FixPoint result = new FixPoint(((ScalarToken) initialValue
                    .getToken()).doubleValue(), new FixPointQuantization(
                    precision, overflow, rounding));
            output.setInitToken(new FixToken(result));
        }
    }
View Full Code Here

        FixPoint result = new FixPoint(((ScalarToken) initialValue.getToken())
                .doubleValue(), new FixPointQuantization(precision, overflow,
                rounding));
        int latencyValue = ((ScalarToken) latency.getToken()).intValue();
        output.setSize(latencyValue, new FixToken(result));
    }
View Full Code Here

TOP

Related Classes of ptolemy.data.FixToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.