Class SVM_SHIFT


public class SVM_SHIFT extends SVM_Instruction

SVM-INSTRUCTION: SHIFT opr

Runtime Stack
   ..., sos, tos →
   ..., result

The 'tos' and 'sos' are popped off the Runtime stack. The 'result' is calculated as result = sos opr tos. Then the 'result' is pushed onto the Runtime Stack.

'tos' and 'sos' must be of type int.

The operation depends on the 'opr' parameter:

LSHIFTA: Signed Left Shift     << The left shift operator moves all bits by a given number of bits to the left.
LSHIFTL: Unsigned Left Shift   << The left shift operator moves all bits by a given number of bits to the left.
RSHIFTA: Signed Right Shift    >> The right shift operator moves all bits by a given number of bits to the right.
RSHIFTL: Unsigned Right Shift  >>> It is the same as the signed right shift, but the vacant leftmost position is filled with 0 instead of the sign bit.

Link to GitHub: Source File.

Author:
S-Port: Definition of S-code, Øystein Myhre Andersen
  • Field Details

    • instr

      int instr
      Which shift instruction
  • Constructor Details

    • SVM_SHIFT

      public SVM_SHIFT(int instr)
      Construct a new SVM_SHIFT instruction
      Parameters:
      instr - which shift instruction
  • Method Details