OpenASIP
2.0
|
#include <PortCode.hh>
Public Member Functions | |
virtual | ~PortCode () |
std::string | unitName () const |
bool | hasEncoding () const |
unsigned int | encoding () const |
unsigned int | extraBits () const |
int | width () const |
int | encodingWidth () const |
int | indexWidth () const |
void | setMaxIndex (unsigned regIndex) |
bool | isMaxIndexSet () const |
unsigned | maxIndex () const |
SocketCodeTable * | parent () const |
virtual ObjectState * | saveState () const |
Static Public Attributes | |
static const std::string | OSNAME_PORT_CODE = "port_code" |
ObjectState name for PortCode. More... | |
static const std::string | OSKEY_UNIT_NAME = "unit_name" |
ObjectState attribute key for the name of the unit. 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... | |
static const std::string | OSKEY_INDEX_WIDTH = "index_width" |
ObjectState attribute key for the widht of register index. More... | |
static const std::string | OSKEY_MAX_INDEX = "max-index" |
ObjectState attribute key for the max-index attribute. More... | |
Protected Member Functions | |
PortCode (const std::string &unitName, unsigned int encoding, unsigned int extraBits, int indexWidth) | |
PortCode (const std::string &unitName, int indexWidth) | |
PortCode (const ObjectState *state) | |
void | setParent (SocketCodeTable *parent) |
Private Attributes | |
std::string | unitName_ |
Name of the unit. More... | |
unsigned int | encoding_ |
The encoding. More... | |
unsigned int | extraBits_ |
The number of extra bits in the encoding. More... | |
int | indexWidth_ |
The width of the register index in the port code. More... | |
bool | hasEncoding_ |
Tells whether the port code has an encoding. More... | |
SocketCodeTable * | parent_ |
The parent socket code table. More... | |
unsigned | maxRegIndex_ |
In case this is set to non-zero, the whole width of the index field is not used because the number of register indices is not an exponent of two. This allow sharing the field with other values. More... | |
Base class for FUPortCode, RFPortCode and IUPortCode.
Definition at line 45 of file PortCode.hh.
|
virtual |
|
protected |
The constructor.
Creates a port code with port ID.
unitName | Name of the unit. |
encoding | The encoding. |
extraBits | The number of extra bits in the encoding. |
indexWidth | The width of the register index. |
OutOfRange | If the some of the given values is negative. |
Definition at line 56 of file PortCode.cc.
References __func__, and indexWidth_.
|
protected |
The constructor.
Creates a port code without port ID.
unitName | Name of the unit. |
indexWidth | The width of the register index. |
OutOfRange | If the some of the given values is negative. |
Definition at line 80 of file PortCode.cc.
References __func__, and indexWidth_.
|
protected |
The constructor.
Loads the state of the object from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance is erroneous. |
Definition at line 102 of file PortCode.cc.
References __func__, encoding_, extraBits_, ObjectState::hasAttribute(), hasEncoding_, indexWidth_, ObjectState::intAttribute(), maxRegIndex_, OSKEY_ENCODING, OSKEY_EXTRA_BITS, OSKEY_INDEX_WIDTH, OSKEY_MAX_INDEX, OSKEY_UNIT_NAME, ObjectState::stringAttribute(), and unitName_.
unsigned int PortCode::encoding | ( | ) | const |
Returns the encoding.
NotAvailable | If the port code does not have an encoding (port ID). |
Definition at line 164 of file PortCode.cc.
References __func__, encoding_, and hasEncoding().
Referenced by SocketCodeTable::addFUPortCode(), SocketCodeTable::addIUPortCode(), SocketCodeTable::addRFPortCode(), BEMTester::canAddPortEncoding(), BEMTester::conflictsWithSocketTableEncodings(), CodeCompressorPlugin::encodeFUTerminal(), portCodeBits(), DefaultDecoderGenerator::portCodeCondition(), saveState(), CodeCompressorPlugin::socketCodeBits(), width(), and DefaultDecoderGenerator::writeControlRulesOfFUInputPort().
int PortCode::encodingWidth | ( | ) | const |
Returns the width of the encoding (port ID).
Definition at line 204 of file PortCode.cc.
References indexWidth(), and width().
Referenced by BEMTester::canAddPortEncoding(), BEMTester::conflictsWithSocketTableEncodings(), portCodeBits(), DefaultDecoderGenerator::portCodeCondition(), and DefaultDecoderGenerator::writeControlRulesOfFUInputPort().
unsigned int PortCode::extraBits | ( | ) | const |
Returns the number of extra bits in the encoding.
Definition at line 177 of file PortCode.cc.
References extraBits_.
Referenced by SocketCodeTable::addFUPortCode(), SocketCodeTable::addIUPortCode(), SocketCodeTable::addRFPortCode(), BEMTester::canAddPortEncoding(), saveState(), and width().
bool PortCode::hasEncoding | ( | ) | const |
Tells whether the port code has an encoding (port ID).
Definition at line 151 of file PortCode.cc.
References hasEncoding_.
Referenced by SocketCodeTable::addIUPortCode(), SocketCodeTable::addRFPortCode(), encoding(), portCodeBits(), saveState(), CodeCompressorPlugin::socketCodeBits(), width(), DefaultDecoderGenerator::writeControlRulesOfRFReadPort(), and DefaultDecoderGenerator::writeControlRulesOfRFWritePort().
int PortCode::indexWidth | ( | ) | const |
Returns the width of the register index (opcode).
Definition at line 215 of file PortCode.cc.
References indexWidth_.
Referenced by BEMTester::conflictsWithSocketTableEncodings(), encodingWidth(), portCodeBits(), DefaultDecoderGenerator::portCodeCondition(), DefaultDecoderGenerator::rfOpcodeFromSrcOrDstField(), saveState(), CodeCompressorPlugin::socketCodeBits(), width(), and DefaultDecoderGenerator::writeControlRulesOfFUInputPort().
|
inline |
|
inline |
SocketCodeTable * PortCode::parent | ( | ) | const |
Returns the parent socket code table.
Definition at line 226 of file PortCode.cc.
References parent_.
Referenced by SocketCodeTable::addIUPortCode(), SocketCodeTable::addRFPortCode(), FUPortCode::FUPortCode(), IUPortCode::IUPortCode(), portCodeBits(), SocketCodeTable::removeFUPortCode(), SocketCodeTable::removeIUPortCode(), SocketCodeTable::removeRFPortCode(), RFPortCode::RFPortCode(), setParent(), FUPortCode::~FUPortCode(), IUPortCode::~IUPortCode(), and RFPortCode::~RFPortCode().
|
virtual |
Saves the state of the object to an ObjectState instance.
Reimplemented in FUPortCode, RFPortCode, and IUPortCode.
Definition at line 237 of file PortCode.cc.
References encoding(), extraBits(), hasEncoding(), indexWidth(), maxRegIndex_, OSKEY_ENCODING, OSKEY_EXTRA_BITS, OSKEY_INDEX_WIDTH, OSKEY_MAX_INDEX, OSKEY_UNIT_NAME, OSNAME_PORT_CODE, ObjectState::setAttribute(), and unitName().
Referenced by IUPortCode::saveState(), RFPortCode::saveState(), and FUPortCode::saveState().
|
inline |
|
protected |
Sets the parent socket code table pointer.
parent | The parent pointer. |
Definition at line 256 of file PortCode.cc.
References parent(), and parent_.
Referenced by FUPortCode::FUPortCode(), IUPortCode::IUPortCode(), RFPortCode::RFPortCode(), FUPortCode::~FUPortCode(), IUPortCode::~IUPortCode(), and RFPortCode::~RFPortCode().
std::string PortCode::unitName | ( | ) | const |
Returns the name of the unit.
Definition at line 140 of file PortCode.cc.
References unitName_.
Referenced by SocketCodeTable::addFUPortCode(), SocketCodeTable::addIUPortCode(), SocketCodeTable::addRFPortCode(), SocketCodeTable::fuPortCode(), SocketCodeTable::iuPortCode(), portCodeDescription(), SocketCodeTable::rfPortCode(), and saveState().
int PortCode::width | ( | ) | const |
Returns the width of the whole port code (portID + opcode).
Definition at line 188 of file PortCode.cc.
References MathTools::bitLength(), encoding(), extraBits(), hasEncoding(), and indexWidth().
Referenced by encodingWidth(), SocketCodeTable::maxCodeWidth(), portCodeBits(), and CodeCompressorPlugin::socketCodeBits().
|
private |
|
private |
The number of extra bits in the encoding.
Definition at line 93 of file PortCode.hh.
Referenced by extraBits(), and PortCode().
|
private |
Tells whether the port code has an encoding.
Definition at line 97 of file PortCode.hh.
Referenced by hasEncoding(), and PortCode().
|
private |
The width of the register index in the port code.
Definition at line 95 of file PortCode.hh.
Referenced by indexWidth(), and PortCode().
|
private |
In case this is set to non-zero, the whole width of the index field is not used because the number of register indices is not an exponent of two. This allow sharing the field with other values.
Definition at line 104 of file PortCode.hh.
Referenced by isMaxIndexSet(), maxIndex(), PortCode(), saveState(), and setMaxIndex().
|
static |
ObjectState attribute key for the encoding.
Definition at line 71 of file PortCode.hh.
Referenced by PortCode(), BEMSerializer::readRegisterFilePortCode(), saveState(), BEMSerializer::socketCodeTableToFile(), and BEMSerializer::socketCodeTableToOM().
|
static |
ObjectState attribute key for the number of extra bits.
Definition at line 73 of file PortCode.hh.
Referenced by PortCode(), BEMSerializer::readRegisterFilePortCode(), saveState(), BEMSerializer::socketCodeTableToFile(), and BEMSerializer::socketCodeTableToOM().
|
static |
ObjectState attribute key for the widht of register index.
Definition at line 75 of file PortCode.hh.
Referenced by PortCode(), BEMSerializer::readRegisterFilePortCode(), saveState(), and BEMSerializer::socketCodeTableToFile().
|
static |
ObjectState attribute key for the max-index attribute.
Definition at line 77 of file PortCode.hh.
Referenced by PortCode(), saveState(), and BEMSerializer::socketCodeTableToFile().
|
static |
ObjectState attribute key for the name of the unit.
Definition at line 69 of file PortCode.hh.
Referenced by PortCode(), BEMSerializer::readRegisterFilePortCode(), saveState(), BEMSerializer::socketCodeTableToFile(), and BEMSerializer::socketCodeTableToOM().
|
static |
ObjectState name for PortCode.
Definition at line 67 of file PortCode.hh.
Referenced by saveState().
|
private |
The parent socket code table.
Definition at line 99 of file PortCode.hh.
Referenced by parent(), and setParent().
|
private |
Name of the unit.
Definition at line 89 of file PortCode.hh.
Referenced by PortCode(), and unitName().