|
OpenASIP 2.2
|
#include <InstructionFormat.hh>


Public Member Functions | |
| InstructionFormat (const std::string &name, BinaryEncoding &parent) | |
| InstructionFormat (const ObjectState *state, BinaryEncoding &parent) | |
| ~InstructionFormat () | |
| InstructionField * | parent () const |
| std::string | name () const |
| void | setName (const std::string &name) |
| void | addEncoding (OperationTriggeredEncoding &encoding) |
| void | addOperation (std::string op, int encoding) |
| int | operationCount () const |
| std::string | operationAtIndex (const int index) const |
| bool | hasOperation (const std::string &op) const |
| int | encoding (const std::string &op) const |
| virtual int | childFieldCount () const |
| virtual int | width () const |
| virtual void | loadState (const ObjectState *state) |
| virtual ObjectState * | saveState () const |
Public Member Functions inherited from Serializable | |
| virtual | ~Serializable () |
Static Public Attributes | |
| static const std::string | OSNAME_INSTRUCTION_FORMAT = "ota-format" |
| static const std::string | OSKEY_INSTRUCTION_FORMAT_NAME = "name" |
| static const std::string | OSKEY_OTA_OPERATION_NAME |
| static const std::string | OSKEY_OPERATION_NAME = "name" |
| static const std::string | OSKEY_OPERATION_ENCODING_NAME |
Private Attributes | |
| std::string | name_ |
| BinaryEncoding * | parent_ |
| std::vector< OperationTriggeredEncoding * > | encodings_ |
| std::map< std::string, int > | operations_ |
Definition at line 46 of file InstructionFormat.hh.
| InstructionFormat::InstructionFormat | ( | const std::string & | name, |
| BinaryEncoding & | parent | ||
| ) |
The constructor.
Adds the instruction format to the parent binary encoding automatically.
| name | Name of the instruction format. |
| parent | The parent BinaryEncoding. |
Definition at line 60 of file InstructionFormat.cc.
References parent(), and parent_.

| InstructionFormat::InstructionFormat | ( | const ObjectState * | state, |
| BinaryEncoding & | parent | ||
| ) |
The constructor.
Loads the state of the instruction format 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 78 of file InstructionFormat.cc.
References loadState(), parent(), and parent_.

| InstructionFormat::~InstructionFormat | ( | ) |
The destructor
Definition at line 91 of file InstructionFormat.cc.
| void InstructionFormat::addEncoding | ( | OperationTriggeredEncoding & | encoding | ) |
Adds an operation triggered move slot to the instruction format
| encoding | The operation triggered move slot to be addeed |
| ObjectAlreadyExists | If the slot has already been added to the instruction format. |
Definition at line 139 of file InstructionFormat.cc.
References VectorTools::containsValue(), encoding(), and encodings_.
Referenced by OperationTriggeredEncoding::OperationTriggeredEncoding(), and OperationTriggeredEncoding::OperationTriggeredEncoding().

| void InstructionFormat::addOperation | ( | std::string | op, |
| int | encoding | ||
| ) |
Adds an operation to the instruction format
| ObjectAlreadyExists | If the slot has already been added to the instruction format. |
Definition at line 158 of file InstructionFormat.cc.
References MapTools::containsKey(), encoding(), and operations_.
Referenced by BEMGenerator::addRiscvFormat(), and loadState().

|
virtual |
Returns the number of operation triggered encodings.
Definition at line 174 of file InstructionFormat.cc.
References encodings_.
| int InstructionFormat::encoding | ( | const std::string & | op | ) | const |
Definition at line 212 of file InstructionFormat.cc.
References assert, MapTools::containsKey(), and operations_.
Referenced by addEncoding(), addOperation(), llvm::LLVMTCERISCVIntrinsicsLowering::constructEncoding(), RISCVTDGen::findCustomOps(), and ProGe::RV32MicroCodeGenerator::initializeOperations().

| bool InstructionFormat::hasOperation | ( | const std::string & | op | ) | const |
Definition at line 104 of file InstructionFormat.cc.
References MapTools::containsKey(), and operations_.
Referenced by llvm::LLVMTCERISCVIntrinsicsLowering::findOperationName().

