Package ru.ispras.microtesk.mmu.basis
Enum MemoryDataType
- java.lang.Object
-
- java.lang.Enum<MemoryDataType>
-
- ru.ispras.microtesk.mmu.basis.MemoryDataType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<MemoryDataType>
public enum MemoryDataType extends java.lang.Enum<MemoryDataType>
This enumeration contains basic data types.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigInteger
align(java.math.BigInteger address)
Returns the aligned address (zero a required number of bits at the end).int
getLowerAddressBit()
Returns the lower significant bit of the address.int
getSizeInBytes()
Returns the size in bytes.boolean
isAligned(java.math.BigInteger address)
Checks whether the address is aligned (contains a sufficient number of zero bits at the end).static MemoryDataType
type(int sizeInBytes)
static MemoryDataType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static MemoryDataType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BYTE
public static final MemoryDataType BYTE
The byte data type.
-
HWORD
public static final MemoryDataType HWORD
The half-word data type.
-
WORD
public static final MemoryDataType WORD
The word data type.
-
DWORD
public static final MemoryDataType DWORD
The double-word data type.
-
QWORD
public static final MemoryDataType QWORD
The quad-word data type.
-
OWORD
public static final MemoryDataType OWORD
The octo-word data type.
-
-
Method Detail
-
values
public static MemoryDataType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MemoryDataType c : MemoryDataType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MemoryDataType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
type
public static MemoryDataType type(int sizeInBytes)
-
getSizeInBytes
public int getSizeInBytes()
Returns the size in bytes.- Returns:
- the size.
-
getLowerAddressBit
public int getLowerAddressBit()
Returns the lower significant bit of the address.- Returns:
- the lower significant bit.
-
isAligned
public boolean isAligned(java.math.BigInteger address)
Checks whether the address is aligned (contains a sufficient number of zero bits at the end).- Parameters:
address
- the address to be checked.- Returns:
true
if the address is aligned;false
otherwise.
-
align
public java.math.BigInteger align(java.math.BigInteger address)
Returns the aligned address (zero a required number of bits at the end).- Parameters:
address
- the address to be aligned.- Returns:
- the aligned address.
-
-