Class RegisterDescriptionEntry

java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.processor.RegisterDescriptionEntry

public class RegisterDescriptionEntry extends Object
Description of a processor register.
  • Constructor Details

    • RegisterDescriptionEntry

      public RegisterDescriptionEntry(int number, String name, int bitsize, RegisterEncoding encoding, String alternateName, RegisterType type, int offset)
      Full constructor.
      Parameters:
      number - mandatory
      name - mandatory
      bitsize - mandatory
      encoding - optional
      alternateName - optional
      type - optional
      offset - optional
  • Method Details

    • sl

      public RegisterDescriptionEntry sl(String name, int bitstart, int bitend)
      Define a slice of a RegisterDescriptionEntry
      Parameters:
      name - slice name
      bitstart - start bit
      bitend - end bit (excluded)
      Returns:
      the register entry (NOT the defined slice)
    • sl

      public RegisterDescriptionEntry sl(String name, int bitsize)
      Define a slice of a RegisterDescriptionEntry, with bitstart at 0. Use sl(String, int, int) if bitstart is different.
      Parameters:
      name - name of the slice register
      bitsize - bitsize of the slice. Must be <= to current bitsize.
      Returns:
      the register entry (NOT the defined slice)
    • isPhysicalRegister

      public boolean isPhysicalRegister()
      Determine whether this entry describes a physical register.
      Returns:
      true for a physical register
    • isRegisterSlice

      public boolean isRegisterSlice()
      Determine whether this entry describes a register slice.
      Returns:
      true for a register slice
    • verifyPhysicalRegister

      public void verifyPhysicalRegister()
      Verify that this entry describes a physical register.
      Throws:
      RuntimeException - if this entry is a register slice
    • verifyRegisterSlice

      public void verifyRegisterSlice()
      Verify that this entry describes a register slice.
      Throws:
      RuntimeException - if this entry is a physical register
    • getContainer

      public RegisterDescriptionEntry getContainer()
      Retrieve the physical register that owns this slice.
      Returns:
      containing register
    • getNumber

      public int getNumber()
      Get the optional register number used to locate the register in its bank.
      Returns:
      register number
    • getId

      public long getId()
      Opaque register id used by processor objects.
      Returns:
      the id
    • getPureId

      public long getPureId()
      Retrieve the pure register id, without size and bit offset encoding.
      Returns:
      pure register id
    • grp

      public RegisterDescriptionEntry grp(int grp, int idx)
      Defines the group from which register belongs.
      Parameters:
      grp - register group
      idx - register index in the group
      Returns:
      the register entry (NOT the defined group)
    • getOffset

      public int getOffset()
      Get the optional offset in a block of registers, meaningful in the context of the layout this entry belongs to.
      Returns:
      -1 if unspecified
    • setOffset

      public void setOffset(int offset)
      Set the optional offset in a block of registers.
      Parameters:
      offset - register offset
    • getName

      public String getName()
      Get the primary name.
      Returns:
      non-null, non-empty
    • getNames

      public List<String> getNames()
      Get all the names for the register. The first entry in the list is the primary name.
      Returns:
      a list containing at least one entry
    • hasName

      public boolean hasName(String candidateName)
      Determine if this register uses the provided name (case-insensitive).
      Parameters:
      candidateName - candidate name
      Returns:
      true if the name matches
    • hasName

      public boolean hasName(String candidateName, boolean caseSensitive)
      Determine if this register uses the provided name.
      Parameters:
      candidateName - candidate name
      caseSensitive - true to use case-sensitive matching
      Returns:
      true if the name matches
    • hasName

      public boolean hasName(Collection<String> candidateNames)
      Determine if this register uses any of the provided names (case-insensitive).
      Parameters:
      candidateNames - candidate names
      Returns:
      true if any name matches
    • hasName

      public boolean hasName(Collection<String> candidateNames, boolean caseSensitive)
      Determine if this register uses any of the provided names.
      Parameters:
      candidateNames - candidate names
      caseSensitive - true to use case-sensitive matching
      Returns:
      true if any name matches
    • addName

      public RegisterDescriptionEntry addName(String name)
      Add a name for this register.
      Parameters:
      name - a name, cannot be empty or null; it can be a primary name or an alternate name
      Returns:
      this object (allows chained calls)
    • getBitsize

      public int getBitsize()
      Get the register size in bits.
      Returns:
      register size in bits
    • getBitstart

      public int getBitstart()
      Retrieve the first bit of this register slice.
      Returns:
      start bit, or 0 for physical registers
    • getBitend

      public int getBitend()
      Retrieve the exclusive end bit of this register slice.
      Returns:
      end bit, or the register size for physical registers
    • getSlices

      public List<RegisterDescriptionEntry> getSlices()
      Retrieve slices defined on this physical register.
      Returns:
      register slices
    • getSlice

      public RegisterDescriptionEntry getSlice(int bitstart, int bitend)
      Retrieve a slice by bit range.
      Parameters:
      bitstart - start bit
      bitend - exclusive end bit
      Returns:
      matching slice, or null
    • getSize

      public int getSize()
      Get the register size in bytes, rounded up (eg, if the register is 6-bit long, the returned byte size will be 1).
      Returns:
      register size in bytes
    • getEncoding

      public RegisterEncoding getEncoding()
      Retrieve the register encoding.
      Returns:
      never null
    • enc

      Set the register encoding.
      Parameters:
      encoding - register encoding
      Returns:
      this entry
    • getType

      public RegisterType getType()
      Retrieve the register type.
      Returns:
      never null
    • typ

      Set the register type.
      Parameters:
      type - register type
      Returns:
      the register entry (NOT the defined type)
    • toString

      public String toString()
      Overrides:
      toString in class Object