OpenASIP
2.0
|
#include <MoveSlot.hh>
Public Member Functions | |
MoveSlot (const std::string &busName, BinaryEncoding &parent) | |
MoveSlot (const ObjectState *state, BinaryEncoding &parent) | |
virtual | ~MoveSlot () |
BinaryEncoding * | parent () const |
std::string | name () const |
void | setName (const std::string &name) |
void | setGuardField (GuardField &field) |
void | unsetGuardField () |
bool | hasGuardField () const |
GuardField & | guardField () const |
void | setSourceField (SourceField &field) |
void | unsetSourceField () |
bool | hasSourceField () const |
SourceField & | sourceField () const |
void | setDestinationField (DestinationField &field) |
void | unsetDestinationField () |
bool | hasDestinationField () const |
DestinationField & | destinationField () const |
virtual int | childFieldCount () const |
virtual InstructionField & | childField (int position) const |
virtual int | width () const |
virtual void | loadState (const ObjectState *state) |
virtual ObjectState * | saveState () const |
Public Member Functions inherited from InstructionField | |
virtual | ~InstructionField () |
InstructionField * | parent () 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_MOVE_SLOT = "move_slot" |
ObjectState name for move slot. More... | |
static const std::string | OSKEY_BUS_NAME = "bus_name" |
ObjectState attribute key for the name of the bus. 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 Member Functions | |
void | deleteGuardField () |
void | deleteSourceField () |
void | deleteDestinationField () |
Private Attributes | |
std::string | name_ |
The bus name. More... | |
GuardField * | guardField_ |
The guard field. More... | |
SourceField * | sourceField_ |
The source field. More... | |
DestinationField * | destinationField_ |
The destination 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) |
The MoveSlot class represents move slots, fields of the TTA instruction dedicated to program data transports.
Move slots are subdivided into 2 or 3 fields: the guard (optional), source and destination fields. Each type of move slot field is modelled by a different class. MoveSlot has handles to the instances of these classes. A move slot is identified by the name of the transport bus it controls. MoveSlot instances cannot exist alone. They belong to a binary encoding and are always registered to a BinaryEncoding object.
Definition at line 60 of file MoveSlot.hh.
MoveSlot::MoveSlot | ( | const std::string & | busName, |
BinaryEncoding & | parent | ||
) |
The constructor.
Registers the move slot to the parent binary encoding automatically. The slot is added as the leftmost field of the instruction word.
busName | Name of the bus programmed by this move slot. |
parent | The parent BinaryEncoding. |
ObjectAlreadyExists | If the parent binary encoding has a move slot with the same bus name already. |
Definition at line 64 of file MoveSlot.cc.
References BinaryEncoding::addMoveSlot(), parent(), and InstructionField::setParent().
MoveSlot::MoveSlot | ( | const ObjectState * | state, |
BinaryEncoding & | parent | ||
) |
The constructor.
Loads the state of the move slot from the given ObjectState tree.
state | The ObjectState tree. |
parent | The parent binary encoding map. |
ObjectStateLoadingException | If an error occurs while loading the state. |
Definition at line 85 of file MoveSlot.cc.
References BinaryEncoding::addMoveSlot(), loadState(), parent(), and InstructionField::setParent().
|
virtual |
The destructor.
Definition at line 100 of file MoveSlot.cc.
References deleteDestinationField(), deleteGuardField(), deleteSourceField(), parent(), BinaryEncoding::removeMoveSlot(), and InstructionField::setParent().
|
virtual |
Returns the child field at the given relative position.
position | The position (0 is the rightmost position). |
OutOfRange | If the position is negative or not smaller than the number of child fields. |
Reimplemented from InstructionField.
Definition at line 380 of file MoveSlot.cc.
References assert, InstructionField::childField(), destinationField(), guardField(), hasDestinationField(), hasGuardField(), hasSourceField(), NullInstructionField::instance(), InstructionField::relativePosition(), and sourceField().
Referenced by CodeCompressorPlugin::encodeMove(), CodeCompressorPlugin::encodeNOP(), and printMoveSlotLayout().
|
virtual |
Returns the number of child fields (guard, source, destination) within the move slot.
Implements InstructionField.
Definition at line 357 of file MoveSlot.cc.
References hasDestinationField(), hasGuardField(), and hasSourceField().
Referenced by CodeCompressorPlugin::encodeMove(), CodeCompressorPlugin::encodeNOP(), and printMoveSlotLayout().
|
private |
Deletes the destination field of the move slot.
Definition at line 516 of file MoveSlot.cc.
References destinationField_.
Referenced by loadState(), and ~MoveSlot().
|
private |
Deletes the guard field of the move slot.
Definition at line 493 of file MoveSlot.cc.
References guardField_.
Referenced by loadState(), and ~MoveSlot().
|
private |
Deletes the source field of the move slot.
Definition at line 505 of file MoveSlot.cc.
References sourceField_.
Referenced by loadState(), and ~MoveSlot().
DestinationField & MoveSlot::destinationField | ( | ) | const |
Returns the destination field of the move slot.
Returns NullDestinationField if the move slot does not have a destination field.
Definition at line 341 of file MoveSlot.cc.
References destinationField_, hasDestinationField(), and NullDestinationField::instance().
Referenced by BEMTester::canAddComponentPriorityEncoding(), BEMValidator::checkDestinationField(), childField(), DestinationField::DestinationField(), CodeCompressorPlugin::encodeMove(), CodeCompressorPlugin::encodeNOP(), ProGe::RV32MicroCodeGenerator::findBusWidths(), printDestinationFieldEncodings(), saveState(), unsetDestinationField(), width(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), DefaultDecoderGenerator::writeControlRulesOfRFWritePort(), DefaultDecoderGenerator::writeInstructionDismembering(), DefaultDecoderGenerator::writeMoveFieldSignals(), and SocketCodeTable::~SocketCodeTable().
GuardField & MoveSlot::guardField | ( | ) | const |
Returns the guard field of the move slot.
Returns NullGuardField instance if the guard field is missing.
Definition at line 215 of file MoveSlot.cc.
References guardField_, hasGuardField(), and NullGuardField::instance().
Referenced by BEMTester::canAddComponentPriorityEncoding(), BEMValidator::checkGuardField(), childField(), CodeCompressorPlugin::encodeMove(), CodeCompressorPlugin::encodeNOP(), printGuardFieldEncodings(), saveState(), unsetGuardField(), width(), DefaultDecoderGenerator::writeInstructionDismembering(), DefaultDecoderGenerator::writeMoveFieldSignals(), and DefaultDecoderGenerator::writeSquashSignalGenerationProcess().
bool MoveSlot::hasDestinationField | ( | ) | const |
Tells whether the move slot has a destination field.
Definition at line 327 of file MoveSlot.cc.
References destinationField_.
Referenced by BEMValidator::checkDestinationField(), childField(), childFieldCount(), DestinationField::DestinationField(), destinationField(), ProGe::RV32MicroCodeGenerator::findBusWidths(), GuardField::GuardField(), printDestinationFieldEncodings(), saveState(), setDestinationField(), unsetDestinationField(), width(), DefaultDecoderGenerator::writeInstructionDismembering(), and DefaultDecoderGenerator::writeMoveFieldSignals().
bool MoveSlot::hasGuardField | ( | ) | const |
Tells whether the move slot has a guard field.
Definition at line 202 of file MoveSlot.cc.
References guardField_.
Referenced by BEMValidator::checkGuardField(), childField(), childFieldCount(), guardField(), printGuardFieldEncodings(), saveState(), setGuardField(), unsetGuardField(), width(), DefaultDecoderGenerator::writeInstructionDismembering(), DefaultDecoderGenerator::writeMoveFieldSignals(), DefaultDecoderGenerator::writeSquashSignalGenerationProcess(), and DefaultDecoderGenerator::writeSquashSignals().
bool MoveSlot::hasSourceField | ( | ) | const |
Tells whether the move slot has a source field.
Definition at line 264 of file MoveSlot.cc.
References sourceField_.
Referenced by BEMValidator::checkSourceField(), childField(), childFieldCount(), GuardField::GuardField(), printSourceFieldEncodings(), saveState(), setSourceField(), SourceField::SourceField(), sourceField(), unsetSourceField(), width(), DefaultDecoderGenerator::writeInstructionDismembering(), and DefaultDecoderGenerator::writeMoveFieldSignals().
|
virtual |
Loads the state of the move slot from the given ObjectState tree.
state | The ObjectState tree. |
ObjectStateLoadingException | If an error occurs while loading the state. |
Reimplemented from InstructionField.
Definition at line 432 of file MoveSlot.cc.
References ObjectState::child(), ObjectState::childCount(), deleteDestinationField(), deleteGuardField(), deleteSourceField(), Exception::errorMessage(), InstructionField::loadState(), ObjectState::name(), OSKEY_BUS_NAME, DestinationField::OSNAME_DESTINATION_FIELD, GuardField::OSNAME_GUARD_FIELD, SourceField::OSNAME_SOURCE_FIELD, InstructionField::reorderSubfields(), setName(), and ObjectState::stringAttribute().
Referenced by MoveSlot().
std::string MoveSlot::name | ( | ) | const |
Returns the bus name programmed by this move slot in the instruction word.
Definition at line 136 of file MoveSlot.cc.
References name_.
Referenced by CodeCompressorPlugin::addBitsForDestinationField(), CodeCompressorPlugin::addBitsForGuardField(), CodeCompressorPlugin::addBitsForMoveSlot(), CodeCompressorPlugin::addBitsForSourceField(), BEMGenerator::addEncodings(), BinaryEncoding::addMoveSlot(), BEMGenerator::addSubfields(), BEMValidator::checkSocketCodeTable(), CodeCompressorPlugin::encodeFUTerminal(), CodeCompressorPlugin::encodeImmediateTerminal(), CodeCompressorPlugin::encodeIUTerminal(), CodeCompressorPlugin::encodeMove(), CodeCompressorPlugin::encodeNOP(), CodeCompressorPlugin::encodeRFTerminal(), ProGe::RV32MicroCodeGenerator::findBusWidths(), DefaultDecoderGenerator::findGuard(), BinaryEncoding::hasMoveSlot(), BEMGenerator::maxLongImmSlotWidth(), BinaryEncoding::moveSlot(), BEMValidator::needsSourceField(), DefaultDecoderGenerator::portCodeCondition(), printInstructionLayout(), printMoveSlot(), DefaultDecoderGenerator::rfOpcodeFromSrcOrDstField(), saveState(), SourceField::setImmediateEncoding(), setName(), DefaultDecoderGenerator::socketEncodingCondition(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), DefaultDecoderGenerator::writeInstructionDismembering(), DefaultDecoderGenerator::writeMoveFieldSignals(), and DefaultDecoderGenerator::writeSquashSignalGenerationProcess().
BinaryEncoding * MoveSlot::parent | ( | ) | const |
Returns the parent binary encoding.
Definition at line 118 of file MoveSlot.cc.
References assert, and InstructionField::parent().
Referenced by BinaryEncoding::addMoveSlot(), DestinationField::DestinationField(), MoveSlot(), BinaryEncoding::removeMoveSlot(), setName(), SocketEncoding::SocketEncoding(), SourceField::SourceField(), unsetDestinationField(), unsetGuardField(), unsetSourceField(), and ~MoveSlot().
|
virtual |
Saves the state of the move slot to an ObjectState tree.
Reimplemented from InstructionField.
Definition at line 469 of file MoveSlot.cc.
References ObjectState::addChild(), destinationField(), guardField(), hasDestinationField(), hasGuardField(), hasSourceField(), name(), OSKEY_BUS_NAME, OSNAME_MOVE_SLOT, InstructionField::saveState(), ObjectState::setAttribute(), ObjectState::setName(), and sourceField().
Referenced by BinaryEncoding::saveState().
void MoveSlot::setDestinationField | ( | DestinationField & | field | ) |
Adds the given destination field to the move slot.
This method is to be called from the constructor of DestinationField.
field | The destination field to be added. |
ObjectAlreadyExists | If the move slot has a destination field already. |
Definition at line 296 of file MoveSlot.cc.
References assert, destinationField_, hasDestinationField(), and SlotField::parent().
Referenced by DestinationField::DestinationField().
void MoveSlot::setGuardField | ( | GuardField & | field | ) |
Adds the given guard field to the move slot.
This method is to be called from the constructor of GuardField.
field | The guard field to be added. |
ObjectAlreadyExists | If the move slot has a guard field already. |
Definition at line 171 of file MoveSlot.cc.
References assert, guardField_, hasGuardField(), and GuardField::parent().
Referenced by GuardField::GuardField().
void MoveSlot::setName | ( | const std::string & | name | ) |
Sets the name of the bus programmed by this move slot.
name | Name of the bus. |
ObjectAlreadyExists | If there is a move slot that programs the given bus already. |
Definition at line 149 of file MoveSlot.cc.
References name(), name_, and parent().
Referenced by loadState().
void MoveSlot::setSourceField | ( | SourceField & | field | ) |
Adds the given source field to the move slot.
This method is to be called from the constructor of SourceField.
field | The source field to be added. |
ObjectAlreadyExists | If the move slot has a source field already. |
Definition at line 233 of file MoveSlot.cc.
References assert, hasSourceField(), SlotField::parent(), and sourceField_.
Referenced by SourceField::SourceField().
SourceField & MoveSlot::sourceField | ( | ) | const |
Returns the source field of the move slot.
Returns NullSourceField if the move slot does not have a source field.
Definition at line 277 of file MoveSlot.cc.
References hasSourceField(), NullSourceField::instance(), and sourceField_.
Referenced by BEMTester::canAddComponentPriorityEncoding(), BEMValidator::checkSourceField(), childField(), CodeCompressorPlugin::encodeMove(), CodeCompressorPlugin::encodeNOP(), printSourceFieldEncodings(), saveState(), SourceField::SourceField(), unsetSourceField(), width(), DefaultDecoderGenerator::writeBusControlRulesOfOutputSocket(), DefaultDecoderGenerator::writeBusControlRulesOfSImmSocketOfBus(), DefaultDecoderGenerator::writeControlRulesOfFUOutputPort(), DefaultDecoderGenerator::writeControlRulesOfRFReadPort(), DefaultDecoderGenerator::writeInstructionDismembering(), DefaultDecoderGenerator::writeMoveFieldSignals(), DefaultDecoderGenerator::writeSimmDataSignal(), and SocketCodeTable::~SocketCodeTable().
void MoveSlot::unsetDestinationField | ( | ) |
Removes the destination field from the move slot.
This method is to be called from the destructor of DestinationField.
Definition at line 314 of file MoveSlot.cc.
References assert, destinationField(), destinationField_, hasDestinationField(), and parent().
Referenced by DestinationField::~DestinationField().
void MoveSlot::unsetGuardField | ( | ) |
Removes the guard field from the move slot.
This method is to be called from the destructor of GuardField.
Definition at line 189 of file MoveSlot.cc.
References assert, guardField(), guardField_, hasGuardField(), and parent().
Referenced by GuardField::~GuardField().
void MoveSlot::unsetSourceField | ( | ) |
Removes the source field from the move slot.
This method is to be called from the destructor of SourceField.
Definition at line 251 of file MoveSlot.cc.
References assert, hasSourceField(), parent(), sourceField(), and sourceField_.
Referenced by SourceField::~SourceField().
|
virtual |
Returns the bit width of the move slot.
Implements InstructionField.
Definition at line 406 of file MoveSlot.cc.
References destinationField(), guardField(), hasDestinationField(), hasGuardField(), hasSourceField(), sourceField(), SourceField::width(), SlotField::width(), and GuardField::width().
Referenced by CodeCompressorPlugin::addBitsForMoveSlot(), BEMGenerator::addSubfields(), CodeCompressorPlugin::bemInstructionBits(), BEMTester::canAddComponentPriorityEncoding(), CodeCompressorPlugin::encodeMove(), ProGe::RV32MicroCodeGenerator::findBusWidths(), CodeCompressorPlugin::moveSlotWidth(), printInstructionLayout(), printMoveSlot(), BinaryEncoding::width(), DefaultDecoderGenerator::writeInstructionDismembering(), and DefaultDecoderGenerator::writeMoveFieldSignals().
|
private |
The destination field.
Definition at line 112 of file MoveSlot.hh.
Referenced by deleteDestinationField(), destinationField(), hasDestinationField(), setDestinationField(), and unsetDestinationField().
|
private |
The guard field.
Definition at line 108 of file MoveSlot.hh.
Referenced by deleteGuardField(), guardField(), hasGuardField(), setGuardField(), and unsetGuardField().
|
private |
|
static |
ObjectState attribute key for the name of the bus.
Definition at line 98 of file MoveSlot.hh.
Referenced by loadState(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), and saveState().
|
static |
ObjectState name for move slot.
Definition at line 96 of file MoveSlot.hh.
Referenced by BEMSerializer::convertToFileFormat(), BinaryEncoding::loadState(), BEMSerializer::moveSlotToOM(), and saveState().
|
private |
The source field.
Definition at line 110 of file MoveSlot.hh.
Referenced by deleteSourceField(), hasSourceField(), setSourceField(), sourceField(), and unsetSourceField().