OpenASIP  2.0
Public Member Functions | Static Private Member Functions | List of all members
BEMSerializer Class Reference

#include <BEMSerializer.hh>

Inheritance diagram for BEMSerializer:
Inheritance graph
Collaboration diagram for BEMSerializer:
Collaboration graph

Public Member Functions

 BEMSerializer ()
 
virtual ~BEMSerializer ()
 
virtual ObjectStatereadState ()
 
virtual void writeState (const ObjectState *state)
 
BinaryEncodingreadBinaryEncoding ()
 
void writeBinaryEncoding (const BinaryEncoding &bem)
 
- Public Member Functions inherited from XMLSerializer
 XMLSerializer ()
 
virtual ~XMLSerializer ()
 
void setSourceFile (const std::string &fileName)
 
void setSourceString (const std::string &source)
 
void setDestinationFile (const std::string &fileName)
 
void setDestinationString (std::string &destination)
 
void setSchemaFile (const std::string &fileName)
 
void setUseSchema (bool useSchema)
 
void setXMLNamespace (std::string nsUri)
 
- Public Member Functions inherited from TCETools::Serializer
virtual ~Serializer ()
 

Static Private Member Functions

static ObjectStateconvertToOMFormat (const ObjectState *fileState)
 
static ObjectStateconvertToFileFormat (const ObjectState *omState)
 
static void convertZeroEncExtraBits (ObjectState *os)
 
static ObjectStatesocketCodeTableToFile (const ObjectState *scTable)
 
static ObjectStatelongImmTagToFile (const ObjectState *immTag)
 
static ObjectStatemoveSlotToFile (const ObjectState *slotState)
 
static ObjectStateguardFieldToFile (const ObjectState *gFieldState)
 
static ObjectStatesourceFieldToFile (const ObjectState *sFieldState)
 
static ObjectStatedestinationFieldToFile (const ObjectState *dFieldState)
 
static ObjectStateslotFieldToFile (const ObjectState *sFieldState)
 
static ObjectStateimmediateSlotToFile (const ObjectState *slotState)
 
static ObjectStatelongImmDstRegisterFieldToFile (const ObjectState *omState)
 
static ObjectStatesocketCodeTableToOM (const ObjectState *scTable)
 
static ObjectStatelongImmTagToOM (const ObjectState *fileTag)
 
static ObjectStatemoveSlotToOM (const ObjectState *fileSlot)
 
static ObjectStateguardFieldToOM (const ObjectState *fileGuard)
 
static ObjectStatesourceFieldToOM (const ObjectState *fileSource)
 
static ObjectStatedestinationFieldToOM (const ObjectState *fileDestination)
 
static ObjectStateslotFieldToOM (const ObjectState *fileSlot)
 
static ObjectStateimmediateSlotToOM (const ObjectState *fileSlot)
 
static ObjectStatelongImmDstRegFieldToOM (const ObjectState *fileField)
 
static void readRegisterFilePortCode (const ObjectState *filePortCode, ObjectState *omPortCode)
 

Additional Inherited Members

- Protected Member Functions inherited from XMLSerializer
std::string sourceFile () const
 

Detailed Description

BEMSerializer reads and writes BEM (Binary Encoding Map) files.

Definition at line 43 of file BEMSerializer.hh.

Constructor & Destructor Documentation

◆ BEMSerializer()

BEMSerializer::BEMSerializer ( )

The constructor.

Definition at line 164 of file BEMSerializer.cc.

References BEM_SCHEMA_FILE, Environment::schemaDirPath(), XMLSerializer::setSchemaFile(), and XMLSerializer::setUseSchema().

Here is the call graph for this function:

◆ ~BEMSerializer()

BEMSerializer::~BEMSerializer ( )
virtual

The destructor.

Definition at line 173 of file BEMSerializer.cc.

173  {
174 }

Member Function Documentation

◆ convertToFileFormat()

ObjectState * BEMSerializer::convertToFileFormat ( const ObjectState state)
staticprivate

Converts the ObjectState tree that represent the BEM object model to an ObjectState tree that represents the BEM file format.

Parameters
omStateObjectState tree that represents BEM object model (returned by BinaryEncoding::saveState()).
Returns
ObjectState tree representing BEM file.

Definition at line 327 of file BEMSerializer.cc.

327  {
328 
329  ObjectState* fileState = new ObjectState(ADF_ENCODING);
330  const string version = "1.5";
331  const string requiredVersion = "1.5";
332  fileState->setAttribute(BEM_VERSION_STR, version);
333  fileState->setAttribute(REQUIRED_VERSION, requiredVersion);
334 
335  // create socket code tables
336  for (int i = 0; i < state->childCount(); i++) {
337  ObjectState* child = state->child(i);
339  fileState->addChild(socketCodeTableToFile(child));
340  }
341  }
342 
343  // create long immediate tag
344  for (int i = 0; i < state->childCount(); i++) {
345  ObjectState* child = state->child(i);
346  if (child->name() ==
348  fileState->addChild(longImmTagToFile(child));
349  }
350  }
351 
352  // create long immediate destination register fields
353  for (int i = 0; i < state->childCount(); i++) {
354  ObjectState* child = state->child(i);
355  if (child->name() ==
357  fileState->addChild(longImmDstRegisterFieldToFile(child));
358  }
359  }
360 
361  // create move slots
362  for (int i = 0; i < state->childCount(); i++) {
363  ObjectState* child = state->child(i);
364  if (child->name() == MoveSlot::OSNAME_MOVE_SLOT) {
365  fileState->addChild(moveSlotToFile(child));
366  }
367  }
368 
369  // create immediate slots
370  for (int i = 0; i < state->childCount(); i++) {
371  ObjectState* child = state->child(i);
372  if (child->name() ==
374  fileState->addChild(immediateSlotToFile(child));
375  }
376  }
377 
378  for (int i = 0; i < state->childCount(); i++) {
379  ObjectState* child = state->child(i);
381  ObjectState* newChild = new ObjectState(*child);
382  fileState->addChild(newChild);
383  }
384  }
385 
386  // template extra bits: copy OS tree
387  for (int i = 0; i < state->childCount(); i++) {
388  ObjectState* child = state->child(i);
390  fileState->addChild(new ObjectState(*child));
391  }
392  }
393  return fileState;
394 }

References ObjectState::addChild(), ADF_ENCODING, BEM_VERSION_STR, ObjectState::child(), ObjectState::childCount(), immediateSlotToFile(), longImmDstRegisterFieldToFile(), longImmTagToFile(), moveSlotToFile(), ObjectState::name(), ImmediateControlField::OSNAME_IMM_CONTROL_FIELD, ImmediateSlotField::OSNAME_IMMEDIATE_SLOT_FIELD, InstructionFormat::OSNAME_INSTRUCTION_FORMAT, LImmDstRegisterField::OSNAME_LIMM_DST_REGISTER_FIELD, MoveSlot::OSNAME_MOVE_SLOT, SocketCodeTable::OSNAME_SOCKET_CODE_TABLE, BinaryEncoding::OSNAME_TEMPLATE_EXTRA_BITS, REQUIRED_VERSION, ObjectState::setAttribute(), and socketCodeTableToFile().

Referenced by writeState().

Here is the call graph for this function:

◆ convertToOMFormat()

ObjectState * BEMSerializer::convertToOMFormat ( const ObjectState fileState)
staticprivate

Converts the given ObjectState tree that represents a BEM file to an ObjectState tree that can be loaded by BinaryEncoding.

Parameters
fileStateObjectState tree that represents a BEM file.
Returns
A newly created ObjectState tree that can be loaded by BinaryEncoding.

Definition at line 287 of file BEMSerializer.cc.

287  {
288 
290 
291  for (int i = 0; i < fileState->childCount(); i++) {
292  ObjectState* child = fileState->child(i);
293  if (child->name() == SOCKET_CODE_TABLE) {
294  bem->addChild(socketCodeTableToOM(child));
295  } else if (child->name() == SLOT) {
296  bem->addChild(moveSlotToOM(child));
297  } else if (child->name() == IMMEDIATE_SLOT) {
298  bem->addChild(immediateSlotToOM(child));
299  } else if (child->name() == LONG_IMMEDIATE_TAG) {
300  bem->addChild(longImmTagToOM(child));
301  } else if (child->name() == IMM_REG_FIELD) {
302  bem->addChild(longImmDstRegFieldToOM(child));
303  } else if (child->name() == INSTRUCTION_FORMAT) {
304  ObjectState* newChild = new ObjectState(*child);
305  bem->addChild(newChild);
306  } else if (
308  bem->addChild(new ObjectState(*child));
309  } else {
310  assert(false);
311  }
312  }
313 
314  return bem;
315 }

References ObjectState::addChild(), assert, ObjectState::child(), ObjectState::childCount(), IMM_REG_FIELD, IMMEDIATE_SLOT, immediateSlotToOM(), INSTRUCTION_FORMAT, LONG_IMMEDIATE_TAG, longImmDstRegFieldToOM(), longImmTagToOM(), moveSlotToOM(), ObjectState::name(), BinaryEncoding::OSNAME_BEM, BinaryEncoding::OSNAME_TEMPLATE_EXTRA_BITS, SLOT, SOCKET_CODE_TABLE, and socketCodeTableToOM().

Referenced by readState().

Here is the call graph for this function:

◆ convertZeroEncExtraBits()

void BEMSerializer::convertZeroEncExtraBits ( ObjectState os)
staticprivate

Recursively convert all encodings with zero encodings to have one more extra bit.

Definition at line 214 of file BEMSerializer.cc.

214  {
215  if (os->name() == MAP) {
216  if (os->intValue() == 0 && os->hasAttribute(EXTRA_BITS)) {
217  int extraBits = os->intAttribute(EXTRA_BITS);
218  os->setAttribute(EXTRA_BITS, extraBits + 1);
219  }
220  }
221  if (os->name() == FU_PORT_CODE &&
222  os->hasChild(EXTRA_BITS) &&
224  if (os->childByName(FU_PORT_CODE_ENCODING)->intValue() == 0) {
226  eb ->setValue(eb->intValue()+1);
227  }
228  }
229  // call recursively for children
230  for (int i = 0; i < os->childCount(); i++) {
231  ObjectState* child = os->child(i);
233  }
234 }

References ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), EXTRA_BITS, FU_PORT_CODE, FU_PORT_CODE_ENCODING, ObjectState::hasAttribute(), ObjectState::hasChild(), ObjectState::intAttribute(), ObjectState::intValue(), MAP, ObjectState::name(), ObjectState::setAttribute(), and ObjectState::setValue().

Referenced by readState().

Here is the call graph for this function:

◆ destinationFieldToFile()

ObjectState * BEMSerializer::destinationFieldToFile ( const ObjectState dFieldState)
staticprivate

Converts the given ObjectState tree that represents a destination field in object model to BEM file format.

Parameters
dFieldStateThe ObjectState tree.
Returns
The newly created ObjectState tree.

