Class DecodedInstruction


  • public class DecodedInstruction
    extends java.lang.Object
    A decoded, but not yet disassembled instruction. Basic unit is a byte. Instruction image is an int stored in big-endian.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int key, int bits, int length)
      Adds the recognized subrule-returning variant to the instruction.
      void add​(int key, java.lang.String string, int constant)
      Adds the recognized string-returning variant to the instruction.
      int get​(int key)
      Returns the constant value to which the given key is mapped.
      Bits getBits​(int key)
      Returns the bit sequence to which the given key is mapped.
      byte[] getImage()
      Returns the binary image of the whole instruction.
      java.util.Set<java.lang.Integer> getKeys()
      Returns the set of all keys contained in this instruction.
      int getLength()
      Returns the length of the instruction in the memory.
      java.lang.String getString​(int key)
      Returns the string value to which the given key is mapped.
      boolean hasKey​(int key)
      Returns true if the instruction contains the specified key.
      void setImage​(byte[] image)
      Sets the binary image of the whole instruction.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DecodedInstruction

        public DecodedInstruction()
    • Method Detail

      • add

        public void add​(int key,
                        java.lang.String string,
                        int constant)
        Adds the recognized string-returning variant to the instruction.
        Parameters:
        key - the key (rule code)
        string - the string which the recognized variant returned
        constant - the constant obtained from the string
      • add

        public void add​(int key,
                        int bits,
                        int length)
        Adds the recognized subrule-returning variant to the instruction.
        Parameters:
        key - the rule code
        bits - the bit sequence in little-endian, padded to whole bytes
        length - bit length (in bits)
      • hasKey

        public boolean hasKey​(int key)
        Returns true if the instruction contains the specified key.
        Parameters:
        key - the rule code
        Returns:
        true if the instruction contains the key, false otherwise
      • get

        public int get​(int key)
        Returns the constant value to which the given key is mapped.
        Parameters:
        key - the key
        Returns:
        the constant; or -1 if the key is not mapped to a constant
      • getString

        public java.lang.String getString​(int key)
        Returns the string value to which the given key is mapped.
        Parameters:
        key - the key
        Returns:
        the string; or null if the key is not mapped to a string
      • getBits

        public Bits getBits​(int key)
        Returns the bit sequence to which the given key is mapped.
        Parameters:
        key - the key
        Returns:
        the bit sequence; or null if the key is not mapped to bits
      • getImage

        public byte[] getImage()
        Returns the binary image of the whole instruction.
        Returns:
        the binary image
      • setImage

        public void setImage​(byte[] image)
        Sets the binary image of the whole instruction.
        Parameters:
        image - the binary image
      • getLength

        public int getLength()
        Returns the length of the instruction in the memory.
        Returns:
        the length, in bytes
      • getKeys

        public java.util.Set<java.lang.Integer> getKeys()
        Returns the set of all keys contained in this instruction.
        Returns:
        the set of keys
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object