Class MmuStruct
- java.lang.Object
-
- ru.ispras.microtesk.mmu.model.spec.MmuStruct
-
- Direct Known Subclasses:
MmuAddressInstance
,MmuBuffer
public class MmuStruct extends java.lang.Object
TheMmuStruct
class describes a variable represented by a structure (a list ofVariable
objects).
-
-
Constructor Summary
Constructors Constructor Description MmuStruct(java.lang.String name, ru.ispras.fortress.expression.NodeVariable... variables)
Constructs an MmuStruct object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addField(ru.ispras.fortress.expression.NodeVariable field)
Registers an new field.void
addField(MmuStruct struct)
Registers fields defined in the specified structure.java.util.List<MmuBinding>
bindings(MmuStruct other)
Creates bindings between fields of two structures.int
getBitSize()
Returns the total size of all fields in the structure.MmuBuffer
getBuffer()
Returns the buffer associated with the structure (for buffer entries) ornull
if not applicable.int
getFieldCount()
Returns the number of fields in the structure.java.util.List<ru.ispras.fortress.expression.NodeVariable>
getFields()
Returns structure fields.MmuStruct
getInstance(java.lang.String instanceId, MemoryAccessContext context)
java.lang.String
getName()
Returns the structure name.void
setBuffer(MmuBuffer buffer)
Sets the buffer associated with the structure (for buffer entries).java.lang.String
toString()
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
buffer
protected MmuBuffer buffer
-
fields
protected final java.util.List<ru.ispras.fortress.expression.NodeVariable> fields
-
bitSize
protected int bitSize
-
-
Constructor Detail
-
MmuStruct
public MmuStruct(java.lang.String name, ru.ispras.fortress.expression.NodeVariable... variables)
Constructs an MmuStruct object.- Parameters:
name
- structure name.variables
- field variables.- Throws:
java.lang.IllegalArgumentException
- ifname
equalsnull
or if any of the field variables equalsnull
.
-
-
Method Detail
-
getName
public final java.lang.String getName()
Returns the structure name.- Returns:
- structure name.
-
setBuffer
public void setBuffer(MmuBuffer buffer)
Sets the buffer associated with the structure (for buffer entries).- Parameters:
buffer
- the buffer to be associated with the structure.- Throws:
java.lang.IllegalArgumentException
- ifbuffer
equalsnull
.
-
getBuffer
public MmuBuffer getBuffer()
Returns the buffer associated with the structure (for buffer entries) ornull
if not applicable.- Returns:
- the buffer associated with the structure or
null
if not applicable.
-
getFields
public final java.util.List<ru.ispras.fortress.expression.NodeVariable> getFields()
Returns structure fields.- Returns:
- the list of structure fields.
-
addField
public final void addField(ru.ispras.fortress.expression.NodeVariable field)
Registers an new field.- Parameters:
field
- a field to be registered.- Throws:
java.lang.IllegalArgumentException
- iffield == null
.
-
addField
public final void addField(MmuStruct struct)
Registers fields defined in the specified structure.- Parameters:
struct
- Structure which contains fields to be registered.- Throws:
java.lang.IllegalArgumentException
- ifstruct
or any field it contains isnull
.
-
getFieldCount
public final int getFieldCount()
Returns the number of fields in the structure.- Returns:
- number of fields in the structure.
-
getBitSize
public final int getBitSize()
Returns the total size of all fields in the structure.- Returns:
- structure size in bits.
-
bindings
public java.util.List<MmuBinding> bindings(MmuStruct other)
Creates bindings between fields of two structures.- Parameters:
other
- Structure to be bound with the current one.- Returns:
- List of bindings between fields of two structures.
- Throws:
java.lang.IllegalArgumentException
- ifother
equalsnull
; if the structures differ in size or field count; if any of two fields to be bound differ in size.
-
getInstance
public MmuStruct getInstance(java.lang.String instanceId, MemoryAccessContext context)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-