|
virtual |
Loads the state of the instruction format from the given ObjectState tree.
| state | The ObjectState tree. |
| ObjectStateLoadingException | If an error occurs while loading the state. |
Implements Serializable.
Definition at line 226 of file InstructionFormat.cc.
References addOperation(), ObjectState::child(), ObjectState::childCount(), Exception::errorMessage(), ObjectState::intAttribute(), ObjectState::name(), OSKEY_INSTRUCTION_FORMAT_NAME, OSKEY_OPERATION_ENCODING_NAME, OSKEY_OPERATION_NAME, OSKEY_OTA_OPERATION_NAME, OperationTriggeredEncoding::OSNAME_OTA_ENCODING, setName(), and ObjectState::stringAttribute().
Referenced by InstructionFormat().

| std::string InstructionFormat::name | ( | ) | const |
Returns the name of the instruction format.
Definition at line 115 of file InstructionFormat.cc.
References name_.
Referenced by BinaryEncoding::addInstructionFormat(), llvm::LLVMTCERISCVIntrinsicsLowering::findRFormat(), ProGe::RV32MicroCodeGenerator::initializeOperations(), BinaryEncoding::instructionFormat(), and setName().
| std::string InstructionFormat::operationAtIndex | ( | const int | index | ) | const |
Definition at line 200 of file InstructionFormat.cc.
References __func__, operationCount(), and operations_.
Referenced by RISCVTDGen::findCustomOps(), and ProGe::RV32MicroCodeGenerator::initializeOperations().

| int InstructionFormat::operationCount | ( | ) | const |
Definition at line 195 of file InstructionFormat.cc.
References operations_.
Referenced by RISCVTDGen::findCustomOps(), ProGe::RV32MicroCodeGenerator::initializeOperations(), and operationAtIndex().
| InstructionField * InstructionFormat::parent | ( | ) | const |
Definition at line 99 of file InstructionFormat.cc.
References parent_.
Referenced by BinaryEncoding::addInstructionFormat(), InstructionFormat(), InstructionFormat(), and BinaryEncoding::removeInstructionFormat().
|
virtual |
Saves the state of the instruction format to an ObjectState tree.
Implements Serializable.
Definition at line 255 of file InstructionFormat.cc.
References ObjectState::addChild(), encodings_, name_, operations_, OSKEY_INSTRUCTION_FORMAT_NAME, OSKEY_OPERATION_ENCODING_NAME, OSKEY_OPERATION_NAME, OSKEY_OTA_OPERATION_NAME, OSNAME_INSTRUCTION_FORMAT, OperationTriggeredEncoding::saveState(), and ObjectState::setAttribute().

| void InstructionFormat::setName | ( | const std::string & | name | ) |
Sets the name of the instruction format.
| name | The name of the instruction format. |
Definition at line 126 of file InstructionFormat.cc.
Referenced by loadState().

|
virtual |
Returns the bit width of the instruction format.
Definition at line 185 of file InstructionFormat.cc.
References encodings_, width(), and OperationTriggeredEncoding::width().
Referenced by width().

|
private |
Definition at line 90 of file InstructionFormat.hh.
Referenced by addEncoding(), childFieldCount(), saveState(), and width().
|
private |
Definition at line 87 of file InstructionFormat.hh.
Referenced by name(), saveState(), and setName().
|
private |
Definition at line 91 of file InstructionFormat.hh.
Referenced by addOperation(), encoding(), hasOperation(), operationAtIndex(), operationCount(), and saveState().
|
static |
Definition at line 79 of file InstructionFormat.hh.
Referenced by loadState(), and saveState().
|
static |
Definition at line 82 of file InstructionFormat.hh.
Referenced by loadState(), and saveState().
|
static |
Definition at line 81 of file InstructionFormat.hh.
Referenced by loadState(), and saveState().
|
static |
Definition at line 80 of file InstructionFormat.hh.
Referenced by loadState(), and saveState().
|
static |
Definition at line 78 of file InstructionFormat.hh.
Referenced by BEMSerializer::convertToFileFormat(), and saveState().
|
private |
Definition at line 88 of file InstructionFormat.hh.
Referenced by InstructionFormat(), InstructionFormat(), and parent().