192 if (requiredVersion > 1.5) {
195 "Cannot parse the file. "
196 "The file requests parser version of " +
199 "The version of the parser is 1.5.");
291 for (
int i = 0; i < fileState->
childCount(); i++) {
330 const string version =
"1.5";
331 const string requiredVersion =
"1.5";
336 for (
int i = 0; i < state->
childCount(); i++) {
344 for (
int i = 0; i < state->
childCount(); i++) {
353 for (
int i = 0; i < state->
childCount(); i++) {
362 for (
int i = 0; i < state->
childCount(); i++) {
370 for (
int i = 0; i < state->
childCount(); i++) {
378 for (
int i = 0; i < state->
childCount(); i++) {
387 for (
int i = 0; i < state->
childCount(); i++) {
418 for (
int i = 0; i < omTable->
childCount(); i++) {
447 for (
int i = 0; i < omTable->
childCount(); i++) {
480 for (
int i = 0; i < omTable->
childCount(); i++) {
537 for (
int i = 0; i < immTag->
childCount(); i++) {
621 for (
int i = 0; i < gFieldState->
childCount(); i++) {
642 for (
int i = 0; i < gFieldState->
childCount(); i++) {
662 for (
int i = 0; i < gFieldState->
childCount(); i++) {
666 OSNAME_UNCONDITIONAL_GUARD_ENCODING &&
678 for (
int i = 0; i < gFieldState->
childCount(); i++) {
712 std::vector<ObjectState*> socketElems;
716 socketElems.push_back(child);
740 for (vector<ObjectState*>::const_iterator iter = socketElems.begin();
741 iter != socketElems.end(); iter++) {
747 for (
int i = 0; i < sFieldState->
childCount(); i++) {
819 for (
int i = 0; i < sFieldState->
childCount(); i++) {
907 for (
int i = 0; i < omState->
childCount(); i++) {
945 for (
int i = 0; i < scTable->
childCount(); i++) {
1006 for (
int i = 0; i < immTag->
childCount(); i++) {
1011 immControlField->
addChild(mapping);
1020 return immControlField;
1087 for (
int i = 0; i < fileGuard->
childCount(); i++) {
1101 if (inverted ==
TRUE) {
1104 }
else if (inverted ==
FALSE) {
1123 if (inverted ==
TRUE) {
1126 }
else if (inverted ==
FALSE) {
1139 OSNAME_UNCONDITIONAL_GUARD_ENCODING);
1176 sourceField->
addChild(immEncoding);
1191 for (
int i = 0; i < fileSource->
childCount(); i++) {
1196 sourceField->
addChild(bridgeEncoding);
1225 return destinationField;
1261 for (
int i = 0; i < fileSlot->
childCount(); i++) {
1266 slotField->
addChild(socketEncoding);
1323 return immSlotField;
1349 for (
int i = 0; i < fileField->
childCount(); i++) {
#define assert(condition)
const string SC_TABLE_NAME
const string IU_PORT_CODE_IU
const string BEM_VERSION_STR
const string REG_GUARD_CODE
const string ID_POS_RIGHT
const string RF_PORT_CODE_INDEX_WIDTH
const string ALWAYS_TRUE_GUARD_CODE
const string SRC_DST_ID_POS
const string SLOT_GUARD_EXTRA_BITS
const string FU_PORT_CODE_PORT
const string REG_GUARD_CODE_INDEX
const string INSTRUCTION_FORMAT_NAME
const string SOCKET_MAP_CODES
const string IU_PORT_CODE
const string PORT_GUARD_CODE_PORT
const string PORT_GUARD_CODE_INVERTED
const string BEM_SCHEMA_FILE
const string SLOT_GUARD_POSITION
const string IMM_REG_FIELD_ITEMP_NAME
const string REQUIRED_VERSION
const string SOURCE_BRIDGE
const string RF_PORT_CODE
const string SOURCE_BRIDGE_NAME
const string SOCKET_CODE_TABLE
const string SRC_DST_NO_OPERATION_MAP
const string LONG_IMMEDIATE_TAG
const string IMM_REG_FIELD_ITEMP_REG_INDEX
const string REG_GUARD_CODE_RF
const string FU_PORT_CODE_FU
const string SLOT_DESTINATION
const string SLOT_EXTRA_BITS
const string SOURCE_IMMEDIATE_WIDTH
const string SOURCE_IMMEDIATE_MAP_EXTRA_BITS
const string RF_PORT_CODE_ENCODING
const string IMMEDIATE_SLOT_WIDTH
const string SLOT_POSITION
const string LIMM_TAG_MAP_NAME
const string SRC_DST_NO_OPERATION_MAP_EXTRA_BITS
const string FU_PORT_CODE_EXTRA_BITS
const string INSTRUCTION_FORMAT
const string IMM_REG_FIELD_WIDTH
const string IMM_REG_FIELD_POS
const string FU_PORT_CODE_OPERATION
const string ADF_ENCODING
const string SOURCE_BRIDGE_MAP_EXTRA_BITS
const string IMM_REG_FIELD_ITEMP
const string FU_PORT_CODE_ENCODING
const string LIMM_TAG_POSITION
const string REG_GUARD_CODE_INVERTED
const string SRC_DST_EXTRA_BITS
const string PORT_GUARD_CODE_FU
const string SOURCE_IMMEDIATE_MAP
const string SRC_DST_POSITION
const string RF_PORT_CODE_EXTRA_BITS
const string SOCKET_MAP_EXTRA_BITS
const string ALWAYS_FALSE_GUARD_CODE
const string IMM_REG_FIELD
const string SOURCE_IMMEDIATE
const string LIMM_TAG_EXTRA_BITS
const string SRC_DST_NO_OPERATION
const string FU_PORT_CODE
const string SC_TABLE_EXTRA_BITS
const string IMMEDIATE_SLOT
const string PORT_GUARD_CODE
const string RF_PORT_CODE_RF
const string IMMEDIATE_SLOT_NAME
const string IMMEDIATE_SLOT_POS
const string LIMM_TAG_MAP
const string RF_PORT_CODE_MAX_INDEX
const string SOURCE_BRIDGE_MAP
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
const string FALSE
Value used for false in attribute and element values.
const string TRUE
Value used for true in attribute and element values.
const string SLOT_POSITION
Name of the attribute of the slot element.
static ObjectState * longImmDstRegisterFieldToFile(const ObjectState *omState)
static ObjectState * destinationFieldToFile(const ObjectState *dFieldState)
static ObjectState * longImmDstRegFieldToOM(const ObjectState *fileField)
static ObjectState * socketCodeTableToOM(const ObjectState *scTable)
static ObjectState * convertToOMFormat(const ObjectState *fileState)
static void readRegisterFilePortCode(const ObjectState *filePortCode, ObjectState *omPortCode)
BinaryEncoding * readBinaryEncoding()
static void convertZeroEncExtraBits(ObjectState *os)
static ObjectState * longImmTagToOM(const ObjectState *fileTag)
static ObjectState * longImmTagToFile(const ObjectState *immTag)
void writeBinaryEncoding(const BinaryEncoding &bem)
static ObjectState * socketCodeTableToFile(const ObjectState *scTable)
virtual void writeState(const ObjectState *state)
static ObjectState * sourceFieldToFile(const ObjectState *sFieldState)
static ObjectState * immediateSlotToOM(const ObjectState *fileSlot)
static ObjectState * slotFieldToOM(const ObjectState *fileSlot)
static ObjectState * sourceFieldToOM(const ObjectState *fileSource)
static ObjectState * convertToFileFormat(const ObjectState *omState)
static ObjectState * destinationFieldToOM(const ObjectState *fileDestination)
static ObjectState * moveSlotToFile(const ObjectState *slotState)
static ObjectState * guardFieldToFile(const ObjectState *gFieldState)
static ObjectState * slotFieldToFile(const ObjectState *sFieldState)
virtual ObjectState * readState()
static ObjectState * immediateSlotToFile(const ObjectState *slotState)
static ObjectState * moveSlotToOM(const ObjectState *fileSlot)
static ObjectState * guardFieldToOM(const ObjectState *fileGuard)
static const std::string OSNAME_BEM
ObjectState name for binary encoding.
virtual ObjectState * saveState() const
static const std::string OSNAME_TEMPLATE_EXTRA_BITS
static const std::string OSNAME_BRIDGE_ENCODING
ObjectState name for bridge encoding.
static const std::string OSKEY_BRIDGE_NAME
ObjectState attribute key for the name of the bridge.
static const std::string OSNAME_DESTINATION_FIELD
ObjectState name for destination field.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding.
static std::string schemaDirPath(const std::string &prog)
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
static const std::string OSNAME_FU_GUARD_ENCODING
ObjectState name for FU guard encoding.
static const std::string OSKEY_FU_NAME
ObjectState attribute key for the name of the function unit.
static const std::string OSNAME_FU_PORT_CODE
ObjectState name for FU port code.
static const std::string OSKEY_OPERATION_NAME
ObjectState attribute key for the name of the operation.
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
static const std::string OSNAME_GPR_GUARD_ENCODING
ObjectState name for GPR guard encoding.
static const std::string OSKEY_RF_NAME
ObjectState attribute key for the name of the register file.
static const std::string OSKEY_REGISTER_INDEX
ObjectState attribute key for register index.
static const std::string OSKEY_INVERTED
ObjectState attribute key for invert flag.
static const std::string OSKEY_ENCODING
ObjectState attribute key for encoding.
static const std::string OSNAME_GUARD_FIELD
ObjectState name for guard field.
static const std::string OSNAME_IU_PORT_CODE
ObjectState name for RF port code.
static const std::string OSKEY_POSITION
ObjectState attribute key for the relative position of the field.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static const std::string OSKEY_ITEMP
ObjectState attribute key for the name of the instruction template.
static const std::string OSKEY_DST_IU
ObjectState attribute key for the name of the immediate unit.
static const std::string OSNAME_LIMM_DST_REGISTER_FIELD
ObjectState name for long immediate destination register field.
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
static const std::string OSNAME_IU_DESTINATION
ObjectState name for a immediate unit destination.
static const std::string OSKEY_BUS_NAME
ObjectState attribute key for the name of the bus.
static const std::string OSNAME_MOVE_SLOT
ObjectState name for move slot.
static const std::string OSNAME_NOP_ENCODING
ObjectState name for NOP encoding.
bool hasAttribute(const std::string &name) const
ObjectState * childByName(const std::string &name) const
double doubleAttribute(const std::string &name) const
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void setValue(const std::string &value)
void removeChild(ObjectState *child)
bool hasChild(const std::string &name) const
ObjectState * child(int index) const
void addChild(ObjectState *child)
std::string stringAttribute(const std::string &name) const
bool boolAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string stringValue() const
static const std::string OSKEY_INDEX_WIDTH
ObjectState attribute key for the widht of register index.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding.
static const std::string OSKEY_UNIT_NAME
ObjectState attribute key for the name of the unit.
static const std::string OSKEY_MAX_INDEX
ObjectState attribute key for the max-index attribute.
static const std::string OSNAME_RF_PORT_CODE
ObjectState name for RF port code.
static const std::string OSNAME_SLOT_FIELD
ObjectState name for slot field.
static const std::string OSKEY_COMPONENT_ID_POSITION
ObjectState attribute key for component ID position.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static const std::string OSKEY_NAME
ObjectState attribute key for name of the table.
static const std::string OSNAME_SOCKET_CODE_TABLE
ObjectState name for socket code table.
static const std::string OSNAME_SOCKET_ENCODING
ObjectState name for socket encoding.
static const std::string OSKEY_SOCKET_NAME
ObjectState attribute key for the name of the socket.
static const std::string OSKEY_SC_TABLE
ObjectState attribute key for the name of the socket code table.
static const std::string OSNAME_SOURCE_FIELD
ObjectState name for source field.
static const std::string OSNAME_UNCONDITIONAL_GUARD_ENCODING
ObjectState name for unconditional guard encoding.
void setUseSchema(bool useSchema)
void setSchemaFile(const std::string &fileName)
virtual void writeState(const ObjectState *rootState)
virtual ObjectState * readState()