OpenASIP
2.0
|
#include <ImmediateSlotField.hh>
Public Member Functions | |
ImmediateSlotField (const std::string &name, int width, BinaryEncoding &parent) | |
ImmediateSlotField (const ObjectState *state, BinaryEncoding &parent) | |
virtual | ~ImmediateSlotField () |
BinaryEncoding * | parent () const |
std::string | name () const |
void | setName (const std::string &name) |
virtual int | childFieldCount () const |
virtual int | width () const |
void | setWidth (int width) |
virtual ObjectState * | saveState () const |
virtual void | loadState (const ObjectState *state) |
Public Member Functions inherited from InstructionField | |
virtual | ~InstructionField () |
InstructionField * | parent () const |
virtual InstructionField & | childField (int position) const |
int | bitPosition () const |
int | relativePosition () const |
virtual void | setRelativePosition (int position) |
void | setExtraBits (int bits) |
int | extraBits () const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
Static Public Attributes | |
static const std::string | OSNAME_IMMEDIATE_SLOT_FIELD |
ObjectState name for immediate slot field. More... | |
static const std::string | OSKEY_NAME = "name" |
ObjectState attribute key for the name of the immediate slot. More... | |
static const std::string | OSKEY_WIDTH = "width" |
ObjectState attribute key for the width of the field. More... | |
Static Public Attributes inherited from InstructionField | |
static const std::string | OSNAME_INSTRUCTION_FIELD = "instr_field" |
ObjectState name for instruction field. More... | |
static const std::string | OSKEY_EXTRA_BITS = "extra_bits" |
ObjectState attribute key for the number of extra bits. More... | |
static const std::string | OSKEY_POSITION = "position" |
ObjectState attribute key for the relative position of the field. More... | |
Private Attributes | |
std::string | name_ |
Name of the immediate slot. More... | |
int | width_ |
The bit width of the field. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from InstructionField | |
InstructionField (InstructionField *parent) | |
InstructionField (const ObjectState *state, InstructionField *parent) | |
void | setParent (InstructionField *parent) |
Static Protected Member Functions inherited from InstructionField | |
static void | reorderSubfields (ObjectState *state) |
ImmediateSlotField represents a dedicated immediate slot in TTA instruction.
Definition at line 44 of file ImmediateSlotField.hh.
ImmediateSlotField::ImmediateSlotField | ( | const std::string & | name, |
int | width, | ||
BinaryEncoding & | parent | ||
) |
The constructor.
name | Name of the immediate slot programmed by this field. |
width | Bit width of the field. @parent The parent binary encoding map. |
OutOfRange | If the bit width is smaller than 1. |
ObjectAlreadyExists | If the parent binary encoding already has an immediate slot with the given name. |
Definition at line 57 of file ImmediateSlotField.cc.
References BinaryEncoding::addImmediateSlot(), parent(), InstructionField::setParent(), and width().
ImmediateSlotField::ImmediateSlotField | ( | const ObjectState * | state, |
BinaryEncoding & | parent | ||
) |
The constructor.
Loads the state of the object from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If an error occurs while loading the state. |
Definition at line 79 of file ImmediateSlotField.cc.
References BinaryEncoding::addImmediateSlot(), loadState(), parent(), and InstructionField::setParent().
|
virtual |
The destructor.
Definition at line 91 of file ImmediateSlotField.cc.
References assert, parent(), BinaryEncoding::removeImmediateSlot(), and InstructionField::setParent().
|
virtual |
Returns 0 always since immediate slot does not have any child fields.
Implements InstructionField.
Definition at line 156 of file ImmediateSlotField.cc.
|
virtual |
Loads the state of the object from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If an error occurs while loading the state. |
Reimplemented from InstructionField.
Definition at line 210 of file ImmediateSlotField.cc.
References ObjectState::intAttribute(), InstructionField::loadState(), ObjectState::name(), OSKEY_NAME, OSKEY_WIDTH, OSNAME_IMMEDIATE_SLOT_FIELD, setName(), setWidth(), and ObjectState::stringAttribute().
Referenced by ImmediateSlotField().
std::string ImmediateSlotField::name | ( | ) | const |
Returns the name of the immediate slot programmed by this field.
Definition at line 123 of file ImmediateSlotField.cc.
References name_.
Referenced by CodeCompressorPlugin::addBitsForImmediateSlot(), BinaryEncoding::addImmediateSlot(), BinaryEncoding::hasImmediateSlot(), BinaryEncoding::immediateSlot(), printInstructionLayout(), saveState(), setName(), DefaultDecoderGenerator::writeImmediateSlotSignals(), and DefaultDecoderGenerator::writeInstructionDismembering().
BinaryEncoding * ImmediateSlotField::parent | ( | ) | const |
Returns the parent binary encoding map.
Definition at line 105 of file ImmediateSlotField.cc.
References assert, and InstructionField::parent().
Referenced by BinaryEncoding::addImmediateSlot(), ImmediateSlotField(), BinaryEncoding::removeImmediateSlot(), setName(), and ~ImmediateSlotField().
|
virtual |
Saves the state of the object to an ObjectState instance.
Reimplemented from InstructionField.
Definition at line 193 of file ImmediateSlotField.cc.
References name(), OSKEY_NAME, OSKEY_WIDTH, OSNAME_IMMEDIATE_SLOT_FIELD, InstructionField::saveState(), ObjectState::setAttribute(), ObjectState::setName(), and width().
Referenced by BinaryEncoding::saveState().
void ImmediateSlotField::setName | ( | const std::string & | name | ) |
Sets the name of the immediate slot programmed by this field.
name | The name. |
ObjectAlreadyExists | If the parent binary encoding has an immediate slot field for the given immediate slot already. |
Definition at line 137 of file ImmediateSlotField.cc.
References name(), name_, and parent().
Referenced by loadState().
void ImmediateSlotField::setWidth | ( | int | width | ) |
Sets the bit width of the field.
width | The new bit width. |
OutOfRange | If the given width is smaller than 1. |
Definition at line 179 of file ImmediateSlotField.cc.
References width(), and width_.
Referenced by loadState().
|
virtual |
Returns the bit width of the field.
Implements InstructionField.
Definition at line 167 of file ImmediateSlotField.cc.
References width_.
Referenced by CodeCompressorPlugin::addBitsForImmediateSlot(), CodeCompressorPlugin::bemInstructionBits(), BEMValidator::checkImmediateSlot(), ImmediateSlotField(), printInstructionLayout(), saveState(), setWidth(), BinaryEncoding::width(), DefaultDecoderGenerator::writeImmediateSlotSignals(), and DefaultDecoderGenerator::writeInstructionDismembering().
|
private |
Name of the immediate slot.
Definition at line 71 of file ImmediateSlotField.hh.
|
static |
ObjectState attribute key for the name of the immediate slot.
Definition at line 65 of file ImmediateSlotField.hh.
Referenced by BEMSerializer::immediateSlotToFile(), BEMSerializer::immediateSlotToOM(), loadState(), and saveState().
|
static |
ObjectState attribute key for the width of the field.
Definition at line 67 of file ImmediateSlotField.hh.
Referenced by BEMSerializer::immediateSlotToFile(), BEMSerializer::immediateSlotToOM(), loadState(), and saveState().
|
static |
ObjectState name for immediate slot field.
Definition at line 63 of file ImmediateSlotField.hh.
Referenced by BEMSerializer::convertToFileFormat(), BEMSerializer::immediateSlotToOM(), loadState(), BinaryEncoding::loadState(), and saveState().
|
private |
The bit width of the field.
Definition at line 73 of file ImmediateSlotField.hh.
Referenced by setWidth(), and width().