Definition at line 784 of file BEMSerializer.cc.

784  {
785  ObjectState* destination = slotFieldToFile(dFieldState);
786  destination->setName(SLOT_DESTINATION);
787  return destination;
788 }

References ObjectState::setName(), SLOT_DESTINATION, and slotFieldToFile().

Referenced by moveSlotToFile().

Here is the call graph for this function:

◆ destinationFieldToOM()

ObjectState * BEMSerializer::destinationFieldToOM ( const ObjectState fileDestination)
staticprivate

Converts the given ObjectState tree that represents a destination element in BEM file to an ObjectState tree that can be loaded by DestinationField.

Parameters
fileDestinationAn ObjectState tree that represents a destination element in a BEM file.
Returns
The newly created ObjectState tree.

Definition at line 1222 of file BEMSerializer.cc.

1222  {
1223  ObjectState* destinationField = slotFieldToOM(fileDestination);
1225  return destinationField;
1226 }

References DestinationField::OSNAME_DESTINATION_FIELD, ObjectState::setName(), and slotFieldToOM().

Referenced by moveSlotToOM().

Here is the call graph for this function:

◆ guardFieldToFile()

ObjectState * BEMSerializer::guardFieldToFile ( const ObjectState gFieldState)
staticprivate

Converts the given ObjectState tree that represents a guard field in object model to BEM file format.

Parameters
gFieldStateThe ObjectState tree.
Returns
The newly created ObjectState tree.

Definition at line 608 of file BEMSerializer.cc.

