OpenASIP
2.0
|
#include <ImmediateEncoding.hh>
Public Member Functions | |
ImmediateEncoding (unsigned int encoding, unsigned int extraBits, int immediateWidth, SourceField &parent) | |
ImmediateEncoding (const ObjectState *state, SourceField &parent) | |
virtual | ~ImmediateEncoding () |
SourceField * | parent () const |
int | immediateWidth () const |
int | encodingWidth () const |
int | encodingPosition () const |
int | immediatePosition () const |
virtual int | bitPosition () const |
virtual int | width () const |
virtual ObjectState * | saveState () const |
Public Member Functions inherited from Encoding | |
virtual | ~Encoding () |
InstructionField * | parent () const |
unsigned int | encoding () const |
unsigned int | extraBits () const |
Static Public Attributes | |
static const std::string | OSNAME_IMM_ENCODING = "imm_encoding" |
ObjectState name for immediate encoding. More... | |
static const std::string | OSKEY_IMM_WIDTH = "imm_width" |
ObjectState attribute key for the immediate width. More... | |
Static Public Attributes inherited from Encoding | |
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... | |
Private Attributes | |
int | immediateWidth_ |
Additional Inherited Members | |
Protected Member Functions inherited from Encoding | |
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) |
Represents the encoding for inline immediate within the source field.
Definition at line 44 of file ImmediateEncoding.hh.
ImmediateEncoding::ImmediateEncoding | ( | unsigned int | encoding, |
unsigned int | extraBits, | ||
int | immediateWidth, | ||
SourceField & | parent | ||
) |
The constructor.
Registers the encoding automatically to the parent source field.
encoding | The encoding for inline immediates. |
extraBits | The number of extra bits in the encoding. |
immediateWidth | Width of the inline immediate. |
parent | The parent source field. |
ObjectAlreadyExists | If the given source field has an immediate encoding already or if the encoding is ambiguous with some socket or bridge encoding in the source field. |
OutOfRange | If the given immediate width is negative. |
Definition at line 60 of file ImmediateEncoding.cc.
References __func__, immediateWidth(), parent(), SourceField::setImmediateEncoding(), and Encoding::setParent().
ImmediateEncoding::ImmediateEncoding | ( | const ObjectState * | state, |
SourceField & | parent | ||
) |
The constructor.
Loads the state of the object from the given ObjectState instance.
state | The ObjectState instance. |
parent | The parent source field. |
ObjectAlreadyExists | If the given source field has an immediate encoding already or if the encoding is ambiguous with some socket or bridge encoding in the source field. |
ObjectStateLoadingException | If the given ObjectState instance is erroneous. |
Definition at line 86 of file ImmediateEncoding.cc.
References __func__, Exception::errorMessage(), immediateWidth_, ObjectState::intAttribute(), ObjectState::name(), OSKEY_IMM_WIDTH, OSNAME_IMM_ENCODING, parent(), SourceField::setImmediateEncoding(), and Encoding::setParent().
|
virtual |
The destructor.
Definition at line 112 of file ImmediateEncoding.cc.
References assert, parent(), Encoding::setParent(), and SourceField::unsetImmediateEncoding().
|
virtual |
Returns always 0.
Implements Encoding.
Definition at line 196 of file ImmediateEncoding.cc.
int ImmediateEncoding::encodingPosition | ( | ) | const |
Returns the position of the immediate encoding.
Definition at line 166 of file ImmediateEncoding.cc.
References encodingWidth(), InstructionField::extraBits(), BinaryEncoding::LEFT, parent(), and SourceField::width().
Referenced by BEMTester::conflictsWithSourceEncodings(), and DefaultDecoderGenerator::writeBusControlRulesOfSImmSocketOfBus().
int ImmediateEncoding::encodingWidth | ( | ) | const |
Returns the encoding width.
Definition at line 155 of file ImmediateEncoding.cc.
References Encoding::width().
Referenced by BEMTester::conflictsWithSourceEncodings(), CodeCompressorPlugin::encodeImmediateTerminal(), encodingPosition(), printSourceFieldEncodings(), width(), and DefaultDecoderGenerator::writeBusControlRulesOfSImmSocketOfBus().
int ImmediateEncoding::immediatePosition | ( | ) | const |
Returns the position of the short immediate within the source field.
Definition at line 181 of file ImmediateEncoding.cc.
References InstructionField::extraBits(), immediateWidth(), BinaryEncoding::LEFT, parent(), and SourceField::width().
Referenced by DefaultDecoderGenerator::writeBusControlRulesOfSImmSocketOfBus(), and DefaultDecoderGenerator::writeSimmDataSignal().
int ImmediateEncoding::immediateWidth | ( | ) | const |
Returns the immediate width.
Definition at line 144 of file ImmediateEncoding.cc.
References immediateWidth_.
Referenced by ImmediateEncoding(), immediatePosition(), printSourceFieldEncodings(), saveState(), width(), DefaultDecoderGenerator::writeBusControlRulesOfSImmSocketOfBus(), and DefaultDecoderGenerator::writeSimmDataSignal().
SourceField * ImmediateEncoding::parent | ( | ) | const |
Returns the parent source field.
Definition at line 126 of file ImmediateEncoding.cc.
References assert, and Encoding::parent().
Referenced by encodingPosition(), ImmediateEncoding(), immediatePosition(), SourceField::setImmediateEncoding(), and ~ImmediateEncoding().
|
virtual |
Saves the state of the object to an ObjectState instance.
Reimplemented from Encoding.
Definition at line 218 of file ImmediateEncoding.cc.
References immediateWidth(), OSKEY_IMM_WIDTH, OSNAME_IMM_ENCODING, Encoding::saveState(), ObjectState::setAttribute(), and ObjectState::setName().
|
virtual |
Returns the width of the encoding + immediate width.
Reimplemented from Encoding.
Definition at line 207 of file ImmediateEncoding.cc.
References encodingWidth(), and immediateWidth().
Referenced by BEMTester::canAddComponentEncoding(), printSourceFieldEncodings(), and SourceField::width().
|
private |
Definition at line 68 of file ImmediateEncoding.hh.
Referenced by ImmediateEncoding(), and immediateWidth().
|
static |
ObjectState attribute key for the immediate width.
Definition at line 65 of file ImmediateEncoding.hh.
Referenced by ImmediateEncoding(), saveState(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().
|
static |
ObjectState name for immediate encoding.
Definition at line 63 of file ImmediateEncoding.hh.
Referenced by ImmediateEncoding(), SourceField::loadState(), saveState(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().