OpenASIP
2.0
|
#include <Encoding.hh>
Public Member Functions | |
virtual | ~Encoding () |
InstructionField * | parent () const |
unsigned int | encoding () const |
unsigned int | extraBits () const |
virtual int | width () const |
virtual int | bitPosition () const =0 |
virtual ObjectState * | saveState () const |
Static Public Attributes | |
static const std::string | OSNAME_ENCODING = "encoding" |
ObjectState name for Encoding class. More... | |
static const std::string | OSKEY_ENCODING = "encoding" |
ObjectState attribute key for the encoding. More... | |
static const std::string | OSKEY_EXTRA_BITS = "extra_bits" |
ObjectState attribute key for the number of extra bits. More... | |
Protected Member Functions | |
Encoding (unsigned int encoding, unsigned int extraBits, InstructionField *parent) | |
Encoding (const ObjectState *state, InstructionField *parent) | |
void | setParent (InstructionField *parent) |
void | setEncoding (unsigned int encoding, unsigned int extraBits) |
Private Attributes | |
unsigned int | encoding_ |
The encoding. More... | |
unsigned int | extraBits_ |
The number of extra bits. More... | |
InstructionField * | parent_ |
The parent instruction field. More... | |
Represents an encoding of a source of destination within a move slot. This is a base class for different encodings.
Definition at line 46 of file Encoding.hh.
|
virtual |
|
protected |
The constructor.
encoding | The encoding. |
extraBits | The number of extra bits. |
parent | The parent pointer. |
Definition at line 53 of file Encoding.cc.
|
protected |
The constructor.
Loads the state of the object from the given ObjectState instance.
state | The ObjectState instance. |
parent | The parent pointer. |
ObjectStateLoadingException | If an error occurs while loading the state. |
Definition at line 71 of file Encoding.cc.
References encoding_, Exception::errorMessage(), extraBits_, ObjectState::intAttribute(), OSKEY_ENCODING, and OSKEY_EXTRA_BITS.
|
pure virtual |
Returns the position of the encoding within the parent field.
Implemented in SocketEncoding, ImmediateEncoding, BridgeEncoding, and NOPEncoding.
unsigned int Encoding::encoding | ( | ) | const |
Returns the encoding.
Definition at line 108 of file Encoding.cc.
References encoding_.
Referenced by SourceField::addBridgeEncoding(), SlotField::addSocketEncoding(), BEMTester::canAddComponentEncoding(), BEMTester::conflictsWithDestinationEncodings(), BEMTester::conflictsWithSourceEncodings(), CodeCompressorPlugin::encodeFUTerminal(), CodeCompressorPlugin::encodeImmediateTerminal(), CodeCompressorPlugin::encodeIUTerminal(), CodeCompressorPlugin::encodeNOP(), CodeCompressorPlugin::encodeRFTerminal(), printSlotFieldEncodings(), printSourceFieldEncodings(), saveState(), SocketEncoding::setEncoding(), setEncoding(), SourceField::setImmediateEncoding(), SlotField::setNoOperationEncoding(), DefaultDecoderGenerator::socketEncodingCondition(), SocketEncoding::socketIDWidth(), width(), and DefaultDecoderGenerator::writeBusControlRulesOfSImmSocketOfBus().
unsigned int Encoding::extraBits | ( | ) | const |
Returns the number of extra zero bits in the encoding.
Definition at line 119 of file Encoding.cc.
References extraBits_.
Referenced by SourceField::addBridgeEncoding(), SlotField::addSocketEncoding(), BEMTester::canAddComponentEncoding(), saveState(), SocketEncoding::setEncoding(), setEncoding(), SourceField::setImmediateEncoding(), SlotField::setNoOperationEncoding(), SocketEncoding::socketIDWidth(), and width().
InstructionField * Encoding::parent | ( | ) | const |
Returns the parent instruction field.
Definition at line 97 of file Encoding.cc.
References parent_.
Referenced by NOPEncoding::parent(), ImmediateEncoding::parent(), BridgeEncoding::parent(), SocketEncoding::parent(), and setParent().
|
virtual |
Saves the state of the object to an ObjectState instance.
Reimplemented in SocketEncoding, ImmediateEncoding, BridgeEncoding, and NOPEncoding.
Definition at line 141 of file Encoding.cc.
References encoding(), extraBits(), OSKEY_ENCODING, OSKEY_EXTRA_BITS, OSNAME_ENCODING, and ObjectState::setAttribute().
Referenced by NOPEncoding::saveState(), BridgeEncoding::saveState(), ImmediateEncoding::saveState(), and SocketEncoding::saveState().
|
protected |
Sets the encoding
Definition at line 163 of file Encoding.cc.
References encoding(), encoding_, extraBits(), and extraBits_.
Referenced by SocketEncoding::setEncoding().
|
protected |
Sets the parent pointer.
parent | The parent pointer. |
Definition at line 155 of file Encoding.cc.
References parent(), and parent_.
Referenced by BridgeEncoding::BridgeEncoding(), SocketEncoding::detachFromParent(), ImmediateEncoding::ImmediateEncoding(), NOPEncoding::NOPEncoding(), SocketEncoding::setEncoding(), SocketEncoding::SocketEncoding(), BridgeEncoding::~BridgeEncoding(), ImmediateEncoding::~ImmediateEncoding(), and NOPEncoding::~NOPEncoding().
|
virtual |
Returns the bit width required by the encoding.
Reimplemented in SocketEncoding, and ImmediateEncoding.
Definition at line 130 of file Encoding.cc.
References MathTools::bitLength(), encoding(), and extraBits().
Referenced by NOPEncoding::bitPosition(), BridgeEncoding::bitPosition(), BEMTester::canAddComponentEncoding(), CodeCompressorPlugin::encodeNOP(), ImmediateEncoding::encodingWidth(), printSlotFieldEncodings(), printSourceFieldEncodings(), SourceField::width(), and SlotField::width().
|
private |
The encoding.
Definition at line 81 of file Encoding.hh.
Referenced by encoding(), Encoding(), and setEncoding().
|
private |
The number of extra bits.
Definition at line 83 of file Encoding.hh.
Referenced by Encoding(), extraBits(), and setEncoding().
|
static |
ObjectState attribute key for the encoding.
Definition at line 66 of file Encoding.hh.
Referenced by Encoding(), saveState(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().
|
static |
ObjectState attribute key for the number of extra bits.
Definition at line 68 of file Encoding.hh.
Referenced by Encoding(), saveState(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().
|
static |
ObjectState name for Encoding class.
Definition at line 64 of file Encoding.hh.
Referenced by saveState().
|
private |
The parent instruction field.
Definition at line 85 of file Encoding.hh.
Referenced by parent(), and setParent().