608  {
609 
610  ObjectState* guard = new ObjectState(SLOT_GUARD);
612  guard->addChild(position);
613  position->setValue(
616  guard->addChild(extraBits);
617  extraBits->setValue(
619 
620  // add register guard encodings
621  for (int i = 0; i < gFieldState->childCount(); i++) {
622  ObjectState* child = gFieldState->child(i);
624  ObjectState* regGuard = new ObjectState(REG_GUARD_CODE);
625  guard->addChild(regGuard);
626  regGuard->setAttribute(
629  regGuard->setAttribute(
631  child->stringAttribute(
633  string inverted = child->boolAttribute(
635  regGuard->setAttribute(REG_GUARD_CODE_INVERTED, inverted);
636  regGuard->setValue(
638  }
639  }
640 
641  // add port guard encodings
642  for (int i = 0; i < gFieldState->childCount(); i++) {
643  ObjectState* child = gFieldState->child(i);
645  ObjectState* fuGuard = new ObjectState(PORT_GUARD_CODE);
646  guard->addChild(fuGuard);
647  fuGuard->setAttribute(
650  fuGuard->setAttribute(
653  string inverted = child->boolAttribute(
655  fuGuard->setAttribute(PORT_GUARD_CODE_INVERTED, inverted);
656  fuGuard->setValue(
658  }
659  }
660 
661  // add unconditional always-true-guard encoding
662  for (int i = 0; i < gFieldState->childCount(); i++) {
663  ObjectState* child = gFieldState->child(i);
664  if (child->name() ==
666  OSNAME_UNCONDITIONAL_GUARD_ENCODING &&
667  !child->boolAttribute(
670  guard->addChild(ucGuard);
671  ucGuard->setValue(
672  child->stringAttribute(
674  }
675  }
676 
677  // add always-false-guard encoding
678  for (int i = 0; i < gFieldState->childCount(); i++) {
679  ObjectState* child = gFieldState->child(i);
680  if (child->name() ==
682  && child->boolAttribute(
685  guard->addChild(ucGuard);
686  ucGuard->setValue(
687  child->stringAttribute(
689  }
690  }
691 
692  return guard;
693 }

References ObjectState::addChild(), ALWAYS_FALSE_GUARD_CODE, ALWAYS_TRUE_GUARD_CODE, ObjectState::boolAttribute(), ObjectState::child(), ObjectState::childCount(), FALSE, ObjectState::name(), GuardEncoding::OSKEY_ENCODING, InstructionField::OSKEY_EXTRA_BITS, FUGuardEncoding::OSKEY_FU_NAME, GuardEncoding::OSKEY_INVERTED, FUGuardEncoding::OSKEY_PORT_NAME, InstructionField::OSKEY_POSITION, GPRGuardEncoding::OSKEY_REGISTER_INDEX, GPRGuardEncoding::OSKEY_RF_NAME, FUGuardEncoding::OSNAME_FU_GUARD_ENCODING, GPRGuardEncoding::OSNAME_GPR_GUARD_ENCODING, UnconditionalGuardEncoding::OSNAME_UNCONDITIONAL_GUARD_ENCODING, PORT_GUARD_CODE, PORT_GUARD_CODE_FU, PORT_GUARD_CODE_INVERTED, PORT_GUARD_CODE_PORT, REG_GUARD_CODE, REG_GUARD_CODE_INDEX, REG_GUARD_CODE_INVERTED, REG_GUARD_CODE_RF, ObjectState::setAttribute(), ObjectState::setValue(), SLOT_GUARD, SLOT_GUARD_EXTRA_BITS, SLOT_GUARD_POSITION, ObjectState::stringAttribute(), and TRUE.

Referenced by moveSlotToFile().

Here is the call graph for this function:

◆ guardFieldToOM()

ObjectState * BEMSerializer::guardFieldToOM ( const ObjectState fileGuard)
staticprivate

Converts the given ObjectState tree that represents a guard element of BEM file to a new ObjectState tree that can be loaded by GuardField.

Parameters
fileGuardAn ObjectState tree that represents a guard element of BEM file.
Returns
The newly created ObjectState tree.

Definition at line 1076 of file BEMSerializer.cc.

1076  {
1077 
1078  ObjectState* guardField = new ObjectState(
1080  ObjectState* pos = fileGuard->childByName(SLOT_GUARD_POSITION);
1082  ObjectState* extraBits = fileGuard->childByName(SLOT_GUARD_EXTRA_BITS);
1083  guardField->setAttribute(
1085 
1086  // add guard encodings
1087  for (int i = 0; i < fileGuard->childCount(); i++) {
1088  ObjectState* child = fileGuard->child(i);
1089  if (child->name() == REG_GUARD_CODE) {
1090  ObjectState* guardCode = new ObjectState(
1092  guardField->addChild(guardCode);
1093  string regFile = child->stringAttribute(REG_GUARD_CODE_RF);
1094  guardCode->setAttribute(
1096  int regIndex = child->intAttribute(REG_GUARD_CODE_INDEX);
1097  guardCode->setAttribute(
1099  string inverted = child->stringAttribute(
1101  if (inverted == TRUE) {
1102  guardCode->setAttribute(
1104  } else if (inverted == FALSE) {
1105  guardCode->setAttribute(
1107  } else {
1108  assert(false);
1109  }
1110  guardCode->setAttribute(
1112 
1113  } else if (child->name() == PORT_GUARD_CODE) {
1114  ObjectState* guardCode = new ObjectState(
1116  guardField->addChild(guardCode);
1117  string fu = child->stringAttribute(PORT_GUARD_CODE_FU);
1119  string port = child->stringAttribute(PORT_GUARD_CODE_PORT);
1121  string inverted = child->stringAttribute(
1123  if (inverted == TRUE) {
1124  guardCode->setAttribute(
1126  } else if (inverted == FALSE) {
1127  guardCode->setAttribute(
1129  } else {
1130  assert(false);
1131  }
1132  guardCode->setAttribute(
1134 
1135  } else if (child->name() == ALWAYS_TRUE_GUARD_CODE ||
1136  child->name() == ALWAYS_FALSE_GUARD_CODE) {
1137  ObjectState* guardCode = new ObjectState(
1139  OSNAME_UNCONDITIONAL_GUARD_ENCODING);
1140  guardField->addChild(guardCode);
1141  guardCode->setAttribute(
1143  child->stringValue());
1144  if (child->name() == ALWAYS_TRUE_GUARD_CODE) {
1145  guardCode->setAttribute(
1147  } else {
1148  guardCode->setAttribute(
1150  }
1151  }
1152  }
1153 
1154  return guardField;
1155 }

References ObjectState::addChild(), ALWAYS_FALSE_GUARD_CODE, ALWAYS_TRUE_GUARD_CODE, assert, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FALSE, ObjectState::intAttribute(), ObjectState::name(), GuardEncoding::OSKEY_ENCODING, InstructionField::OSKEY_EXTRA_BITS, FUGuardEncoding::OSKEY_FU_NAME, GuardEncoding::OSKEY_INVERTED, FUGuardEncoding::OSKEY_PORT_NAME, InstructionField::OSKEY_POSITION, GPRGuardEncoding::OSKEY_REGISTER_INDEX, GPRGuardEncoding::OSKEY_RF_NAME, FUGuardEncoding::OSNAME_FU_GUARD_ENCODING, GPRGuardEncoding::OSNAME_GPR_GUARD_ENCODING, GuardField::OSNAME_GUARD_FIELD, PORT_GUARD_CODE, PORT_GUARD_CODE_FU, PORT_GUARD_CODE_INVERTED, PORT_GUARD_CODE_PORT, REG_GUARD_CODE, REG_GUARD_CODE_INDEX, REG_GUARD_CODE_INVERTED, REG_GUARD_CODE_RF, ObjectState::setAttribute(), SLOT_GUARD_EXTRA_BITS, SLOT_GUARD_POSITION, ObjectState::stringAttribute(), ObjectState::stringValue(), and TRUE.

Referenced by moveSlotToOM().

Here is the call graph for this function:

◆ immediateSlotToFile()

ObjectState * BEMSerializer::immediateSlotToFile ( const ObjectState slotState)
staticprivate

Converts the given ObjectState instance that represents an ImmediateSlotField instance to BEM file format.

Parameters
slotStateThe ObjectState instance that represents an ImmediateSlotField instance.
Returns
The newly created ObjectState tree.

Definition at line 870 of file BEMSerializer.cc.

870  {
871  ObjectState* immSlot = new ObjectState(IMMEDIATE_SLOT);
872  immSlot->setAttribute(
876  immSlot->addChild(pos);
877  pos->setValue(
880  immSlot->addChild(width);
881  width->setValue(
883  return immSlot;
884 }

References ObjectState::addChild(), IMMEDIATE_SLOT, IMMEDIATE_SLOT_NAME, IMMEDIATE_SLOT_POS, IMMEDIATE_SLOT_WIDTH, ImmediateSlotField::OSKEY_NAME, InstructionField::OSKEY_POSITION, ImmediateSlotField::OSKEY_WIDTH, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToFileFormat().

Here is the call graph for this function:

◆ immediateSlotToOM()

ObjectState * BEMSerializer::immediateSlotToOM ( const ObjectState fileSlot)
staticprivate

Converts the given ObjectState tree that represents immediate-slot element of BEM file to an ObjectState instance that can be loaded by ImmediateSlotField instance.

Parameters
fileSlotObjectState tree that represents immediate-slot element of BEM file.
Returns
The newly created ObjectState instance.

Definition at line 1312 of file BEMSerializer.cc.

1312  {
1313  ObjectState* immSlotField = new ObjectState(
1315  string name = fileSlot->stringAttribute(IMMEDIATE_SLOT_NAME);
1316  immSlotField->setAttribute(ImmediateSlotField::OSKEY_NAME, name);
1317  string width = fileSlot->childByName(IMMEDIATE_SLOT_WIDTH)->
1318  stringValue();
1319  immSlotField->setAttribute(ImmediateSlotField::OSKEY_WIDTH, width);
1320  string pos = fileSlot->childByName(IMMEDIATE_SLOT_POS)->stringValue();
1323  return immSlotField;
1324 }

References ObjectState::childByName(), IMMEDIATE_SLOT_NAME, IMMEDIATE_SLOT_POS, IMMEDIATE_SLOT_WIDTH, InstructionField::OSKEY_EXTRA_BITS, ImmediateSlotField::OSKEY_NAME, InstructionField::OSKEY_POSITION, ImmediateSlotField::OSKEY_WIDTH, ImmediateSlotField::OSNAME_IMMEDIATE_SLOT_FIELD, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToOMFormat().

Here is the call graph for this function:

◆ longImmDstRegFieldToOM()

ObjectState * BEMSerializer::longImmDstRegFieldToOM ( const ObjectState fileField)
staticprivate

Converts the given ObjectState tree that represents a long immediate destination register field in BEM file to an ObjectState tree that can be loaded by LImmDstRegisterField instance.

Parameters
fileFieldThe ObjectState tree that represents long immediate destination register field in BEM file.
Returns
The newly created ObjectState tree.

Definition at line 1337 of file BEMSerializer.cc.

1337  {
1338 
1339  ObjectState* omState = new ObjectState(
1342  omState->setAttribute(
1344  fileField->childByName(IMM_REG_FIELD_POS)->stringValue());
1345  omState->setAttribute(
1348 
1349  for (int i = 0; i < fileField->childCount(); i++) {
1350  ObjectState* child = fileField->child(i);
1351  if (child->name() == IMM_REG_FIELD_ITEMP) {
1352  ObjectState* iuDst = new ObjectState(
1354  omState->addChild(iuDst);
1355  iuDst->setAttribute(
1358  iuDst->setAttribute(
1360  child->child(0)->stringValue());
1361  }
1362  }
1363 
1364  return omState;
1365 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), IMM_REG_FIELD_ITEMP, IMM_REG_FIELD_ITEMP_NAME, IMM_REG_FIELD_POS, IMM_REG_FIELD_WIDTH, ObjectState::name(), LImmDstRegisterField::OSKEY_DST_IU, InstructionField::OSKEY_EXTRA_BITS, LImmDstRegisterField::OSKEY_ITEMP, InstructionField::OSKEY_POSITION, LImmDstRegisterField::OSKEY_WIDTH, LImmDstRegisterField::OSNAME_IU_DESTINATION, LImmDstRegisterField::OSNAME_LIMM_DST_REGISTER_FIELD, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToOMFormat().

Here is the call graph for this function:

◆ longImmDstRegisterFieldToFile()

ObjectState * BEMSerializer::longImmDstRegisterFieldToFile ( const ObjectState omState)
staticprivate

Converts the given ObjectState tree that represent a long immediate destination register field in BEM object model to BEM file format.

Parameters
omStateThe ObjectState tree.
Returns
The newly create ObjectState tree.

Definition at line 895 of file BEMSerializer.cc.

895  {
896 
897  ObjectState* fileState = new ObjectState(IMM_REG_FIELD);
898  ObjectState* posElem = new ObjectState(IMM_REG_FIELD_POS);
899  fileState->addChild(posElem);
900  posElem->setValue(
902  ObjectState* widthElem = new ObjectState(IMM_REG_FIELD_WIDTH);
903  fileState->addChild(widthElem);
904  widthElem->setValue(
906 
907  for (int i = 0; i < omState->childCount(); i++) {
908  ObjectState* child = omState->child(i);
910  ObjectState* iTempElem = new ObjectState(IMM_REG_FIELD_ITEMP);
911  fileState->addChild(iTempElem);
912  iTempElem->setAttribute(
915  ObjectState* regIndexElem = new ObjectState(
917  iTempElem->addChild(regIndexElem);
918  regIndexElem->setValue(
920  }
921 
922  return fileState;
923 }

References ObjectState::addChild(), assert, ObjectState::child(), ObjectState::childCount(), IMM_REG_FIELD, IMM_REG_FIELD_ITEMP, IMM_REG_FIELD_ITEMP_NAME, IMM_REG_FIELD_ITEMP_REG_INDEX, IMM_REG_FIELD_POS, IMM_REG_FIELD_WIDTH, ObjectState::name(), LImmDstRegisterField::OSKEY_DST_IU, LImmDstRegisterField::OSKEY_ITEMP, InstructionField::OSKEY_POSITION, LImmDstRegisterField::OSKEY_WIDTH, LImmDstRegisterField::OSNAME_IU_DESTINATION, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToFileFormat().

Here is the call graph for this function:

◆ longImmTagToFile()

ObjectState * BEMSerializer::longImmTagToFile ( const ObjectState immTag)
staticprivate

Converts the given ObjectState tree that represents immediate control field in object model format to BEM file file format.

Parameters
immTagThe ObjectState tree.
Returns
The newly created ObjectState tree.

Definition at line 524 of file BEMSerializer.cc.

524  {
525 
527  ObjectState* position = new ObjectState(LIMM_TAG_POSITION);
528  fileTag->addChild(position);
529  position->setValue(
531  ObjectState* extraBits = new ObjectState(LIMM_TAG_EXTRA_BITS);
532  fileTag->addChild(extraBits);
533  extraBits->setValue(
535 
536  // create map elements
537  for (int i = 0; i < immTag->childCount(); i++) {
538  ObjectState* child = immTag->child(i);
541  fileTag->addChild(map);
542  map->setAttribute(
544  child->stringAttribute(
546  map->setValue(
548  }
549 
550  return fileTag;
551 }

References ObjectState::addChild(), assert, ObjectState::child(), ObjectState::childCount(), LIMM_TAG_EXTRA_BITS, LIMM_TAG_MAP, LIMM_TAG_MAP_NAME, LIMM_TAG_POSITION, LONG_IMMEDIATE_TAG, ObjectState::name(), ImmediateControlField::OSKEY_ENCODING, InstructionField::OSKEY_EXTRA_BITS, InstructionField::OSKEY_POSITION, ImmediateControlField::OSKEY_TEMPLATE_NAME, ImmediateControlField::OSNAME_TEMPLATE_MAP, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToFileFormat().

Here is the call graph for this function:

◆ longImmTagToOM()

ObjectState * BEMSerializer::longImmTagToOM ( const ObjectState immTag)
staticprivate

Converts the given ObjectState tree that represents a long-immediate-tag element of BEM file to ObjectState tree that can be loaded by ImmediateControlField.

Parameters
fileTagAn ObjectState tree that represents a long-immediate-tag element.
Returns
The newly created ObjectState tree.

Definition at line 995 of file BEMSerializer.cc.

995  {
996  ObjectState* immControlField =
998  ObjectState* pos = immTag->childByName(LIMM_TAG_POSITION);
999  immControlField->setAttribute(
1001  ObjectState* extraBits = immTag->childByName(LIMM_TAG_EXTRA_BITS);
1002  immControlField->setAttribute(
1004 
1005  // add template mappings
1006  for (int i = 0; i < immTag->childCount(); i++) {
1007  ObjectState* child = immTag->child(i);
1008  if (child->name() == LIMM_TAG_MAP) {
1009  ObjectState* mapping = new ObjectState(
1011  immControlField->addChild(mapping);
1012  mapping->setAttribute(
1015  mapping->setAttribute(
1017  }
1018  }
1019 
1020  return immControlField;
1021 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), LIMM_TAG_EXTRA_BITS, LIMM_TAG_MAP, LIMM_TAG_MAP_NAME, LIMM_TAG_POSITION, ObjectState::name(), ImmediateControlField::OSKEY_ENCODING, InstructionField::OSKEY_EXTRA_BITS, InstructionField::OSKEY_POSITION, ImmediateControlField::OSKEY_TEMPLATE_NAME, ImmediateControlField::OSNAME_IMM_CONTROL_FIELD, ImmediateControlField::OSNAME_TEMPLATE_MAP, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToOMFormat().

Here is the call graph for this function:

◆ moveSlotToFile()

ObjectState * BEMSerializer::moveSlotToFile ( const ObjectState slotState)
staticprivate

Converts the given ObjectState tree that represents a move slot in object model format to BEM file format.

Parameters
slotStateThe ObjectState tree.
Returns
The newly created ObjectState tree.

Definition at line 562 of file BEMSerializer.cc.

562  {
563 
564  ObjectState* slot = new ObjectState(SLOT);
565  slot->setAttribute(
567 
568  ObjectState* position = new ObjectState(SLOT_POSITION);
569  slot->addChild(position);
570  position->setValue(slotState->stringAttribute(MoveSlot::OSKEY_POSITION));
571  ObjectState* extraBits = new ObjectState(SLOT_EXTRA_BITS);
572  slot->addChild(extraBits);
573  extraBits->setValue(
575 
576  // add guard field
577  if (slotState->hasChild(GuardField::OSNAME_GUARD_FIELD)) {
578  ObjectState* guardField = slotState->childByName(
580  slot->addChild(guardFieldToFile(guardField));
581  }
582 
583  // add source field
584  if (slotState->hasChild(SourceField::OSNAME_SOURCE_FIELD)) {
585  ObjectState* sourceField = slotState->childByName(
587  slot->addChild(sourceFieldToFile(sourceField));
588  }
589 
590  // add destination field
592  ObjectState* destinationField = slotState->childByName(
594  slot->addChild(destinationFieldToFile(destinationField));
595  }
596  return slot;
597 }

References ObjectState::addChild(), ObjectState::childByName(), destinationFieldToFile(), guardFieldToFile(), ObjectState::hasChild(), MoveSlot::OSKEY_BUS_NAME, InstructionField::OSKEY_EXTRA_BITS, InstructionField::OSKEY_POSITION, DestinationField::OSNAME_DESTINATION_FIELD, GuardField::OSNAME_GUARD_FIELD, SourceField::OSNAME_SOURCE_FIELD, ObjectState::setAttribute(), ObjectState::setValue(), SLOT, SLOT_EXTRA_BITS, SLOT_NAME, SLOT_POSITION, sourceFieldToFile(), and ObjectState::stringAttribute().

Referenced by convertToFileFormat().

Here is the call graph for this function:

◆ moveSlotToOM()

ObjectState * BEMSerializer::moveSlotToOM ( const ObjectState fileSlot)
staticprivate

Converts the given ObjectState tree that represents a slot element of BEM file to ObjectState tree that can be loaded by MoveSlot.

Parameters
fileSlotThe ObjectState tree that represents a slot element.
Returns
The newly created ObjectState tree.

Definition at line 1032 of file BEMSerializer.cc.

1032  {
1033 
1035  string busName = fileSlot->stringAttribute(SLOT_NAME);
1036  moveSlot->setAttribute(MoveSlot::OSKEY_BUS_NAME, busName);
1037 
1038  ObjectState* pos = fileSlot->childByName(SLOT_POSITION);
1040 
1041  ObjectState* extraBits = fileSlot->childByName(SLOT_EXTRA_BITS);
1042  moveSlot->setAttribute(
1043  MoveSlot::OSKEY_EXTRA_BITS, extraBits->stringValue());
1044 
1045  // add guard field
1046  if (fileSlot->hasChild(SLOT_GUARD)) {
1047  ObjectState* guard = fileSlot->childByName(SLOT_GUARD);
1048  moveSlot->addChild(guardFieldToOM(guard));
1049  }
1050 
1051  // add source field
1052  if (fileSlot->hasChild(SLOT_SOURCE)) {
1053  ObjectState* source = fileSlot->childByName(SLOT_SOURCE);
1054  moveSlot->addChild(sourceFieldToOM(source));
1055  }
1056 
1057  // add destination field
1058  if (fileSlot->hasChild(SLOT_DESTINATION)) {
1059  ObjectState* destination = fileSlot->childByName(SLOT_DESTINATION);
1060  moveSlot->addChild(destinationFieldToOM(destination));
1061  }
1062 
1063  return moveSlot;
1064 }

References ObjectState::addChild(), ObjectState::childByName(), destinationFieldToOM(), guardFieldToOM(), ObjectState::hasChild(), MoveSlot::OSKEY_BUS_NAME, InstructionField::OSKEY_EXTRA_BITS, InstructionField::OSKEY_POSITION, MoveSlot::OSNAME_MOVE_SLOT, ObjectState::setAttribute(), SLOT_DESTINATION, SLOT_EXTRA_BITS, SLOT_GUARD, SLOT_NAME, SLOT_POSITION, SLOT_SOURCE, sourceFieldToOM(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToOMFormat().

Here is the call graph for this function:

◆ readBinaryEncoding()

BinaryEncoding * BEMSerializer::readBinaryEncoding ( )

Reads the BEM file and creates a BinaryEncoding instance from it.

Returns
The newly created BinaryEncoding instance.

Definition at line 258 of file BEMSerializer.cc.

258  {
259  ObjectState* omState = readState();
260  BinaryEncoding* bem = new BinaryEncoding(omState);
261  delete omState;
262  return bem;
263 }

References readState().

Referenced by loadBEM(), ProGe::ProGeUI::loadBinaryEncoding(), ProGe::ProGeUI::loadProcessorConfiguration(), main(), and GenerateProcessorDialog::onBrowseBEMLoad().

Here is the call graph for this function:

◆ readRegisterFilePortCode()

void BEMSerializer::readRegisterFilePortCode ( const ObjectState filePortCode,
ObjectState omPortCode 
)
staticprivate

Reads rf-port-code or iu-port-code element from an ObjectState tree that represents BEM file and adds the data to the given ObjectState instance to make it loadable by RFPortCode or IUPortCode.

Parameters
filePortCodeObjectState tree representing rf-port-code or iu-port-code element of BEM file.
omPortCodeThe ObjectState instance to which the data is added.

Definition at line 1377 of file BEMSerializer.cc.

1379  {
1380 
1381  string unit;
1382  if (filePortCode->name() == RF_PORT_CODE) {
1383  unit = filePortCode->stringAttribute(RF_PORT_CODE_RF);
1384  } else if (filePortCode->name() == IU_PORT_CODE) {
1385  unit = filePortCode->stringAttribute(IU_PORT_CODE_IU);
1386  } else {
1387  assert(false);
1388  }
1389 
1390  omPortCode->setAttribute(PortCode::OSKEY_UNIT_NAME, unit);
1391  omPortCode->setAttribute(
1393  filePortCode->stringAttribute(RF_PORT_CODE_INDEX_WIDTH));
1394 
1395  if (filePortCode->hasChild(RF_PORT_CODE_ENCODING)) {
1396  ObjectState* encoding = filePortCode->childByName(
1398  omPortCode->setAttribute(
1399  PortCode::OSKEY_ENCODING, encoding->stringValue());
1400  ObjectState* extraBits = filePortCode->childByName(
1402  omPortCode->setAttribute(
1403  PortCode::OSKEY_EXTRA_BITS, extraBits->stringValue());
1404  }
1405 
1406 }

References assert, ObjectState::childByName(), ObjectState::hasChild(), IU_PORT_CODE, IU_PORT_CODE_IU, ObjectState::name(), PortCode::OSKEY_ENCODING, PortCode::OSKEY_EXTRA_BITS, PortCode::OSKEY_INDEX_WIDTH, PortCode::OSKEY_UNIT_NAME, RF_PORT_CODE, RF_PORT_CODE_ENCODING, RF_PORT_CODE_EXTRA_BITS, RF_PORT_CODE_INDEX_WIDTH, RF_PORT_CODE_RF, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by socketCodeTableToOM().

Here is the call graph for this function:

◆ readState()

ObjectState * BEMSerializer::readState ( )
virtual

Reads the BEM file and returns an ObjectState tree that can be loaded by BinaryEncoding.

Returns
An ObjectState tree that can be loaded by BinaryEncoding.
Exceptions
SerializerExceptionIf an error occurs while reading the BEM file.

Reimplemented from XMLSerializer.

Definition at line 186 of file BEMSerializer.cc.

186  {
187  ObjectState* fileState = XMLSerializer::readState();
188 
189  double version = fileState->doubleAttribute(BEM_VERSION_STR);
190  if (fileState->hasAttribute(REQUIRED_VERSION)) {
191  double requiredVersion = fileState->doubleAttribute(REQUIRED_VERSION);
192  if (requiredVersion > 1.5) {
195  "Cannot parse the file. "
196  "The file requests parser version of " +
197  fileState->stringAttribute(REQUIRED_VERSION) +
198  ". "
199  "The version of the parser is 1.5.");
200  }
201  }
202  if (version < 1.2) {
203  convertZeroEncExtraBits(fileState);
204  }
205  ObjectState* omState = convertToOMFormat(fileState);
206  delete fileState;
207  return omState;
208 }

References BEM_VERSION_STR, convertToOMFormat(), convertZeroEncExtraBits(), ObjectState::doubleAttribute(), ObjectState::hasAttribute(), XMLSerializer::readState(), REQUIRED_VERSION, ObjectState::stringAttribute(), and THROW_EXCEPTION.

Referenced by readBinaryEncoding().

Here is the call graph for this function:

◆ slotFieldToFile()

ObjectState * BEMSerializer::slotFieldToFile ( const ObjectState sFieldState)
staticprivate

Converts the given ObjectState tree that represents either source or destination in BEM object model to BEM file format.

Parameters
sFieldStateThe ObjectState tree.
Returns
The newly created ObjectState tree.

Definition at line 798 of file BEMSerializer.cc.

798  {
799 
800  ObjectState* srcOrDst = new ObjectState(SLOT_SOURCE);
801  ObjectState* position = new ObjectState(SRC_DST_POSITION);
802  srcOrDst->addChild(position);
803  position->setValue(
805  ObjectState* extraBits = new ObjectState(SRC_DST_EXTRA_BITS);
806  srcOrDst->addChild(extraBits);
807  extraBits->setValue(
809  ObjectState* encodingPos = new ObjectState(SRC_DST_ID_POS);
810  srcOrDst->addChild(encodingPos);
813  encodingPos->setValue(ID_POS_LEFT);
814  } else {
815  encodingPos->setValue(ID_POS_RIGHT);
816  }
817 
818  // add socket elements
819  for (int i = 0; i < sFieldState->childCount(); i++) {
820  ObjectState* child = sFieldState->child(i);
822  ObjectState* socket = new ObjectState(SOCKET);
823  srcOrDst->addChild(socket);
824  socket->setAttribute(
825  SOCKET_NAME,
827  ObjectState* map = new ObjectState(SOCKET_MAP);
828  socket->addChild(map);
829  map->setAttribute(
833  map->setAttribute(
836  }
837  map->setValue(
839  }
840  }
841 
842  // add move no-operation element
843  if (sFieldState->hasChild(NOPEncoding::OSNAME_NOP_ENCODING)) {
844  ObjectState* nopEncoding = sFieldState->childByName(
846  ObjectState* noOperation = new ObjectState(SRC_DST_NO_OPERATION);
847  srcOrDst->addChild(noOperation);
849  noOperation->addChild(map);
850  map->setAttribute(
853  map->setValue(
855  }
856 
857  return srcOrDst;
858 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasAttribute(), ObjectState::hasChild(), ID_POS_LEFT, ID_POS_RIGHT, ObjectState::intAttribute(), BinaryEncoding::LEFT, ObjectState::name(), SlotField::OSKEY_COMPONENT_ID_POSITION, Encoding::OSKEY_ENCODING, Encoding::OSKEY_EXTRA_BITS, InstructionField::OSKEY_EXTRA_BITS, InstructionField::OSKEY_POSITION, SocketEncoding::OSKEY_SC_TABLE, SocketEncoding::OSKEY_SOCKET_NAME, NOPEncoding::OSNAME_NOP_ENCODING, SocketEncoding::OSNAME_SOCKET_ENCODING, ObjectState::setAttribute(), ObjectState::setValue(), SLOT_SOURCE, SOCKET, SOCKET_MAP, SOCKET_MAP_CODES, SOCKET_MAP_EXTRA_BITS, SOCKET_NAME, SRC_DST_EXTRA_BITS, SRC_DST_ID_POS, SRC_DST_NO_OPERATION, SRC_DST_NO_OPERATION_MAP, SRC_DST_NO_OPERATION_MAP_EXTRA_BITS, SRC_DST_POSITION, and ObjectState::stringAttribute().

Referenced by destinationFieldToFile(), and sourceFieldToFile().

Here is the call graph for this function:

◆ slotFieldToOM()

ObjectState * BEMSerializer::slotFieldToOM ( const ObjectState fileSlot)
staticprivate

Converts the given ObjectState tree that represents either source or destination element of BEM file to an ObjectState tree that can be loaded by SlotField.

Parameters
fileSlotAn ObjectState tree representing source or destination field.
Returns
The newly created ObjectState tree.

Definition at line 1239 of file BEMSerializer.cc.

1239  {
1240 
1242  ObjectState* pos = fileSlot->childByName(SRC_DST_POSITION);
1243  slotField->setAttribute(
1245  ObjectState* extraBits = fileSlot->childByName(SRC_DST_EXTRA_BITS);
1246  slotField->setAttribute(
1248  if (fileSlot->childByName(SRC_DST_ID_POS)->stringValue() ==
1249  ID_POS_RIGHT) {
1250  slotField->setAttribute(
1252  } else {
1253  assert(
1254  fileSlot->childByName(SRC_DST_ID_POS)->stringValue() ==
1255  ID_POS_LEFT);
1256  slotField->setAttribute(
1258  }
1259 
1260  // read socket elements
1261  for (int i = 0; i < fileSlot->childCount(); i++) {
1262  ObjectState* child = fileSlot->child(i);
1263  if (child->name() == SOCKET) {
1264  ObjectState* socketEncoding = new ObjectState(
1266  slotField->addChild(socketEncoding);
1267  socketEncoding->setAttribute(
1269  child->stringAttribute(SOCKET_NAME));
1270  ObjectState* map = child->childByName(SOCKET_MAP);
1271  socketEncoding->setAttribute(
1273  socketEncoding->setAttribute(
1276  if (map->hasAttribute(SOCKET_MAP_CODES)) {
1277  socketEncoding->setAttribute(
1280  }
1281  }
1282  }
1283 
1284  // read NOP encoding
1285  if (fileSlot->hasChild(SRC_DST_NO_OPERATION)) {
1286  ObjectState* nopEncoding = new ObjectState(
1288  slotField->addChild(nopEncoding);
1289  ObjectState* map = fileSlot->childByName(SRC_DST_NO_OPERATION)->
1290  child(0);
1291  nopEncoding->setAttribute(
1293  nopEncoding->setAttribute(
1296  }
1297 
1298  return slotField;
1299 }

References ObjectState::addChild(), assert, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasAttribute(), ObjectState::hasChild(), ID_POS_LEFT, ID_POS_RIGHT, BinaryEncoding::LEFT, ObjectState::name(), SlotField::OSKEY_COMPONENT_ID_POSITION, Encoding::OSKEY_ENCODING, Encoding::OSKEY_EXTRA_BITS, InstructionField::OSKEY_EXTRA_BITS, InstructionField::OSKEY_POSITION, SocketEncoding::OSKEY_SC_TABLE, SocketEncoding::OSKEY_SOCKET_NAME, NOPEncoding::OSNAME_NOP_ENCODING, SlotField::OSNAME_SLOT_FIELD, SocketEncoding::OSNAME_SOCKET_ENCODING, BinaryEncoding::RIGHT, ObjectState::setAttribute(), SOCKET, SOCKET_MAP, SOCKET_MAP_CODES, SOCKET_MAP_EXTRA_BITS, SOCKET_NAME, SRC_DST_EXTRA_BITS, SRC_DST_ID_POS, SRC_DST_NO_OPERATION, SRC_DST_NO_OPERATION_MAP_EXTRA_BITS, SRC_DST_POSITION, ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by destinationFieldToOM(), and sourceFieldToOM().

Here is the call graph for this function:

◆ socketCodeTableToFile()

ObjectState * BEMSerializer::socketCodeTableToFile ( const ObjectState omTable)
staticprivate

Converts the given ObjectState tree that represents a socket code table in the object model format to BEM file format.

Returns
The newly created ObjectState tree.

Definition at line 404 of file BEMSerializer.cc.

404  {
405 
406  ObjectState* scTable = new ObjectState(SOCKET_CODE_TABLE);
407  scTable->setAttribute(
408  SC_TABLE_NAME, omTable->stringAttribute(
410 
411  // create extra-bits element
412  ObjectState* extraBits = new ObjectState(SC_TABLE_EXTRA_BITS);
413  scTable->addChild(extraBits);
414  extraBits->setValue(
416 
417  // create fu-port-code elements
418  for (int i = 0; i < omTable->childCount(); i++) {
419  ObjectState* portCode = omTable->child(i);
420  if (portCode->name() == FUPortCode::OSNAME_FU_PORT_CODE) {
421  ObjectState* fuPortCode = new ObjectState(FU_PORT_CODE);
422  scTable->addChild(fuPortCode);
423  fuPortCode->setAttribute(
426  fuPortCode->setAttribute(
430  fuPortCode->setAttribute(
432  portCode->stringAttribute(
434  }
436  fuPortCode->addChild(encoding);
437  encoding->setValue(
440  fuPortCode->addChild(extraBits);
441  extraBits->setValue(
443  }
444  }
445 
446  // create rf-port-code elements
447  for (int i = 0; i < omTable->childCount(); i++) {
448  ObjectState* portCode = omTable->child(i);
449  if (portCode->name() == RFPortCode::OSNAME_RF_PORT_CODE) {
450  ObjectState* rfPortCode = new ObjectState(RF_PORT_CODE);
451  scTable->addChild(rfPortCode);
452  rfPortCode->setAttribute(
455  rfPortCode->setAttribute(
458 
460  rfPortCode->setAttribute(
463 
464  if (portCode->hasAttribute(RFPortCode::OSKEY_ENCODING)) {
465  ObjectState* encoding = new ObjectState(
467  rfPortCode->addChild(encoding);
468  encoding->setValue(
470  ObjectState* extraBits = new ObjectState(
472  rfPortCode->addChild(extraBits);
473  extraBits->setValue(
475  }
476  }
477  }
478 
479  // create iu-port-code elements
480  for (int i = 0; i < omTable->childCount(); i++) {
481  ObjectState* portCode = omTable->child(i);
482  if (portCode->name() == IUPortCode::OSNAME_IU_PORT_CODE) {
483  ObjectState* iuPortCode = new ObjectState(IU_PORT_CODE);
484  scTable->addChild(iuPortCode);
485  iuPortCode->setAttribute(
488  iuPortCode->setAttribute(
491 
493  iuPortCode->setAttribute(
496 
497  if (portCode->hasAttribute(IUPortCode::OSKEY_ENCODING)) {
498  ObjectState* encoding = new ObjectState(
500  iuPortCode->addChild(encoding);
501  encoding->setValue(
503  ObjectState* extraBits = new ObjectState(
505  iuPortCode->addChild(extraBits);
506  extraBits->setValue(
508  }
509  }
510  }
511 
512  return scTable;
513 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childCount(), FU_PORT_CODE, FU_PORT_CODE_ENCODING, FU_PORT_CODE_EXTRA_BITS, FU_PORT_CODE_FU, FU_PORT_CODE_OPERATION, FU_PORT_CODE_PORT, ObjectState::hasAttribute(), ObjectState::intAttribute(), IU_PORT_CODE, IU_PORT_CODE_IU, ObjectState::name(), PortCode::OSKEY_ENCODING, PortCode::OSKEY_EXTRA_BITS, SocketCodeTable::OSKEY_EXTRA_BITS, PortCode::OSKEY_INDEX_WIDTH, PortCode::OSKEY_MAX_INDEX, SocketCodeTable::OSKEY_NAME, FUPortCode::OSKEY_OPERATION_NAME, FUPortCode::OSKEY_PORT_NAME, PortCode::OSKEY_UNIT_NAME, FUPortCode::OSNAME_FU_PORT_CODE, IUPortCode::OSNAME_IU_PORT_CODE, RFPortCode::OSNAME_RF_PORT_CODE, RF_PORT_CODE, RF_PORT_CODE_ENCODING, RF_PORT_CODE_EXTRA_BITS, RF_PORT_CODE_INDEX_WIDTH, RF_PORT_CODE_MAX_INDEX, RF_PORT_CODE_RF, SC_TABLE_EXTRA_BITS, SC_TABLE_NAME, ObjectState::setAttribute(), ObjectState::setValue(), SOCKET_CODE_TABLE, and ObjectState::stringAttribute().

Referenced by convertToFileFormat().

Here is the call graph for this function:

◆ socketCodeTableToOM()

ObjectState * BEMSerializer::socketCodeTableToOM ( const ObjectState scTable)
staticprivate

Converts the given ObjectState tree that represents a socket code table in BEM file to an ObjectState tree that can be loaded by SocketCodeTable.

Parameters
scTableThe ObjectState tree.
Returns
The newly created ObjectState tree that can be loaded by SocketCodeTable.

Definition at line 934 of file BEMSerializer.cc.

934  {
935 
936  ObjectState* omTable = new ObjectState(
938  string name = scTable->stringAttribute(SC_TABLE_NAME);
940  int extraBits = scTable->childByName(SC_TABLE_EXTRA_BITS)->intValue();
941  omTable->setAttribute(
943 
944  // add port codes
945  for (int i = 0; i < scTable->childCount(); i++) {
946  ObjectState* child = scTable->child(i);
947  if (child->name() == FU_PORT_CODE) {
948  ObjectState* fuPortCode = new ObjectState(
950  omTable->addChild(fuPortCode);
951  string portName = child->stringAttribute(FU_PORT_CODE_PORT);
952  string fuName = child->stringAttribute(FU_PORT_CODE_FU);
953  fuPortCode->setAttribute(FUPortCode::OSKEY_UNIT_NAME, fuName);
954  fuPortCode->setAttribute(FUPortCode::OSKEY_PORT_NAME, portName);
955  if (child->hasAttribute(FU_PORT_CODE_OPERATION)) {
956  string opName = child->stringAttribute(
958  fuPortCode->setAttribute(
960  }
961 
962  fuPortCode->setAttribute(
965  fuPortCode->setAttribute(
968  } else if (child->name() == RF_PORT_CODE) {
969  ObjectState* rfPortCode = new ObjectState(
971  omTable->addChild(rfPortCode);
972  readRegisterFilePortCode(child, rfPortCode);
973  } else if (child->name() == IU_PORT_CODE) {
974  ObjectState* iuPortCode = new ObjectState(
976  omTable->addChild(iuPortCode);
977  readRegisterFilePortCode(child, iuPortCode);
978  }
979  }
980 
981  return omTable;
982 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FU_PORT_CODE, FU_PORT_CODE_ENCODING, FU_PORT_CODE_EXTRA_BITS, FU_PORT_CODE_FU, FU_PORT_CODE_OPERATION, FU_PORT_CODE_PORT, ObjectState::hasAttribute(), ObjectState::intValue(), IU_PORT_CODE, ObjectState::name(), PortCode::OSKEY_ENCODING, PortCode::OSKEY_EXTRA_BITS, SocketCodeTable::OSKEY_EXTRA_BITS, SocketCodeTable::OSKEY_NAME, FUPortCode::OSKEY_OPERATION_NAME, FUPortCode::OSKEY_PORT_NAME, PortCode::OSKEY_UNIT_NAME, FUPortCode::OSNAME_FU_PORT_CODE, IUPortCode::OSNAME_IU_PORT_CODE, RFPortCode::OSNAME_RF_PORT_CODE, SocketCodeTable::OSNAME_SOCKET_CODE_TABLE, readRegisterFilePortCode(), RF_PORT_CODE, SC_TABLE_EXTRA_BITS, SC_TABLE_NAME, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToOMFormat().

Here is the call graph for this function:

◆ sourceFieldToFile()

ObjectState * BEMSerializer::sourceFieldToFile ( const ObjectState sFieldState)
staticprivate

Converts the given ObjectState tree that represents a source field in object model to BEM file format.

Parameters
sFieldStateThe ObjectState tree.
Returns
The newly created ObjectState tree.

Definition at line 704 of file BEMSerializer.cc.

704  {
705 
706  ObjectState* source = slotFieldToFile(sFieldState);
707  source->setName(SLOT_SOURCE);
708 
709  // add immediate element in front of socket elements, it has to be done
710  // by removing the socket elements
712  std::vector<ObjectState*> socketElems;
713  for (int i = 0; i < source->childCount();) {
714  ObjectState* child = source->child(i);
715  if (child->name() == SOCKET) {
716  socketElems.push_back(child);
717  source->removeChild(child);
718  } else {
719  i++;
720  }
721  }
722  ObjectState* immediate = new ObjectState(SOURCE_IMMEDIATE);
723  source->addChild(immediate);
724  ObjectState* encodingState = sFieldState->childByName(
726  immediate->setAttribute(
728  encodingState->stringAttribute(
731  immediate->addChild(map);
733  encodingState->stringAttribute(
735  map->setValue(
736  encodingState->stringAttribute(
738 
739  // add the socket elements
740  for (vector<ObjectState*>::const_iterator iter = socketElems.begin();
741  iter != socketElems.end(); iter++) {
742  source->addChild(*iter);
743  }
744  }
745 
746  // add bridge elements
747  for (int i = 0; i < sFieldState->childCount(); i++) {
748  ObjectState* child = sFieldState->child(i);
750  ObjectState* bridge = new ObjectState(SOURCE_BRIDGE);
751  source->addChild(bridge);
752  bridge->setAttribute(
756  bridge->addChild(map);
757  map->setAttribute(
760  map->setValue(
762  }
763  }
764 
765  // move the no-operation element to the end
766  if (source->hasChild(SRC_DST_NO_OPERATION)) {
768  source->removeChild(nop);
769  source->addChild(nop);
770  }
771 
772  return source;
773 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), ObjectState::name(), BridgeEncoding::OSKEY_BRIDGE_NAME, Encoding::OSKEY_ENCODING, Encoding::OSKEY_EXTRA_BITS, ImmediateEncoding::OSKEY_IMM_WIDTH, BridgeEncoding::OSNAME_BRIDGE_ENCODING, ImmediateEncoding::OSNAME_IMM_ENCODING, ObjectState::removeChild(), ObjectState::setAttribute(), ObjectState::setName(), ObjectState::setValue(), SLOT_SOURCE, slotFieldToFile(), SOCKET, SOURCE_BRIDGE, SOURCE_BRIDGE_MAP, SOURCE_BRIDGE_MAP_EXTRA_BITS, SOURCE_BRIDGE_NAME, SOURCE_IMMEDIATE, SOURCE_IMMEDIATE_MAP, SOURCE_IMMEDIATE_MAP_EXTRA_BITS, SOURCE_IMMEDIATE_WIDTH, SRC_DST_NO_OPERATION, and ObjectState::stringAttribute().

Referenced by moveSlotToFile().

Here is the call graph for this function:

◆ sourceFieldToOM()

ObjectState * BEMSerializer::sourceFieldToOM ( const ObjectState fileSource)
staticprivate

Converts the given ObjectState tree that represents a source element in BEM file to an ObjectState tree that can be loaded by SourceField.

Parameters
fileSourceAn ObjectState tree that represents a source element in a BEM file.
Returns
The newly created ObjectState tree.

Definition at line 1167 of file BEMSerializer.cc.

1167  {
1168 
1169  ObjectState* sourceField = slotFieldToOM(fileSource);
1171 
1172  // add immediate encoding
1173  if (fileSource->hasChild(SOURCE_IMMEDIATE)) {
1174  ObjectState* immEncoding = new ObjectState(
1176  sourceField->addChild(immEncoding);
1177  immEncoding->setAttribute(
1181  ObjectState* map = fileSource->childByName(SOURCE_IMMEDIATE)->
1182  child(0);
1183  immEncoding->setAttribute(
1185  immEncoding->setAttribute(
1188  }
1189 
1190  // add bridge encodings
1191  for (int i = 0; i < fileSource->childCount(); i++) {
1192  ObjectState* child = fileSource->child(i);
1193  if (child->name() == SOURCE_BRIDGE) {
1194  ObjectState* bridgeEncoding = new ObjectState(
1196  sourceField->addChild(bridgeEncoding);
1197  bridgeEncoding->setAttribute(
1200  ObjectState* map = child->childByName(SOURCE_BRIDGE_MAP);
1201  bridgeEncoding->setAttribute(
1204  bridgeEncoding->setAttribute(
1206  }
1207  }
1208 
1209  return sourceField;
1210 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), ObjectState::name(), BridgeEncoding::OSKEY_BRIDGE_NAME, Encoding::OSKEY_ENCODING, Encoding::OSKEY_EXTRA_BITS, ImmediateEncoding::OSKEY_IMM_WIDTH, BridgeEncoding::OSNAME_BRIDGE_ENCODING, ImmediateEncoding::OSNAME_IMM_ENCODING, SourceField::OSNAME_SOURCE_FIELD, ObjectState::setAttribute(), ObjectState::setName(), slotFieldToOM(), SOURCE_BRIDGE, SOURCE_BRIDGE_MAP, SOURCE_BRIDGE_MAP_EXTRA_BITS, SOURCE_BRIDGE_NAME, SOURCE_IMMEDIATE, SOURCE_IMMEDIATE_MAP_EXTRA_BITS, SOURCE_IMMEDIATE_WIDTH, ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by moveSlotToOM().

Here is the call graph for this function:

◆ writeBinaryEncoding()

void BEMSerializer::writeBinaryEncoding ( const BinaryEncoding bem)

Writes the given binary encoding to a BEM file.

Parameters
bemThe binary encoding.
Exceptions
SerializerExceptionIf the destination file cannot be written.

Definition at line 272 of file BEMSerializer.cc.

272  {
273  ObjectState* omState = bem.saveState();
274  writeState(omState);
275  delete omState;
276 }

References BinaryEncoding::saveState(), and writeState().

Referenced by main(), and GenerateProcessorDialog::onOK().

Here is the call graph for this function:

◆ writeState()

void BEMSerializer::writeState ( const ObjectState state)
virtual

Writes the given ObjectState tree that represents a BEM object model to a BEM file.

Parameters
stateObjectState tree obtained by calling BinaryEncoding::saveState().
Exceptions
SerializerExceptionIf the destination file cannot be written.

Reimplemented from XMLSerializer.

Definition at line 246 of file BEMSerializer.cc.

246  {
247  ObjectState* fileState = convertToFileFormat(state);
248  XMLSerializer::writeState(fileState);
249  delete fileState;
250 }

References convertToFileFormat(), and XMLSerializer::writeState().

Referenced by writeBinaryEncoding().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
IMMEDIATE_SLOT_NAME
const string IMMEDIATE_SLOT_NAME
Definition: BEMSerializer.cc:152
SOCKET_NAME
const string SOCKET_NAME
Definition: BEMSerializer.cc:130
MAP
const string MAP
Definition: BEMSerializer.cc:157
FU_PORT_CODE_OPERATION
const string FU_PORT_CODE_OPERATION
Definition: BEMSerializer.cc:77
RF_PORT_CODE_EXTRA_BITS
const string RF_PORT_CODE_EXTRA_BITS
Definition: BEMSerializer.cc:85
ImmediateControlField::OSKEY_TEMPLATE_NAME
static const std::string OSKEY_TEMPLATE_NAME
ObjectState attribute key for the name of the instruction template.
Definition: ImmediateControlField.hh:88
FUGuardEncoding::OSKEY_PORT_NAME
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
Definition: FUGuardEncoding.hh:65
MoveSlot::OSNAME_MOVE_SLOT
static const std::string OSNAME_MOVE_SLOT
ObjectState name for move slot.
Definition: MoveSlot.hh:96
SLOT_GUARD_EXTRA_BITS
const string SLOT_GUARD_EXTRA_BITS
Definition: BEMSerializer.cc:108
XMLSerializer::XMLSerializer
XMLSerializer()
Definition: XMLSerializer.cc:78
ObjectState::hasAttribute
bool hasAttribute(const std::string &name) const
Definition: ObjectState.cc:205
ADF_ENCODING
const string ADF_ENCODING
Definition: BEMSerializer.cc:67
SLOT_NAME
const string SLOT_NAME
Definition: BEMSerializer.cc:103
SRC_DST_ID_POS
const string SRC_DST_ID_POS
Definition: BEMSerializer.cc:125
BinaryEncoding
Definition: BinaryEncoding.hh:61
IMM_REG_FIELD_ITEMP_REG_INDEX
const string IMM_REG_FIELD_ITEMP_REG_INDEX
Definition: BEMSerializer.cc:100
BEMSerializer::immediateSlotToFile
static ObjectState * immediateSlotToFile(const ObjectState *slotState)
Definition: BEMSerializer.cc:870
InstructionField::OSKEY_POSITION
static const std::string OSKEY_POSITION
ObjectState attribute key for the relative position of the field.
Definition: InstructionField.hh:77
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
SLOT_GUARD
const string SLOT_GUARD
Definition: BEMSerializer.cc:106
BEMSerializer::longImmDstRegisterFieldToFile
static ObjectState * longImmDstRegisterFieldToFile(const ObjectState *omState)
Definition: BEMSerializer.cc:895
FU_PORT_CODE_FU
const string FU_PORT_CODE_FU
Definition: BEMSerializer.cc:76
SC_TABLE_EXTRA_BITS
const string SC_TABLE_EXTRA_BITS
Definition: BEMSerializer.cc:73
ImmediateEncoding::OSNAME_IMM_ENCODING
static const std::string OSNAME_IMM_ENCODING
ObjectState name for immediate encoding.
Definition: ImmediateEncoding.hh:63
SRC_DST_NO_OPERATION_MAP
const string SRC_DST_NO_OPERATION_MAP
Definition: BEMSerializer.cc:145
RF_PORT_CODE_RF
const string RF_PORT_CODE_RF
Definition: BEMSerializer.cc:81
SOURCE_BRIDGE_NAME
const string SOURCE_BRIDGE_NAME
Definition: BEMSerializer.cc:140
ObjectState::intValue
int intValue() const
PortCode::OSKEY_EXTRA_BITS
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
Definition: PortCode.hh:73
BEMSerializer::slotFieldToOM
static ObjectState * slotFieldToOM(const ObjectState *fileSlot)
Definition: BEMSerializer.cc:1239
GPRGuardEncoding::OSKEY_REGISTER_INDEX
static const std::string OSKEY_REGISTER_INDEX
ObjectState attribute key for register index.
Definition: GPRGuardEncoding.hh:65
ImmediateControlField::OSNAME_IMM_CONTROL_FIELD
static const std::string OSNAME_IMM_CONTROL_FIELD
ObjectState name for immediate control field.
Definition: ImmediateControlField.hh:84
ImmediateSlotField::OSNAME_IMMEDIATE_SLOT_FIELD
static const std::string OSNAME_IMMEDIATE_SLOT_FIELD
ObjectState name for immediate slot field.
Definition: ImmediateSlotField.hh:63
BinaryEncoding::OSNAME_TEMPLATE_EXTRA_BITS
static const std::string OSNAME_TEMPLATE_EXTRA_BITS
Definition: BinaryEncoding.hh:128
SOURCE_BRIDGE_MAP
const string SOURCE_BRIDGE_MAP
Definition: BEMSerializer.cc:141
IMMEDIATE_SLOT_POS
const string IMMEDIATE_SLOT_POS
Definition: BEMSerializer.cc:154
FU_PORT_CODE
const string FU_PORT_CODE
Definition: BEMSerializer.cc:74
ObjectState
Definition: ObjectState.hh:59
PortCode::OSKEY_UNIT_NAME
static const std::string OSKEY_UNIT_NAME
ObjectState attribute key for the name of the unit.
Definition: PortCode.hh:69
SOURCE_IMMEDIATE_MAP_EXTRA_BITS
const string SOURCE_IMMEDIATE_MAP_EXTRA_BITS
Definition: BEMSerializer.cc:138
PORT_GUARD_CODE_PORT
const string PORT_GUARD_CODE_PORT
Definition: BEMSerializer.cc:115
INSTRUCTION_FORMAT
const string INSTRUCTION_FORMAT
Definition: BEMSerializer.cc:148
LONG_IMMEDIATE_TAG
const string LONG_IMMEDIATE_TAG
Definition: BEMSerializer.cc:89
GuardEncoding::OSKEY_INVERTED
static const std::string OSKEY_INVERTED
ObjectState attribute key for invert flag.
Definition: GuardEncoding.hh:58
RF_PORT_CODE_INDEX_WIDTH
const string RF_PORT_CODE_INDEX_WIDTH
Definition: BEMSerializer.cc:82
RFPortCode::OSNAME_RF_PORT_CODE
static const std::string OSNAME_RF_PORT_CODE
ObjectState name for RF port code.
Definition: RFPortCode.hh:57
SRC_DST_POSITION
const string SRC_DST_POSITION
Definition: BEMSerializer.cc:123
PortCode::OSKEY_ENCODING
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding.
Definition: PortCode.hh:71
FUPortCode::OSNAME_FU_PORT_CODE
static const std::string OSNAME_FU_PORT_CODE
ObjectState name for FU port code.
Definition: FUPortCode.hh:66
ObjectState::setName
void setName(const std::string &name)
SLOT_SOURCE
const string SLOT_SOURCE
Definition: BEMSerializer.cc:120
BEMSerializer::destinationFieldToFile
static ObjectState * destinationFieldToFile(const ObjectState *dFieldState)
Definition: BEMSerializer.cc:784
BEM_SCHEMA_FILE
const string BEM_SCHEMA_FILE
Definition: BEMSerializer.cc:159
BridgeEncoding::OSNAME_BRIDGE_ENCODING
static const std::string OSNAME_BRIDGE_ENCODING
ObjectState name for bridge encoding.
Definition: BridgeEncoding.hh:62
InstructionField::OSKEY_EXTRA_BITS
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
Definition: InstructionField.hh:75
SOURCE_IMMEDIATE_MAP
const string SOURCE_IMMEDIATE_MAP
Definition: BEMSerializer.cc:137
ALWAYS_FALSE_GUARD_CODE
const string ALWAYS_FALSE_GUARD_CODE
Definition: BEMSerializer.cc:118
PORT_GUARD_CODE
const string PORT_GUARD_CODE
Definition: BEMSerializer.cc:113
ObjectState::childByName
ObjectState * childByName(const std::string &name) const
Definition: ObjectState.cc:443
SOURCE_IMMEDIATE
const string SOURCE_IMMEDIATE
Definition: BEMSerializer.cc:135
SOCKET_MAP_EXTRA_BITS
const string SOCKET_MAP_EXTRA_BITS
Definition: BEMSerializer.cc:132
BEMSerializer::sourceFieldToOM
static ObjectState * sourceFieldToOM(const ObjectState *fileSource)
Definition: BEMSerializer.cc:1167
FUPortCode::OSKEY_OPERATION_NAME
static const std::string OSKEY_OPERATION_NAME
ObjectState attribute key for the name of the operation.
Definition: FUPortCode.hh:70
assert
#define assert(condition)
Definition: Application.hh:86
SLOT
const string SLOT
Definition: BEMSerializer.cc:102
LImmDstRegisterField::OSKEY_DST_IU
static const std::string OSKEY_DST_IU
ObjectState attribute key for the name of the immediate unit.
Definition: LImmDstRegisterField.hh:78
SocketEncoding::OSKEY_SC_TABLE
static const std::string OSKEY_SC_TABLE
ObjectState attribute key for the name of the socket code table.
Definition: SocketEncoding.hh:83
PORT_GUARD_CODE_FU
const string PORT_GUARD_CODE_FU
Definition: BEMSerializer.cc:114
PORT_GUARD_CODE_INVERTED
const string PORT_GUARD_CODE_INVERTED
Definition: BEMSerializer.cc:116
LIMM_TAG_EXTRA_BITS
const string LIMM_TAG_EXTRA_BITS
Definition: BEMSerializer.cc:91
ImmediateControlField::OSNAME_TEMPLATE_MAP
static const std::string OSNAME_TEMPLATE_MAP
ObjectState name for a template mapping.
Definition: ImmediateControlField.hh:86
BEMSerializer::convertToFileFormat
static ObjectState * convertToFileFormat(const ObjectState *omState)
Definition: BEMSerializer.cc:327
SOURCE_BRIDGE
const string SOURCE_BRIDGE
Definition: BEMSerializer.cc:139
SOCKET_CODE_TABLE
const string SOCKET_CODE_TABLE
Definition: BEMSerializer.cc:71
BEMSerializer::sourceFieldToFile
static ObjectState * sourceFieldToFile(const ObjectState *sFieldState)
Definition: BEMSerializer.cc:704
SocketEncoding::OSNAME_SOCKET_ENCODING
static const std::string OSNAME_SOCKET_ENCODING
ObjectState name for socket encoding.
Definition: SocketEncoding.hh:79
LIMM_TAG_MAP_NAME
const string LIMM_TAG_MAP_NAME
Definition: BEMSerializer.cc:93
RF_PORT_CODE
const string RF_PORT_CODE
Definition: BEMSerializer.cc:80
SLOT_POSITION
const string SLOT_POSITION
Definition: BEMSerializer.cc:104
PortCode::OSKEY_MAX_INDEX
static const std::string OSKEY_MAX_INDEX
ObjectState attribute key for the max-index attribute.
Definition: PortCode.hh:77
XMLSerializer::setSchemaFile
void setSchemaFile(const std::string &fileName)
Definition: XMLSerializer.cc:168
BinaryEncoding::saveState
virtual ObjectState * saveState() const
Definition: BinaryEncoding.cc:858
ImmediateEncoding::OSKEY_IMM_WIDTH
static const std::string OSKEY_IMM_WIDTH
ObjectState attribute key for the immediate width.
Definition: ImmediateEncoding.hh:65
FUGuardEncoding::OSNAME_FU_GUARD_ENCODING
static const std::string OSNAME_FU_GUARD_ENCODING
ObjectState name for FU guard encoding.
Definition: FUGuardEncoding.hh:61
FU_PORT_CODE_PORT
const string FU_PORT_CODE_PORT
Definition: BEMSerializer.cc:75
ID_POS_LEFT
const string ID_POS_LEFT
Definition: BEMSerializer.cc:126
BEMSerializer::moveSlotToOM
static ObjectState * moveSlotToOM(const ObjectState *fileSlot)
Definition: BEMSerializer.cc:1032
BEMSerializer::guardFieldToOM
static ObjectState * guardFieldToOM(const ObjectState *fileGuard)
Definition: BEMSerializer.cc:1076
THROW_EXCEPTION
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition: Exception.hh:39
BEMSerializer::longImmTagToFile
static ObjectState * longImmTagToFile(const ObjectState *immTag)
Definition: BEMSerializer.cc:524
XMLSerializer::readState
virtual ObjectState * readState()
Definition: XMLSerializer.cc:200
SC_TABLE_NAME
const string SC_TABLE_NAME
Definition: BEMSerializer.cc:72
SOCKET_MAP
const string SOCKET_MAP
Definition: BEMSerializer.cc:131
REQUIRED_VERSION
const string REQUIRED_VERSION
Definition: BEMSerializer.cc:69
BEMSerializer::guardFieldToFile
static ObjectState * guardFieldToFile(const ObjectState *gFieldState)
Definition: BEMSerializer.cc:608
BEMSerializer::readState
virtual ObjectState * readState()
Definition: BEMSerializer.cc:186
BEMSerializer::writeState
virtual void writeState(const ObjectState *state)
Definition: BEMSerializer.cc:246
BinaryEncoding::LEFT
@ LEFT
Definition: BinaryEncoding.hh:64
BEMSerializer::moveSlotToFile
static ObjectState * moveSlotToFile(const ObjectState *slotState)
Definition: BEMSerializer.cc:562
DestinationField::OSNAME_DESTINATION_FIELD
static const std::string OSNAME_DESTINATION_FIELD
ObjectState name for destination field.
Definition: DestinationField.hh:54
IMMEDIATE_SLOT
const string IMMEDIATE_SLOT
Definition: BEMSerializer.cc:151
IU_PORT_CODE_IU
const string IU_PORT_CODE_IU
Definition: BEMSerializer.cc:87
Environment::schemaDirPath
static std::string schemaDirPath(const std::string &prog)
Definition: Environment.cc:151
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
LIMM_TAG_MAP
const string LIMM_TAG_MAP
Definition: BEMSerializer.cc:92
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
IMM_REG_FIELD_ITEMP_NAME
const string IMM_REG_FIELD_ITEMP_NAME
Definition: BEMSerializer.cc:99
ObjectState::childCount
int childCount() const
SOCKET_MAP_CODES
const string SOCKET_MAP_CODES
Definition: BEMSerializer.cc:133
EXTRA_BITS
const string EXTRA_BITS
Definition: BEMSerializer.cc:156
Encoding::OSKEY_ENCODING
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding.
Definition: Encoding.hh:66
SRC_DST_EXTRA_BITS
const string SRC_DST_EXTRA_BITS
Definition: BEMSerializer.cc:124
LImmDstRegisterField::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
Definition: LImmDstRegisterField.hh:72
ImmediateSlotField::OSKEY_NAME
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the immediate slot.
Definition: ImmediateSlotField.hh:65
SOURCE_IMMEDIATE_WIDTH
const string SOURCE_IMMEDIATE_WIDTH
Definition: BEMSerializer.cc:136
SerializerException
Definition: Exception.hh:675
ObjectState::hasChild
bool hasChild(const std::string &name) const
Definition: ObjectState.cc:358
RF_PORT_CODE_ENCODING
const string RF_PORT_CODE_ENCODING
Definition: BEMSerializer.cc:84
IU_PORT_CODE
const string IU_PORT_CODE
Definition: BEMSerializer.cc:86
RF_PORT_CODE_MAX_INDEX
const string RF_PORT_CODE_MAX_INDEX
Definition: BEMSerializer.cc:83
SOCKET
const string SOCKET
Definition: BEMSerializer.cc:129
REG_GUARD_CODE_INVERTED
const string REG_GUARD_CODE_INVERTED
Definition: BEMSerializer.cc:112
ImmediateSlotField::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
Definition: ImmediateSlotField.hh:67
ObjectState::name
std::string name() const
XMLSerializer::setUseSchema
void setUseSchema(bool useSchema)
Definition: XMLSerializer.cc:179
LImmDstRegisterField::OSNAME_IU_DESTINATION
static const std::string OSNAME_IU_DESTINATION
ObjectState name for a immediate unit destination.
Definition: LImmDstRegisterField.hh:74
IMM_REG_FIELD_POS
const string IMM_REG_FIELD_POS
Definition: BEMSerializer.cc:96
BridgeEncoding::OSKEY_BRIDGE_NAME
static const std::string OSKEY_BRIDGE_NAME
ObjectState attribute key for the name of the bridge.
Definition: BridgeEncoding.hh:64
SocketCodeTable::OSKEY_NAME
static const std::string OSKEY_NAME
ObjectState attribute key for name of the table.
Definition: SocketCodeTable.hh:123
LIMM_TAG_POSITION
const string LIMM_TAG_POSITION
Definition: BEMSerializer.cc:90
GuardField::OSNAME_GUARD_FIELD
static const std::string OSNAME_GUARD_FIELD
ObjectState name for guard field.
Definition: GuardField.hh:99
BEMSerializer::socketCodeTableToOM
static ObjectState * socketCodeTableToOM(const ObjectState *scTable)
Definition: BEMSerializer.cc:934
UnconditionalGuardEncoding::OSNAME_UNCONDITIONAL_GUARD_ENCODING
static const std::string OSNAME_UNCONDITIONAL_GUARD_ENCODING
ObjectState name for unconditional guard encoding.
Definition: UnconditionalGuardEncoding.hh:57
Encoding::OSKEY_EXTRA_BITS
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
Definition: Encoding.hh:68
GPRGuardEncoding::OSKEY_RF_NAME
static const std::string OSKEY_RF_NAME
ObjectState attribute key for the name of the register file.
Definition: GPRGuardEncoding.hh:63
FU_PORT_CODE_EXTRA_BITS
const string FU_PORT_CODE_EXTRA_BITS
Definition: BEMSerializer.cc:79
LImmDstRegisterField::OSNAME_LIMM_DST_REGISTER_FIELD
static const std::string OSNAME_LIMM_DST_REGISTER_FIELD
ObjectState name for long immediate destination register field.
Definition: LImmDstRegisterField.hh:70
ObjectState::doubleAttribute
double doubleAttribute(const std::string &name) const
Definition: ObjectState.cc:323
BEMSerializer::immediateSlotToOM
static ObjectState * immediateSlotToOM(const ObjectState *fileSlot)
Definition: BEMSerializer.cc:1312
GPRGuardEncoding::OSNAME_GPR_GUARD_ENCODING
static const std::string OSNAME_GPR_GUARD_ENCODING
ObjectState name for GPR guard encoding.
Definition: GPRGuardEncoding.hh:61
SlotField::OSNAME_SLOT_FIELD
static const std::string OSNAME_SLOT_FIELD
ObjectState name for slot field.
Definition: SlotField.hh:89
SLOT_EXTRA_BITS
const string SLOT_EXTRA_BITS
Definition: BEMSerializer.cc:105
ObjectState::removeChild
void removeChild(ObjectState *child)
Definition: ObjectState.cc:389
SRC_DST_NO_OPERATION_MAP_EXTRA_BITS
const string SRC_DST_NO_OPERATION_MAP_EXTRA_BITS
Definition: BEMSerializer.cc:146
BEMSerializer::convertToOMFormat
static ObjectState * convertToOMFormat(const ObjectState *fileState)
Definition: BEMSerializer.cc:287
FU_PORT_CODE_ENCODING
const string FU_PORT_CODE_ENCODING
Definition: BEMSerializer.cc:78
REG_GUARD_CODE_INDEX
const string REG_GUARD_CODE_INDEX
Definition: BEMSerializer.cc:111
IUPortCode::OSNAME_IU_PORT_CODE
static const std::string OSNAME_IU_PORT_CODE
ObjectState name for RF port code.
Definition: IUPortCode.hh:55
BinaryEncoding::RIGHT
@ RIGHT
Definition: BinaryEncoding.hh:65
IMM_REG_FIELD
const string IMM_REG_FIELD
Definition: BEMSerializer.cc:95
BinaryEncoding::OSNAME_BEM
static const std::string OSNAME_BEM
ObjectState name for binary encoding.
Definition: BinaryEncoding.hh:126
TRUE
const string TRUE
Definition: BEMSerializer.cc:64
ObjectState::boolAttribute
bool boolAttribute(const std::string &name) const
Definition: ObjectState.cc:338
LImmDstRegisterField::OSKEY_ITEMP
static const std::string OSKEY_ITEMP
ObjectState attribute key for the name of the instruction template.
Definition: LImmDstRegisterField.hh:76
PortCode::OSKEY_INDEX_WIDTH
static const std::string OSKEY_INDEX_WIDTH
ObjectState attribute key for the widht of register index.
Definition: PortCode.hh:75
BEMSerializer::convertZeroEncExtraBits
static void convertZeroEncExtraBits(ObjectState *os)
Definition: BEMSerializer.cc:214
MoveSlot::OSKEY_BUS_NAME
static const std::string OSKEY_BUS_NAME
ObjectState attribute key for the name of the bus.
Definition: MoveSlot.hh:98
IMMEDIATE_SLOT_WIDTH
const string IMMEDIATE_SLOT_WIDTH
Definition: BEMSerializer.cc:153
SocketCodeTable::OSNAME_SOCKET_CODE_TABLE
static const std::string OSNAME_SOCKET_CODE_TABLE
ObjectState name for socket code table.
Definition: SocketCodeTable.hh:121
BEMSerializer::readRegisterFilePortCode
static void readRegisterFilePortCode(const ObjectState *filePortCode, ObjectState *omPortCode)
Definition: BEMSerializer.cc:1377
FALSE
const string FALSE
Definition: BEMSerializer.cc:65
ALWAYS_TRUE_GUARD_CODE
const string ALWAYS_TRUE_GUARD_CODE
Definition: BEMSerializer.cc:117
ImmediateControlField::OSKEY_ENCODING
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding of the instruction template.
Definition: ImmediateControlField.hh:91
ObjectState::stringValue
std::string stringValue() const
BEMSerializer::socketCodeTableToFile
static ObjectState * socketCodeTableToFile(const ObjectState *scTable)
Definition: BEMSerializer.cc:404
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
GuardEncoding::OSKEY_ENCODING
static const std::string OSKEY_ENCODING
ObjectState attribute key for encoding.
Definition: GuardEncoding.hh:60
BEMSerializer::longImmTagToOM
static ObjectState * longImmTagToOM(const ObjectState *fileTag)
Definition: BEMSerializer.cc:995
NOPEncoding::OSNAME_NOP_ENCODING
static const std::string OSNAME_NOP_ENCODING
ObjectState name for NOP encoding.
Definition: NOPEncoding.hh:57
SLOT_DESTINATION
const string SLOT_DESTINATION
Definition: BEMSerializer.cc:121
SOURCE_BRIDGE_MAP_EXTRA_BITS
const string SOURCE_BRIDGE_MAP_EXTRA_BITS
Definition: BEMSerializer.cc:142
BEMSerializer::slotFieldToFile
static ObjectState * slotFieldToFile(const ObjectState *sFieldState)
Definition: BEMSerializer.cc:798
IMM_REG_FIELD_ITEMP
const string IMM_REG_FIELD_ITEMP
Definition: BEMSerializer.cc:98
SlotField::OSKEY_COMPONENT_ID_POSITION
static const std::string OSKEY_COMPONENT_ID_POSITION
ObjectState attribute key for component ID position.
Definition: SlotField.hh:91
BEMSerializer::longImmDstRegFieldToOM
static ObjectState * longImmDstRegFieldToOM(const ObjectState *fileField)
Definition: BEMSerializer.cc:1337
ID_POS_RIGHT
const string ID_POS_RIGHT
Definition: BEMSerializer.cc:127
SRC_DST_NO_OPERATION
const string SRC_DST_NO_OPERATION
Definition: BEMSerializer.cc:144
REG_GUARD_CODE
const string REG_GUARD_CODE
Definition: BEMSerializer.cc:109
BEM_VERSION_STR
const string BEM_VERSION_STR
Definition: BEMSerializer.cc:68
UnconditionalGuardEncoding
Definition: UnconditionalGuardEncoding.hh:47
IMM_REG_FIELD_WIDTH
const string IMM_REG_FIELD_WIDTH
Definition: BEMSerializer.cc:97
SourceField::OSNAME_SOURCE_FIELD
static const std::string OSNAME_SOURCE_FIELD
ObjectState name for source field.
Definition: SourceField.hh:74
FUPortCode::OSKEY_PORT_NAME
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
Definition: FUPortCode.hh:68
ObjectState::setValue
void setValue(const std::string &value)
REG_GUARD_CODE_RF
const string REG_GUARD_CODE_RF
Definition: BEMSerializer.cc:110
SLOT_GUARD_POSITION
const string SLOT_GUARD_POSITION
Definition: BEMSerializer.cc:107
FUGuardEncoding::OSKEY_FU_NAME
static const std::string OSKEY_FU_NAME
ObjectState attribute key for the name of the function unit.
Definition: FUGuardEncoding.hh:63
InstructionFormat::OSNAME_INSTRUCTION_FORMAT
static const std::string OSNAME_INSTRUCTION_FORMAT
Definition: InstructionFormat.hh:77
SocketCodeTable::OSKEY_EXTRA_BITS
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
Definition: SocketCodeTable.hh:125
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
BEMSerializer::destinationFieldToOM
static ObjectState * destinationFieldToOM(const ObjectState *fileDestination)
Definition: BEMSerializer.cc:1222
SocketEncoding::OSKEY_SOCKET_NAME
static const std::string OSKEY_SOCKET_NAME
ObjectState attribute key for the name of the socket.
Definition: SocketEncoding.hh:81
XMLSerializer::writeState
virtual void writeState(const ObjectState *rootState)
Definition: XMLSerializer.cc:219