Class StaticALU

    • Field Detail

      • A

        public TypedIOPort A
        Input port for the first operand. The port type is integer.
      • B

        public TypedIOPort B
        Input port for the second operand. The port type is integer.
      • operation

        public StringParameter operation
        Input port for the operation code. The port type is integer. The value of the input tokens should not exceed the number of operations supported.
      • output

        public TypedIOPort output
        Output port. The type is inferred from the connections.
    • Method Detail

      • fire

        public void fire()
                  throws IllegalActionException
        If there is at least one token on each of the input ports, the first token from each port is consumed. The value of the token from the operation input port determines which operation will be perform on the tokens from input port A and B. The opcode is defined as follow: 0 - NOP 1 - Addition (A + B) 2 - Subtraction (A - B) 3 - Multiplication (A * B) 4 - Division (A / B)
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If the input operation code is not supported.