Class RegisterDescriptionEntry
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.processor.RegisterDescriptionEntry
Description of a processor register.
-
Constructor Summary
ConstructorsConstructorDescriptionRegisterDescriptionEntry(int number, String name, int bitsize, RegisterEncoding encoding, String alternateName, RegisterType type, int offset) Full constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdd a name for this register.enc(RegisterEncoding encoding) Set the register encoding.intRetrieve the exclusive end bit of this register slice.intGet the register size in bits.intRetrieve the first bit of this register slice.Retrieve the physical register that owns this slice.Retrieve the register encoding.longgetId()Opaque register id used byprocessorobjects.getName()Get the primary name.getNames()Get all the names for the register.intGet the optional register number used to locate the register in its bank.intGet the optional offset in a block of registers, meaningful in the context of the layout this entry belongs to.longRetrieve the pure register id, without size and bit offset encoding.intgetSize()Get the register size in bytes, rounded up (eg, if the register is 6-bit long, the returned byte size will be 1).getSlice(int bitstart, int bitend) Retrieve a slice by bit range.Retrieve slices defined on this physical register.getType()Retrieve the register type.grp(int grp, int idx) Defines the group from which register belongs.booleanDetermine if this register uses the provided name (case-insensitive).booleanDetermine if this register uses the provided name.booleanhasName(Collection<String> candidateNames) Determine if this register uses any of the provided names (case-insensitive).booleanhasName(Collection<String> candidateNames, boolean caseSensitive) Determine if this register uses any of the provided names.booleanDetermine whether this entry describes a physical register.booleanDetermine whether this entry describes a register slice.voidsetOffset(int offset) Set the optional offset in a block of registers.Define a slice of aRegisterDescriptionEntry, with bitstart at 0.Define a slice of aRegisterDescriptionEntrytoString()typ(RegisterType type) Set the register type.voidVerify that this entry describes a physical register.voidVerify that this entry describes a register slice.
-
Constructor Details
-
RegisterDescriptionEntry
public RegisterDescriptionEntry(int number, String name, int bitsize, RegisterEncoding encoding, String alternateName, RegisterType type, int offset) Full constructor.- Parameters:
number- mandatoryname- mandatorybitsize- mandatoryencoding- optionalalternateName- optionaltype- optionaloffset- optional
-
-
Method Details
-
sl
Define a slice of aRegisterDescriptionEntry- Parameters:
name- slice namebitstart- start bitbitend- end bit (excluded)- Returns:
- the register entry (NOT the defined slice)
-
sl
Define a slice of aRegisterDescriptionEntry, with bitstart at 0. Usesl(String, int, int)if bitstart is different.- Parameters:
name- name of the slice registerbitsize- 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
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 byprocessorobjects.- Returns:
- the id
-
getPureId
public long getPureId()Retrieve the pure register id, without size and bit offset encoding.- Returns:
- pure register id
-
grp
Defines the group from which register belongs.- Parameters:
grp- register groupidx- 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
Get the primary name.- Returns:
- non-null, non-empty
-
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
Determine if this register uses the provided name (case-insensitive).- Parameters:
candidateName- candidate name- Returns:
- true if the name matches
-
hasName
Determine if this register uses the provided name.- Parameters:
candidateName- candidate namecaseSensitive- true to use case-sensitive matching- Returns:
- true if the name matches
-
hasName
Determine if this register uses any of the provided names (case-insensitive).- Parameters:
candidateNames- candidate names- Returns:
- true if any name matches
-
hasName
Determine if this register uses any of the provided names.- Parameters:
candidateNames- candidate namescaseSensitive- true to use case-sensitive matching- Returns:
- true if any name matches
-
addName
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
Retrieve slices defined on this physical register.- Returns:
- register slices
-
getSlice
Retrieve a slice by bit range.- Parameters:
bitstart- start bitbitend- 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
Retrieve the register encoding.- Returns:
- never null
-
enc
Set the register encoding.- Parameters:
encoding- register encoding- Returns:
- this entry
-
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
-