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

#include <ADFSerializer.hh>

Inheritance diagram for ADFSerializer:
Inheritance graph
Collaboration diagram for ADFSerializer:
Collaboration graph

Public Member Functions

 ADFSerializer ()
 
virtual ~ADFSerializer ()
 
void writeState (const ObjectState *machineState)
 
ObjectStatereadState ()
 
void writeMachine (const TTAMachine::Machine &machine)
 
TTAMachine::MachinereadMachine ()
 
- 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 ()
 

Protected Member Functions

 ADFSerializer (const ADFSerializer &)
 Copying forbidden. More...
 
ADFSerializeroperator= (const ADFSerializer &)
 Assingment forbidden. More...
 
- Protected Member Functions inherited from XMLSerializer
std::string sourceFile () const
 

Static Private Member Functions

static ObjectStateconvertToMDFFormat (const ObjectState *machineState)
 
static ObjectStatebusToMDF (const ObjectState *busState)
 
static ObjectStatesocketToMDF (const ObjectState *socketState)
 
static ObjectStatebridgeToMDF (const ObjectState *bridgeState)
 
static ObjectStatefunctionUnitToMDF (const ObjectState *fuState)
 
static ObjectStateregisterFileToMDF (const ObjectState *rfState)
 
static ObjectStateimmediateUnitToMDF (const ObjectState *iuState, const ObjectState *machineState)
 
static ObjectStateaddressSpaceToMDF (const ObjectState *asState)
 
static ObjectStatecontrolUnitToMDF (const ObjectState *cuState)
 
static ObjectStateimmediateSlotToMDF (const ObjectState *isState)
 
static ObjectStateconvertToMachineFormat (const ObjectState *mdfState)
 
static ObjectStatebusToMachine (const ObjectState *busState)
 
static ObjectStatesocketToMachine (const ObjectState *socketState)
 
static ObjectStatebridgeToMachine (const ObjectState *bridgeState)
 
static ObjectStatefunctionUnitToMachine (const ObjectState *fuState, const int orderNumber)
 
static ObjectStateregisterFileToMachine (const ObjectState *rfState)
 
static ObjectStateaddressSpaceToMachine (const ObjectState *asState)
 
static ObjectStatecontrolUnitToMachine (const ObjectState *cuState)
 
static ObjectStateimmediateUnitToMachine (const ObjectState *iuState, ObjectState *machineState)
 
static ObjectStateimmediateSlotToMachine (const ObjectState *isState)
 
static ObjectStatemachineSRPort (const ObjectState *mdfSRPortState)
 
static ObjectStatemdfSRPort (const ObjectState *machineSRPortState)
 
static void setIUExtensionMode (const ObjectState *mdfIUState, ObjectState *momIUState)
 
static ObjectStatemachineRFPort (const ObjectState *mdfPortState)
 
static ObjectStatemdfPort (const ObjectState *machinePortState)
 
static ObjectStatemachineFUPort (const ObjectState *mdfFUPortState)
 
static ObjectStatemdfFUPort (const ObjectState *machineFUPortState)
 
static ObjectStatemachineOperation (const ObjectState *mdfOperationState)
 
static ObjectStatemdfOperation (const ObjectState *machineOperationState)
 
static ObjectStatemachinePipeline (const ObjectState *mdfPipelineState)
 
static ObjectStatemdfPipeline (const ObjectState *machinePipelineState)
 
static void instructionTemplateToMDF (const ObjectState *momITState, ObjectState *mdfIUState)
 
static void instructionTemplateToMachine (const ObjectState *mdfITState, ObjectState *momMachineState, const std::string &iuName=std::string(""))
 
static ObjectStatemomTemplateSlot (const ObjectState *momITState, const std::string &busName)
 
static bool hasEmptyInstructionTemplate (const ObjectState *momMachineState)
 

Detailed Description

This class is used to generate a machine object model from MDF file and to generate MDF file from a machine object model.

By default ADFSerializer validates the files it reads with ADF Schema.

Definition at line 49 of file ADFSerializer.hh.

Constructor & Destructor Documentation

◆ ADFSerializer() [1/2]

ADFSerializer::ADFSerializer ( )

Constructor.

Definition at line 203 of file ADFSerializer.cc.

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

Here is the call graph for this function:

◆ ~ADFSerializer()

ADFSerializer::~ADFSerializer ( )
virtual

Destructor.

Definition at line 212 of file ADFSerializer.cc.

212  {
213 }

◆ ADFSerializer() [2/2]

ADFSerializer::ADFSerializer ( const ADFSerializer )
protected

Copying forbidden.

Member Function Documentation

◆ addressSpaceToMachine()

ObjectState * ADFSerializer::addressSpaceToMachine ( const ObjectState asState)
staticprivate

Creates a new ObjectState tree which can be read by AddressSpace::loadState.

The ObjectState tree is created according to the given ObjectState tree which matches with the syntax of address space declaration in MDF file.

Parameters
asStateThe ObjectState tree which matches with the syntax of address space declaration in MDF file.
Returns
The newly created ObjectState tree.

Definition at line 1391 of file ADFSerializer.cc.

1391  {
1392 
1393  ObjectState* as = new ObjectState(AddressSpace::OSNAME_ADDRESS_SPACE);
1394 
1395  // set name
1396  as->setAttribute(
1397  Component::OSKEY_NAME, asState->stringAttribute(AS_NAME));
1398 
1399  // set width
1400  ObjectState* width = asState->childByName(AS_WIDTH);
1401  as->setAttribute(AddressSpace::OSKEY_WIDTH, width->stringValue());
1402 
1403  // set min address
1404  ObjectState* minAddress = asState->childByName(AS_MIN_ADDRESS);
1405  as->setAttribute(
1406  AddressSpace::OSKEY_MIN_ADDRESS, minAddress->stringValue());
1407 
1408  // set max address
1409  ObjectState* maxAddress = asState->childByName(AS_MAX_ADDRESS);
1410  as->setAttribute(
1411  AddressSpace::OSKEY_MAX_ADDRESS, maxAddress->stringValue());
1412 
1413  if (asState->hasChild(AS_SHARED_MEMORY)) {
1414  ObjectState* shared = asState->childByName(AS_SHARED_MEMORY);
1415  as->setAttribute(
1416  AddressSpace::OSKEY_SHARED_MEMORY, shared->boolValue());
1417  }
1418 
1419  // the numerical ids
1420  for (int i = 0; i < asState->childCount(); i++) {
1421  ObjectState* child = asState->child(i);
1422  if (child->name() == AS_NUMERICAL_ID) {
1423  ObjectState* idObj =
1424  new ObjectState(AddressSpace::OSKEY_NUMERICAL_ID, as);
1425  idObj->setValue(child->intValue());
1426  as->addChild(idObj);
1427  }
1428  }
1429 
1430  return as;
1431 }

References ObjectState::addChild(), AS_MAX_ADDRESS, AS_MIN_ADDRESS, AS_NAME, AS_NUMERICAL_ID, AS_SHARED_MEMORY, AS_WIDTH, ObjectState::boolValue(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), ObjectState::intValue(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::setValue(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ addressSpaceToMDF()

ObjectState * ADFSerializer::addressSpaceToMDF ( const ObjectState asState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by AddressSpace::saveState.

Parameters
asStateRoot node of the ObjectState tree created by AddressSpace::saveState.
Returns
The newly created ObjectState tree.

Definition at line 852 of file ADFSerializer.cc.

852  {
853 
855  as->setAttribute(
856  AS_NAME, asState->stringAttribute(AddressSpace::OSKEY_NAME));
857 
858  // add width element
859  ObjectState* width = new ObjectState(AS_WIDTH);
860  as->addChild(width);
861  width->setValue(asState->stringAttribute(AddressSpace::OSKEY_WIDTH));
862 
863  // add min-address element
864  ObjectState* minAddress = new ObjectState(AS_MIN_ADDRESS);
865  as->addChild(minAddress);
866  minAddress->setValue(
867  asState->stringAttribute(AddressSpace::OSKEY_MIN_ADDRESS));
868 
869  // add max-address element
870  ObjectState* maxAddress = new ObjectState(AS_MAX_ADDRESS);
871  as->addChild(maxAddress);
872  maxAddress->setValue(
873  asState->stringAttribute(AddressSpace::OSKEY_MAX_ADDRESS));
874 
875  if (asState->hasAttribute(AddressSpace::OSKEY_SHARED_MEMORY)) {
877  as->addChild(shared);
878  shared->setValue(
879  asState->boolAttribute(AddressSpace::OSKEY_SHARED_MEMORY));
880  }
881  // the numerical ids
882  for (int i = 0; i < asState->childCount(); i++) {
883  ObjectState* child = asState->child(i);
884  if (child->name() == AddressSpace::OSKEY_NUMERICAL_ID) {
885  ObjectState* idObj = new ObjectState(AS_NUMERICAL_ID, as);
886  idObj->setValue(child->intValue());
887  }
888  }
889  return as;
890 }

References ObjectState::addChild(), ADDRESS_SPACE, AS_MAX_ADDRESS, AS_MIN_ADDRESS, AS_NAME, AS_NUMERICAL_ID, AS_SHARED_MEMORY, AS_WIDTH, ObjectState::boolAttribute(), ObjectState::child(), ObjectState::childCount(), ObjectState::hasAttribute(), ObjectState::intValue(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ bridgeToMachine()

ObjectState * ADFSerializer::bridgeToMachine ( const ObjectState bridgeState)
staticprivate

Creates a new ObjectState tree which can be read by Bridge::loadState.

The ObjectState tree is created according to the given ObjectState tree which matches with the syntax of bridge declaration in MDF file.

Parameters
bridgeStateThe ObjectState tree which matches with the syntax of bridge declaration in MDF file.
Returns
The newly created ObjectState tree.

Definition at line 1232 of file ADFSerializer.cc.

1232  {
1233 
1234  ObjectState* bridge = new ObjectState(Bridge::OSNAME_BRIDGE);
1235  bridge->setAttribute(
1236  Component::OSKEY_NAME, bridgeState->stringAttribute(BRIDGE_NAME));
1237  ObjectState* readsFrom = bridgeState->childByName(BRIDGE_READS_FROM);
1238  bridge->setAttribute(Bridge::OSKEY_SOURCE_BUS, readsFrom->stringValue());
1239  ObjectState* writesTo = bridgeState->childByName(BRIDGE_WRITES_TO);
1240  bridge->setAttribute(
1241  Bridge::OSKEY_DESTINATION_BUS, writesTo->stringValue());
1242  return bridge;
1243 }

References BRIDGE_NAME, BRIDGE_READS_FROM, BRIDGE_WRITES_TO, ObjectState::childByName(), ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ bridgeToMDF()

ObjectState * ADFSerializer::bridgeToMDF ( const ObjectState bridgeState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by Bridge::saveState.

Parameters
bridgeStateRoot node of the ObjectState tree created by Bridge::saveState.
Returns
The newly created ObjectState tree.

Definition at line 597 of file ADFSerializer.cc.

597  {
598 
599  ObjectState* bridge = new ObjectState(BRIDGE);
600  bridge->setAttribute(
601  BRIDGE_NAME, bridgeState->stringAttribute(Bridge::OSKEY_NAME));
602 
603  ObjectState* readsFrom = new ObjectState(BRIDGE_READS_FROM);
604  bridge->addChild(readsFrom);
605  readsFrom->setValue(
606  bridgeState->stringAttribute(Bridge::OSKEY_SOURCE_BUS));
607 
608  ObjectState* writesTo = new ObjectState(BRIDGE_WRITES_TO);
609  bridge->addChild(writesTo);
610  writesTo->setValue(
611  bridgeState->stringAttribute(Bridge::OSKEY_DESTINATION_BUS));
612 
613  return bridge;
614 }

References ObjectState::addChild(), BRIDGE, BRIDGE_NAME, BRIDGE_READS_FROM, BRIDGE_WRITES_TO, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ busToMachine()

ObjectState * ADFSerializer::busToMachine ( const ObjectState busState)
staticprivate

Creates a new ObjectState tree which can be read by Bus::loadState and which corresponds with the given ObjectState tree declaring a bus by MDF syntax.

Parameters
busStateThe ObjectState tree declaring a bus by MDF syntax.
Returns
The newly created ObjectState tree.

Definition at line 1064 of file ADFSerializer.cc.

1064  {
1065 
1066  ObjectState* bus = new ObjectState(Bus::OSNAME_BUS);
1067 
1068  // set name
1069  bus->setAttribute(
1070  Component::OSKEY_NAME, busState->stringAttribute(BUS_NAME));
1071 
1072  // set width
1073  ObjectState* width = busState->childByName(BUS_WIDTH);
1074  bus->setAttribute(Bus::OSKEY_WIDTH, width->stringValue());
1075 
1076  // set immediate width and extension
1077  ObjectState* shortImm = busState->childByName(SHORT_IMMEDIATE);
1078  ObjectState* shortImmWidth = shortImm->childByName(SHORT_IMM_WIDTH);
1079  bus->setAttribute(Bus::OSKEY_IMMWIDTH, shortImmWidth->stringValue());
1080  ObjectState* shortImmExt = shortImm->childByName(SHORT_IMM_EXTENSION);
1081  string extension = shortImmExt->stringValue();
1082  if (extension == SIGN_EXTENSION) {
1083  bus->setAttribute(Bus::OSKEY_EXTENSION, Bus::OSVALUE_SIGN);
1084  } else if (extension == ZERO_EXTENSION) {
1085  bus->setAttribute(Bus::OSKEY_EXTENSION, Bus::OSVALUE_ZERO);
1086  } else {
1087  string procName = "ADFSerializer::busToMachine";
1088  string errorMsg = "Unknown extension value in ObjectState.";
1089  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
1091  }
1092 
1093  // add segments and guards
1094  for (int i = 0; i < busState->childCount(); i++) {
1095  ObjectState* child = busState->child(i);
1096  if (child->name() == SEGMENT) {
1097  ObjectState* segment = new ObjectState(Segment::OSNAME_SEGMENT);
1098  bus->addChild(segment);
1099  segment->setAttribute(
1100  Segment::OSKEY_NAME, child->stringAttribute(SEGMENT_NAME));
1101  ObjectState* writesTo = child->childByName(SEGMENT_WRITES_TO);
1102  string destination = writesTo->stringValue();
1103  if (destination != "") {
1104  segment->setAttribute(
1105  Segment::OSKEY_DESTINATION, writesTo->stringValue());
1106  }
1107  } else if (child->name() == GUARD) {
1108  ObjectState* guardType = child->child(0);
1109  if (guardType->name() == ALWAYS_TRUE_GUARD) {
1110  ObjectState* ucGuard = new ObjectState(
1111  UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD);
1112  bus->addChild(ucGuard);
1113  ucGuard->setAttribute(Guard::OSKEY_INVERTED, false);
1114  } else if (guardType->name() == ALWAYS_FALSE_GUARD) {
1115  ObjectState* ucGuard = new ObjectState(
1116  UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD);
1117  bus->addChild(ucGuard);
1118  ucGuard->setAttribute(Guard::OSKEY_INVERTED, true);
1119  } else if (guardType->name() == SIMPLE_EXPR ||
1120  guardType->name() == INVERTED_EXPR) {
1121  ObjectState* boolOrUnit = guardType->child(0);
1122  string objectStateName;
1123  string unitNameElem;
1124  string unitNameAttrib;
1125  string targetNameElem;
1126  string targetNameAttrib;
1127  if (boolOrUnit->name() == GUARD_BOOL) {
1128  objectStateName = RegisterGuard::OSNAME_REGISTER_GUARD;
1129  unitNameElem = GUARD_REGFILE_NAME;
1130  unitNameAttrib = RegisterGuard::OSKEY_REGFILE;
1131  targetNameElem = GUARD_REGFILE_INDEX;
1132  targetNameAttrib = RegisterGuard::OSKEY_INDEX;
1133  } else if (boolOrUnit->name() == GUARD_UNIT) {
1134  objectStateName = PortGuard::OSNAME_PORT_GUARD;
1135  unitNameElem = GUARD_UNIT_NAME;
1136  unitNameAttrib = PortGuard::OSKEY_FU;
1137  targetNameElem = GUARD_UNIT_PORT;
1138  targetNameAttrib = PortGuard::OSKEY_PORT;
1139  } else {
1140  string procName = "ADFSerializer::busToMachine";
1141  string errorMsg = "Unknown ObjectState name.";
1143  __FILE__, __LINE__, procName, errorMsg);
1145  }
1146 
1147  ObjectState* guard = new ObjectState(objectStateName);
1148  bus->addChild(guard);
1149  if (guardType->name() == SIMPLE_EXPR) {
1150  guard->setAttribute(Guard::OSKEY_INVERTED, false);
1151  } else {
1152  guard->setAttribute(Guard::OSKEY_INVERTED, true);
1153  }
1154  ObjectState* unit = boolOrUnit->childByName(unitNameElem);
1155  guard->setAttribute(unitNameAttrib, unit->stringValue());
1156  ObjectState* target = boolOrUnit->childByName(
1157  targetNameElem);
1158  guard->setAttribute(targetNameAttrib, target->stringValue());
1159  }
1160  }
1161  }
1162 
1163  return bus;
1164 }

References Application::abortProgram(), ObjectState::addChild(), ALWAYS_FALSE_GUARD, ALWAYS_TRUE_GUARD, BUS_NAME, BUS_WIDTH, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), GUARD, GUARD_BOOL, GUARD_REGFILE_INDEX, GUARD_REGFILE_NAME, GUARD_UNIT, GUARD_UNIT_NAME, GUARD_UNIT_PORT, INVERTED_EXPR, ObjectState::name(), SEGMENT, SEGMENT_NAME, SEGMENT_WRITES_TO, ObjectState::setAttribute(), SHORT_IMM_EXTENSION, SHORT_IMM_WIDTH, SHORT_IMMEDIATE, SIGN_EXTENSION, SIMPLE_EXPR, ObjectState::stringAttribute(), ObjectState::stringValue(), Application::writeToErrorLog(), and ZERO_EXTENSION.

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ busToMDF()

ObjectState * ADFSerializer::busToMDF ( const ObjectState busState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by Bus::saveState.

Parameters
busStateRoot node of the ObjectState tree created by Bus::saveState.
Returns
The newly created ObjectState tree.

Definition at line 419 of file ADFSerializer.cc.

419  {
420 
421  ObjectState* root = new ObjectState(BUS);
422  root->setAttribute(BUS_NAME, busState->stringAttribute(Bus::OSKEY_NAME));
423 
424  // add width element
425  ObjectState* widthChild = new ObjectState(BUS_WIDTH);
426  widthChild->setValue(busState->stringAttribute(Bus::OSKEY_WIDTH));
427  root->addChild(widthChild);
428 
429  // add guards
430  for (int i = 0; i < busState->childCount(); i++) {
431  ObjectState* child = busState->child(i);
432 
433  if (child->name() == PortGuard::OSNAME_PORT_GUARD ||
434  child->name() == RegisterGuard::OSNAME_REGISTER_GUARD) {
435  string guardType;
436  string guardUnit;
437  string guardTarget;
438  string unitNameAttrib;
439  string targetNameAttrib;
440  if (child->name() == PortGuard::OSNAME_PORT_GUARD) {
441  guardType = GUARD_UNIT;
442  guardUnit = GUARD_UNIT_NAME;
443  guardTarget = GUARD_UNIT_PORT;
444  unitNameAttrib = PortGuard::OSKEY_FU;
445  targetNameAttrib = PortGuard::OSKEY_PORT;
446  } else if (child->name() ==
447  RegisterGuard::OSNAME_REGISTER_GUARD) {
448  guardType = GUARD_BOOL;
449  guardUnit = GUARD_REGFILE_NAME;
450  guardTarget = GUARD_REGFILE_INDEX;
451  unitNameAttrib = RegisterGuard::OSKEY_REGFILE;
452  targetNameAttrib = RegisterGuard::OSKEY_INDEX;
453  }
454 
455  ObjectState* guardChild = new ObjectState(GUARD);
456  root->addChild(guardChild);
457  ObjectState* conditionalChild;
458  if (child->intAttribute(Guard::OSKEY_INVERTED)) {
459  conditionalChild = new ObjectState(INVERTED_EXPR);
460  } else {
461  conditionalChild = new ObjectState(SIMPLE_EXPR);
462  }
463  guardChild->addChild(conditionalChild);
464  ObjectState* typeChild = new ObjectState(guardType);
465  conditionalChild->addChild(typeChild);
466  ObjectState* unitChild = new ObjectState(guardUnit);
467  typeChild->addChild(unitChild);
468  unitChild->setValue(child->stringAttribute(unitNameAttrib));
469  ObjectState* targetChild = new ObjectState(guardTarget);
470  typeChild->addChild(targetChild);
471  targetChild->setValue(child->stringAttribute(targetNameAttrib));
472 
473  } else if (child->name() ==
474  UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD) {
475 
476  // unconditional guards
477  ObjectState* guardChild = new ObjectState(GUARD);
478  root->addChild(guardChild);
479  if (child->boolAttribute(Guard::OSKEY_INVERTED)) {
480  guardChild->addChild(new ObjectState(ALWAYS_FALSE_GUARD));
481  } else {
482  guardChild->addChild(new ObjectState(ALWAYS_TRUE_GUARD));
483  }
484  }
485  }
486 
487  // add segments
488  for (int i = 0; i < busState->childCount(); i++) {
489  ObjectState* child = busState->child(i);
490 
491  if (child->name() == Segment::OSNAME_SEGMENT) {
492  ObjectState* segment = new ObjectState(SEGMENT);
493  root->addChild(segment);
494  segment->setAttribute(
495  SEGMENT_NAME, child->stringAttribute(Segment::OSKEY_NAME));
496  ObjectState* writesTo = new ObjectState(SEGMENT_WRITES_TO);
497  segment->addChild(writesTo);
498  if (child->hasAttribute(Segment::OSKEY_DESTINATION)) {
499  writesTo->setValue(
500  child->stringAttribute(Segment::OSKEY_DESTINATION));
501  }
502  }
503  }
504 
505  // add short immediate element
506  ObjectState* sImmChild = new ObjectState(SHORT_IMMEDIATE);
507  root->addChild(sImmChild);
508  ObjectState* extensionChild = new ObjectState(SHORT_IMM_EXTENSION);
509  string extension = busState->stringAttribute(Bus::OSKEY_EXTENSION);
510  if (extension == Bus::OSVALUE_SIGN) {
511  extensionChild->setValue(SIGN_EXTENSION);
512  } else if (extension == Bus::OSVALUE_ZERO) {
513  extensionChild->setValue(ZERO_EXTENSION);
514  } else {
515  string procName = "MDFSerialiser::busToMDF";
516  string errorMsg = "Unknown extension attribute value in ObjectState "
517  "instance.";
518  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
520  }
521 
522  sImmChild->addChild(extensionChild);
523  ObjectState* sImmWidthChild = new ObjectState(SHORT_IMM_WIDTH);
524  sImmChild->addChild(sImmWidthChild);
525  sImmWidthChild->setValue(busState->stringAttribute(Bus::OSKEY_IMMWIDTH));
526 
527  return root;
528 }

References Application::abortProgram(), ObjectState::addChild(), ALWAYS_FALSE_GUARD, ALWAYS_TRUE_GUARD, ObjectState::boolAttribute(), BUS, BUS_NAME, BUS_WIDTH, ObjectState::child(), ObjectState::childCount(), GUARD, GUARD_BOOL, GUARD_REGFILE_INDEX, GUARD_REGFILE_NAME, GUARD_UNIT, GUARD_UNIT_NAME, GUARD_UNIT_PORT, ObjectState::hasAttribute(), ObjectState::intAttribute(), INVERTED_EXPR, ObjectState::name(), SEGMENT, SEGMENT_NAME, SEGMENT_WRITES_TO, ObjectState::setAttribute(), ObjectState::setValue(), SHORT_IMM_EXTENSION, SHORT_IMM_WIDTH, SHORT_IMMEDIATE, SIGN_EXTENSION, SIMPLE_EXPR, ObjectState::stringAttribute(), Application::writeToErrorLog(), and ZERO_EXTENSION.

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ controlUnitToMachine()

ObjectState * ADFSerializer::controlUnitToMachine ( const ObjectState cuState)
staticprivate

Creates a new ObjectState tree which can be read by ControlUnit::loadState.

The ObjectState tree is created according to the given ObjectState tree which matches with the syntax of control unit declaration in MDF file.

Parameters
cuStateThe ObjectState tree which matches with the syntax of control unit declaration in MDF file.
Returns
The newly created ObjectState tree.

Definition at line 1446 of file ADFSerializer.cc.

1446  {
1447 
1448  ObjectState* cu = new ObjectState(ControlUnit::OSNAME_CONTROL_UNIT);
1449 
1450  // set name
1451  cu->setAttribute(
1452  Component::OSKEY_NAME, cuState->stringAttribute(CU_NAME));
1453 
1454  // set address space
1455  ObjectState* as = cuState->childByName(CU_ADDRESS_SPACE);
1456  string asName = as->stringValue();
1457  if (asName != "") {
1458  cu->setAttribute(FunctionUnit::OSKEY_AS, as->stringValue());
1459  }
1460 
1461  // set delay slots
1462  ObjectState* delaySlots = cuState->childByName(CU_DELAY_SLOTS);
1463  cu->setAttribute(
1464  ControlUnit::OSKEY_DELAY_SLOTS, delaySlots->stringValue());
1465 
1466  // set the guard latency
1467  ObjectState* gLatency = cuState->childByName(CU_GUARD_LATENCY);
1468  cu->setAttribute(
1469  ControlUnit::OSKEY_GUARD_LATENCY, gLatency->stringValue());
1470 
1471  // set ports
1472  for (int i = 0; i < cuState->childCount(); i++) {
1473  ObjectState* child = cuState->child(i);
1474  if (child->name() == PORT) {
1475  cu->addChild(machineFUPort(child));
1476  } else if (child->name() == CU_SPECIAL_PORT) {
1477  cu->addChild(machineSRPort(child));
1478  }
1479  }
1480 
1481  // set return address port binding
1482  ObjectState* raElem = cuState->childByName(CU_RETURN_ADDRESS);
1483  string raPortName = raElem->stringValue();
1484  if (raPortName != "") {
1485  cu->setAttribute(ControlUnit::OSKEY_RA_PORT, raPortName);
1486  }
1487 
1488  // set operations
1489  for (int i = 0; i < cuState->childCount(); i++) {
1490  ObjectState* child = cuState->child(i);
1491  if (child->name() == CU_CTRL_OPERATION) {
1492  cu->addChild(machineOperation(child));
1493  }
1494  }
1495 
1496  return cu;
1497 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), CU_ADDRESS_SPACE, CU_CTRL_OPERATION, CU_DELAY_SLOTS, CU_GUARD_LATENCY, CU_NAME, CU_RETURN_ADDRESS, CU_SPECIAL_PORT, machineFUPort(), machineOperation(), machineSRPort(), ObjectState::name(), PORT, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ controlUnitToMDF()

ObjectState * ADFSerializer::controlUnitToMDF ( const ObjectState cuState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by ControlUnit::saveState.

Parameters
cuStateRoot node of the ObjectState tree created by ControlUnit::saveState.
Returns
The newly created ObjectState tree.

Definition at line 905 of file ADFSerializer.cc.

905  {
906 
907  ObjectState* cUnit = new ObjectState(CONTROL_UNIT);
908  cUnit->setAttribute(
909  CU_NAME, cuState->stringAttribute(ControlUnit::OSKEY_NAME));
910 
911  // add operand ports
912  for (int i = 0; i < cuState->childCount(); i++) {
913  ObjectState* child = cuState->child(i);
914  if (child->name() == FUPort::OSNAME_FUPORT) {
915  cUnit->addChild(mdfFUPort(child));
916  }
917  }
918 
919  // add special ports
920  for (int i = 0; i < cuState->childCount(); i++) {
921  ObjectState* child = cuState->child(i);
922  if (child->name() == SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT) {
923  cUnit->addChild(mdfSRPort(child));
924  }
925  }
926 
927  // add return-address element
928  ObjectState* raElement = new ObjectState(CU_RETURN_ADDRESS);
929  cUnit->addChild(raElement);
930  if (cuState->hasAttribute(ControlUnit::OSKEY_RA_PORT)) {
931  raElement->setValue(
932  cuState->stringAttribute(ControlUnit::OSKEY_RA_PORT));
933  }
934 
935  // add operations
936  for (int i = 0; i < cuState->childCount(); i++) {
937  ObjectState* child = cuState->child(i);
938  if (child->name() == HWOperation::OSNAME_OPERATION) {
939  ObjectState* ctrlOperation = mdfOperation(child);
940  ctrlOperation->setName(CU_CTRL_OPERATION);
941  cUnit->addChild(ctrlOperation);
942  }
943  }
944 
945  // add address space element
947  cUnit->addChild(as);
948  if (cuState->hasAttribute(FunctionUnit::OSKEY_AS)) {
949  as->setValue(cuState->stringAttribute(FunctionUnit::OSKEY_AS));
950  }
951 
952  // add delay-slots element
953  ObjectState* dSlots = new ObjectState(CU_DELAY_SLOTS);
954  cUnit->addChild(dSlots);
955  dSlots->setValue(
956  cuState->stringAttribute(ControlUnit::OSKEY_DELAY_SLOTS));
957 
958  // add guard latency element
959  ObjectState* gLatency = new ObjectState(CU_GUARD_LATENCY);
960  cUnit->addChild(gLatency);
961  gLatency->setValue(
962  cuState->stringAttribute(ControlUnit::OSKEY_GUARD_LATENCY));
963 
964  return cUnit;
965 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childCount(), CONTROL_UNIT, CU_ADDRESS_SPACE, CU_CTRL_OPERATION, CU_DELAY_SLOTS, CU_GUARD_LATENCY, CU_NAME, CU_RETURN_ADDRESS, ObjectState::hasAttribute(), mdfFUPort(), mdfOperation(), mdfSRPort(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::setName(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ convertToMachineFormat()

ObjectState * ADFSerializer::convertToMachineFormat ( const ObjectState mdfState)
staticprivate

Creates a new ObjectState tree which can be read by Machine::loadState and which corresponds with the given ObjectState tree.

Parameters
mdfStateAn ObjectState tree whose structure matches with MDF file structure.
Returns
The newly created ObjectState tree.
Exceptions
SerializerExceptionIf an error occurs while converting.

Definition at line 995 of file ADFSerializer.cc.

995  {
996  ObjectState* machine = new ObjectState(Machine::OSNAME_MACHINE);
997 
998  // Will count the number of function units and give sequential number
999  // to each of them.
1000  int orderNumber = 0;
1001 
1002  try {
1003  for (int i = 0; i < mdfState->childCount(); i++) {
1004  ObjectState* child = mdfState->child(i);
1005  if (child->name() == TRIGGER_INVALIDATES_OLD_RESULTS) {
1006  machine->setAttribute(
1007  Machine::OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS, true);
1008  } else if (child->name() == ALWAYS_WRITE_BACK_RESULTS) {
1009  machine->setAttribute(
1010  Machine::OSKEY_ALWAYS_WRITE_BACK_RESULTS, true);
1011  } else if (child->name() == LITTLE_ENDIAN_MACHINE) {
1012  machine->setAttribute(LITTLE_ENDIAN_MACHINE, true);
1013  } else if (child->name() == BITNESS64) {
1014  machine->setAttribute(BITNESS64, true);
1015  } else if (child->name() == FUNCTION_UNITS_ORDERED) {
1016  machine->setAttribute(
1017  Machine::OSKEY_FUNCTION_UNITS_ORDERED, true);
1018  } else if (child->name() == BUS) {
1019  machine->addChild(busToMachine(child));
1020  } else if (child->name() == SOCKET) {
1021  machine->addChild(socketToMachine(child));
1022  } else if (child->name() == BRIDGE) {
1023  machine->addChild(bridgeToMachine(child));
1024  } else if (child->name() == FUNCTION_UNIT) {
1025  orderNumber++;
1026  machine->addChild(functionUnitToMachine(child, orderNumber));
1027  } else if (child->name() == REGISTER_FILE) {
1028  machine->addChild(registerFileToMachine(child));
1029  } else if (child->name() == ADDRESS_SPACE) {
1030  machine->addChild(addressSpaceToMachine(child));
1031  } else if (child->name() == CONTROL_UNIT) {
1032  machine->addChild(controlUnitToMachine(child));
1033  } else if (child->name() == IMMEDIATE_UNIT) {
1034  machine->addChild(immediateUnitToMachine(child, machine));
1035  } else if (child->name() == IMMEDIATE_SLOT) {
1036  machine->addChild(immediateSlotToMachine(child));
1037  } else if (child->name() == IU_TEMPLATE) {
1038  // the instruction template must not belong to any IU in case
1039  // one defines a template with implicit slots
1041  } else if (
1042  child->name() == OperationTriggeredFormat::OSNAME_FORMAT) {
1043  ObjectState* newChild = new ObjectState(*child);
1044  machine->addChild(newChild);
1045  }
1046  }
1047  } catch (const SerializerException&) {
1048  delete machine;
1049  throw;
1050  }
1051 
1052  return machine;
1053 }

References ADDRESS_SPACE, addressSpaceToMachine(), ALWAYS_WRITE_BACK_RESULTS, BITNESS64, BRIDGE, bridgeToMachine(), BUS, busToMachine(), ObjectState::child(), ObjectState::childCount(), CONTROL_UNIT, controlUnitToMachine(), FUNCTION_UNIT, FUNCTION_UNITS_ORDERED, functionUnitToMachine(), IMMEDIATE_SLOT, IMMEDIATE_UNIT, immediateSlotToMachine(), immediateUnitToMachine(), instructionTemplateToMachine(), IU_TEMPLATE, LITTLE_ENDIAN_MACHINE, machine, ObjectState::name(), REGISTER_FILE, registerFileToMachine(), SOCKET, socketToMachine(), and TRIGGER_INVALIDATES_OLD_RESULTS.

Referenced by readState().

Here is the call graph for this function:

◆ convertToMDFFormat()

ObjectState * ADFSerializer::convertToMDFFormat ( const ObjectState machineState)
staticprivate

Converts the given ObjectState tree created by Machine to correspond with MDF format.

Parameters
machineStateRoot of the ObjectState tree.
Returns
The newly created ObjectState tree which matches with MDF format.

Definition at line 292 of file ADFSerializer.cc.

292  {
293 
294  ObjectState* root = new ObjectState(MDF);
296 
297  // Test for global attributes.
298  if (machineState->hasAttribute(
299  Machine::OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS) &&
300  machineState->boolAttribute(
301  Machine::OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS)) {
303  }
304  if (machineState->hasAttribute(Machine::OSKEY_ALWAYS_WRITE_BACK_RESULTS) &&
305  machineState->boolAttribute(Machine::OSKEY_ALWAYS_WRITE_BACK_RESULTS)) {
307  }
308  if (machineState->hasAttribute(Machine::OSKEY_FUNCTION_UNITS_ORDERED) &&
309  machineState->boolAttribute(Machine::OSKEY_FUNCTION_UNITS_ORDERED)) {
311  }
312  if (machineState->hasAttribute(LITTLE_ENDIAN_MACHINE) &&
313  machineState->boolAttribute(LITTLE_ENDIAN_MACHINE)) {
315  }
316 
317  if (machineState->hasAttribute(BITNESS64) &&
318  machineState->boolAttribute(BITNESS64)) {
319  root->addChild(new ObjectState(BITNESS64));
320  }
321 
322  // add buses
323  for (int i = 0; i < machineState->childCount(); i++) {
324  ObjectState* child = machineState->child(i);
325  if (child->name() == Bus::OSNAME_BUS) {
326  root->addChild(busToMDF(child));
327  }
328  }
329 
330  // add sockets
331  for (int i = 0; i < machineState->childCount(); i++) {
332  ObjectState* child = machineState->child(i);
333  if (child->name() == Socket::OSNAME_SOCKET) {
334  root->addChild(socketToMDF(child));
335  }
336  }
337 
338  // add bridges
339  for (int i = 0; i < machineState->childCount(); i++) {
340  ObjectState* child = machineState->child(i);
341  if (child->name() == Bridge::OSNAME_BRIDGE) {
342  root->addChild(bridgeToMDF(child));
343  }
344  }
345 
346  // add function units
347  for (int i = 0; i < machineState->childCount(); i++) {
348  ObjectState* child = machineState->child(i);
349  if (child->name() == FunctionUnit::OSNAME_FU) {
350  root->addChild(functionUnitToMDF(child));
351  }
352  }
353 
354  // add register files
355  for (int i = 0; i < machineState->childCount(); i++) {
356  ObjectState* child = machineState->child(i);
357  if (child->name() == RegisterFile::OSNAME_REGISTER_FILE) {
358  root->addChild(registerFileToMDF(child));
359  }
360  }
361 
362  // add address spaces
363  for (int i = 0; i < machineState->childCount(); i++) {
364  ObjectState* child = machineState->child(i);
365  if (child->name() == AddressSpace::OSNAME_ADDRESS_SPACE) {
366  root->addChild(addressSpaceToMDF(child));
367  }
368  }
369 
370  // add control unit
371  for (int i = 0; i < machineState->childCount(); i++) {
372  ObjectState* child = machineState->child(i);
373  if (child->name() == ControlUnit::OSNAME_CONTROL_UNIT) {
374  root->addChild(controlUnitToMDF(child));
375  }
376  }
377 
378  // add immediate units
379  for (int i = 0; i < machineState->childCount(); i++) {
380  ObjectState* child = machineState->child(i);
381  if (child->name() == ImmediateUnit::OSNAME_IMMEDIATE_UNIT) {
382  root->addChild(immediateUnitToMDF(child, machineState));
383  }
384  }
385 
386  // add immediate slots
387  for (int i = 0; i < machineState->childCount(); i++) {
388  ObjectState* child = machineState->child(i);
389  if (child->name() == ImmediateSlot::OSNAME_IMMEDIATE_SLOT) {
390  root->addChild(immediateSlotToMDF(child));
391  }
392  }
393 
394  // Add operation triggered formats
395  for (int i = 0; i < machineState->childCount(); i++) {
396  ObjectState* child = machineState->child(i);
397  if (child->name() == OperationTriggeredFormat::OSNAME_FORMAT) {
398  ObjectState* newChild = new ObjectState(*child);
399  root->addChild(newChild);
400  }
401  }
402 
403  return root;
404 }

References ObjectState::addChild(), addressSpaceToMDF(), ALWAYS_WRITE_BACK_RESULTS, BITNESS64, ObjectState::boolAttribute(), bridgeToMDF(), busToMDF(), ObjectState::child(), ObjectState::childCount(), controlUnitToMDF(), FUNCTION_UNITS_ORDERED, functionUnitToMDF(), ObjectState::hasAttribute(), immediateSlotToMDF(), immediateUnitToMDF(), LITTLE_ENDIAN_MACHINE, MDF, MDF_VERSION, MDF_VERSION_NUMBER, ObjectState::name(), registerFileToMDF(), ObjectState::setAttribute(), socketToMDF(), and TRIGGER_INVALIDATES_OLD_RESULTS.

Referenced by writeState().

Here is the call graph for this function:

◆ functionUnitToMachine()

ObjectState * ADFSerializer::functionUnitToMachine ( const ObjectState fuState,
const int  orderNumber 
)
staticprivate

Creates a new ObjectState tree which can be read by FunctionUnit::loadState.

The ObjectState tree is created according to the given ObjectState tree which matches with the syntax of function unit declaration in MDF file.

Parameters
fuStateThe ObjectState tree which matches with the syntax of function unit declaration in MDF file.
orderNumberThe number indicating sequential position of the FU in the ADF.
Returns
The newly created ObjectState tree.

Definition at line 1260 of file ADFSerializer.cc.

1262  {
1263 
1264  ObjectState* fu = new ObjectState(FunctionUnit::OSNAME_FU);
1265 
1266  // set name
1267  fu->setAttribute(
1268  Component::OSKEY_NAME, fuState->stringAttribute(FU_NAME));
1269  // each FU has own value of ordering
1270  fu->setAttribute(FunctionUnit::OSKEY_ORDER_NUMBER, orderNumber);
1271  // set address space
1272  ObjectState* as = fuState->childByName(FU_ADDRESS_SPACE);
1273  string asName = as->stringValue();
1274  if (asName != "") {
1275  fu->setAttribute(FunctionUnit::OSKEY_AS, asName);
1276  }
1277 
1278  // set ports and operations
1279  for (int i = 0; i < fuState->childCount(); i++) {
1280  ObjectState* child = fuState->child(i);
1281  if (child->name() == PORT) {
1282  fu->addChild(machineFUPort(child));
1283  } else if (child->name() == FU_OPERATION) {
1284  fu->addChild(machineOperation(child));
1285  }
1286  }
1287 
1288  return fu;
1289 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FU_ADDRESS_SPACE, FU_NAME, FU_OPERATION, machineFUPort(), machineOperation(), ObjectState::name(), PORT, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ functionUnitToMDF()

ObjectState * ADFSerializer::functionUnitToMDF ( const ObjectState fuState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by FunctionUnit::saveState.

Parameters
fuStateRoot node of the ObjectState tree created by FunctionUnit::saveState.
Returns
The newly created ObjectState tree.

Definition at line 629 of file ADFSerializer.cc.

629  {
630 
632  fu->setAttribute(
633  FU_NAME, fuState->stringAttribute(FunctionUnit::OSKEY_NAME));
634 
635  // add ports and operations
636  for (int i = 0; i < fuState->childCount(); i++) {
637  ObjectState* child = fuState->child(i);
638  if (child->name() == FUPort::OSNAME_FUPORT) {
639  fu->addChild(mdfFUPort(child));
640  } else if (child->name() == HWOperation::OSNAME_OPERATION) {
641  fu->addChild(mdfOperation(child));
642  }
643  }
644 
645  // add address space
646  ObjectState* addressSpace = new ObjectState(FU_ADDRESS_SPACE);
647  fu->addChild(addressSpace);
648 
649  // set address space name if it exists
650  if (fuState->hasAttribute(FunctionUnit::OSKEY_AS)) {
651  addressSpace->setValue(
652  fuState->stringAttribute(FunctionUnit::OSKEY_AS));
653  }
654 
655  return fu;
656 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childCount(), FU_ADDRESS_SPACE, FU_NAME, FUNCTION_UNIT, ObjectState::hasAttribute(), mdfFUPort(), mdfOperation(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ hasEmptyInstructionTemplate()

bool ADFSerializer::hasEmptyInstructionTemplate ( const ObjectState momMachineState)
staticprivate

Checks whether the machine represented by the given ObjectState tree contains an empty instruction template.

Parameters
momMachineStateThe ObjectState tree.
Returns
True if it contains an empty instruction template, otherwise false.

Definition at line 2332 of file ADFSerializer.cc.

2333  {
2334 
2335  for (int i = 0; i < momMachineState->childCount(); i++) {
2336  ObjectState* child = momMachineState->child(i);
2337  if (child->name() ==
2338  InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE &&
2339  child->childCount() == 0) {
2340  return true;
2341  }
2342  }
2343 
2344  return false;
2345 }

References ObjectState::child(), ObjectState::childCount(), and ObjectState::name().

Referenced by immediateUnitToMachine().

Here is the call graph for this function:

◆ immediateSlotToMachine()

ObjectState * ADFSerializer::immediateSlotToMachine ( const ObjectState isState)
staticprivate

Creates an ObjectState instance that can be loaded by ImmediateSlot instance.

Parameters
isStateAn ObjectState instance that represents an immediate-slot element of ADF file.
Returns
The newly created ObjectState instance.

Definition at line 1636 of file ADFSerializer.cc.

1636  {
1637  ObjectState* immediateSlot = new ObjectState(
1638  ImmediateSlot::OSNAME_IMMEDIATE_SLOT);
1639  immediateSlot->setAttribute(
1640  ImmediateSlot::OSKEY_NAME,
1642  return immediateSlot;
1643 }

References IMMEDIATE_SLOT_NAME, ObjectState::setAttribute(), and ObjectState::stringAttribute().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ immediateSlotToMDF()

ObjectState * ADFSerializer::immediateSlotToMDF ( const ObjectState isState)
staticprivate

Creates a new ObjectState instance that matches with the syntax of immediate-slot element in ADF file.

Parameters
isStateObjectState instance representing ImmediateSlot instance.
Returns
The newly created ObjectState instance.

Definition at line 976 of file ADFSerializer.cc.

976  {
977  ObjectState* immediateSlot = new ObjectState(IMMEDIATE_SLOT);
978  immediateSlot->setAttribute(
980  isState->stringAttribute(ImmediateSlot::OSKEY_NAME));
981  return immediateSlot;
982 }

References IMMEDIATE_SLOT, IMMEDIATE_SLOT_NAME, ObjectState::setAttribute(), and ObjectState::stringAttribute().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ immediateUnitToMachine()

ObjectState * ADFSerializer::immediateUnitToMachine ( const ObjectState iuState,
ObjectState machineState 
)
staticprivate

Creates a new ObjectState tree which can be read by ImmediateUnit::loadState.

The ObjectState tree is created according to the given ObjectState tree which matches with the syntax of immediate unit declaration in MDF file. Adds also instruction template ObjectStates to the given ObjectState tree which contains the whole machine.

Parameters
iuStateThe ObjectState tree which matches with the syntax of immediate unit declaration in MDF file.
machineStateThe ObjectState tree containing tree instruction templates as child objects.
Returns
The newly created ObjectState tree.
Exceptions
SerializerExceptionIf an error occurs while processing.

Definition at line 1517 of file ADFSerializer.cc.

1518  {
1519  ObjectState* iu = new ObjectState(ImmediateUnit::OSNAME_IMMEDIATE_UNIT);
1520 
1521  // set name
1522  iu->setAttribute(
1523  Component::OSKEY_NAME, iuState->stringAttribute(IU_NAME));
1524 
1525  // set type
1526  ObjectState* typeChild = iuState->childByName(IU_TYPE);
1527  string type = typeChild->stringValue();
1528  if (type == IU_TYPE_NORMAL) {
1529  iu->setAttribute(
1530  ImmediateUnit::OSKEY_TYPE, ImmediateUnit::OSVALUE_NORMAL);
1531  } else if (type == IU_TYPE_RESERVED) {
1532  iu->setAttribute(
1533  ImmediateUnit::OSKEY_TYPE, ImmediateUnit::OSVALUE_RESERVED);
1534  } else if (type == IU_TYPE_VOLATILE) {
1535  iu->setAttribute(
1536  ImmediateUnit::OSKEY_TYPE, ImmediateUnit::OSVALUE_VOLATILE);
1537  } else {
1538  string procName = "ADFSerializer::registerFileToMachine";
1539  string errorMsg = "Unknown register file type in ObjectState "
1540  "instance.";
1541  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
1543  }
1544 
1545  // set size
1546  ObjectState* size = iuState->childByName(IU_SIZE);
1547  iu->setAttribute(BaseRegisterFile::OSKEY_SIZE, size->stringValue());
1548 
1549  // set width
1550  ObjectState* width = iuState->childByName(IU_WIDTH);
1551  iu->setAttribute(BaseRegisterFile::OSKEY_WIDTH, width->stringValue());
1552 
1553  // set max reads
1554  ObjectState* maxReads = iuState->childByName(IU_MAX_READS);
1555  iu->setAttribute(
1556  ImmediateUnit::OSKEY_MAX_READS, maxReads->stringValue());
1557 
1558  // set max writes
1559  ObjectState* maxWrites = iuState->childByName(IU_MAX_WRITES);
1560  iu->setAttribute(
1561  ImmediateUnit::OSKEY_MAX_WRITES, maxWrites->stringValue());
1562 
1563  // set guard latency
1564  if (iuState->hasChild(IU_GUARD_LATENCY)) {
1565  ObjectState* guardLatencyChild =
1566  iuState->childByName(IU_GUARD_LATENCY);
1567  iu->setAttribute(
1568  ImmediateUnit::OSKEY_GUARD_LATENCY,
1569  guardLatencyChild->stringValue());
1570  } else {
1571  iu->setAttribute(ImmediateUnit::OSKEY_GUARD_LATENCY, 0);
1572  }
1573 
1574  // set read latency
1575  if (iuState->hasChild(IU_LATENCY)) {
1576  ObjectState* readLatencyChild = iuState->childByName(IU_LATENCY);
1577  iu->setAttribute(
1578  ImmediateUnit::OSKEY_LATENCY, readLatencyChild->stringValue());
1579  } else {
1580  iu->setAttribute(ImmediateUnit::OSKEY_LATENCY, 1);
1581  }
1582 
1583  setIUExtensionMode(iuState, iu);
1584 
1585  // set ports and instruction templates
1586  for (int i = 0; i < iuState->childCount(); i++) {
1587  ObjectState* child = iuState->child(i);
1588  if (child->name() == PORT) {
1589  iu->addChild(machineRFPort(child));
1590  } else if (child->name() == IU_TEMPLATE) {
1591  try {
1593  child, machineState, iuState->stringAttribute(IU_NAME));
1594  } catch (const SerializerException&) {
1595  delete iu;
1596  throw;
1597  }
1598  }
1599  }
1600 
1601  // if machine has an empty instruction template, it must be found in the
1602  // immediate unit declaration
1603  if (hasEmptyInstructionTemplate(machineState)) {
1604  bool emptyFound = false;
1605  for (int i = 0; i < iuState->childCount(); i++) {
1606  ObjectState* child = iuState->child(i);
1607  if (child->name() == IU_TEMPLATE && child->childCount() == 0) {
1608  emptyFound = true;
1609  break;
1610  }
1611  }
1612  if (!emptyFound) {
1613  delete iu;
1615  format errorMsg = textGen.text(
1617  errorMsg % iuState->stringAttribute(IU_NAME);
1618  string procName = "ADFSerializer::immediateUnitToMachine";
1619  throw SerializerException(
1620  __FILE__, __LINE__, procName, errorMsg.str());
1621  }
1622  }
1623 
1624  return iu;
1625 }

References Application::abortProgram(), ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), hasEmptyInstructionTemplate(), instructionTemplateToMachine(), IU_GUARD_LATENCY, IU_LATENCY, IU_MAX_READS, IU_MAX_WRITES, IU_NAME, IU_SIZE, IU_TEMPLATE, IU_TYPE, IU_TYPE_NORMAL, IU_TYPE_RESERVED, IU_TYPE_VOLATILE, IU_WIDTH, machineRFPort(), ObjectState::name(), PORT, ObjectState::setAttribute(), setIUExtensionMode(), ObjectState::stringAttribute(), ObjectState::stringValue(), Texts::TextGenerator::text(), ADFSerializerTextGenerator::TXT_EMPTY_IT_NOT_DECLARED, and Application::writeToErrorLog().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ immediateUnitToMDF()

ObjectState * ADFSerializer::immediateUnitToMDF ( const ObjectState iuState,
const ObjectState machineState 
)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by ImmediateUnit::saveState. The whole ObjectState tree created by Machine::saveState must be given too because instruction templates are needed too to create the new ObjectState tree.

Parameters
iuStateRoot node of the ObjectState tree created by ImmediateUnit::saveState.
machineStateThe ObjectState tree created by Machine::saveState.
Returns
The newly created ObjectState tree.

Definition at line 751 of file ADFSerializer.cc.

752  {
753 
754  ObjectState* iUnit = new ObjectState(IMMEDIATE_UNIT);
755  string iuName = iuState->stringAttribute(ImmediateUnit::OSKEY_NAME);
756  iUnit->setAttribute(IU_NAME, iuName);
757 
758  // type
759  ObjectState* type = new ObjectState(IU_TYPE);
760  iUnit->addChild(type);
761  string typeValue = iuState->stringAttribute(RegisterFile::OSKEY_TYPE);
762  if (typeValue == ImmediateUnit::OSVALUE_NORMAL) {
763  type->setValue(IU_TYPE_NORMAL);
764  } else if (typeValue == ImmediateUnit::OSVALUE_RESERVED) {
765  type->setValue(IU_TYPE_RESERVED);
766  } else if (typeValue == ImmediateUnit::OSVALUE_VOLATILE) {
767  type->setValue(IU_TYPE_VOLATILE);
768  } else {
769  string procName = "ADFSerializer::immediateUnitToMDF";
770  string errorMsg = "Unknown immediate unit type in ObjectState "
771  "instance.";
772  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
774  }
775 
776  // add size element
777  ObjectState* size = new ObjectState(IU_SIZE);
778  iUnit->addChild(size);
779  size->setValue(iuState->stringAttribute(ImmediateUnit::OSKEY_SIZE));
780 
781  // add width element
782  ObjectState* width = new ObjectState(IU_WIDTH);
783  iUnit->addChild(width);
784  width->setValue(iuState->stringAttribute(ImmediateUnit::OSKEY_WIDTH));
785 
786  // add max reads
787  ObjectState* maxReads = new ObjectState(RF_MAX_READS);
788  iUnit->addChild(maxReads);
789  maxReads->setValue(
790  iuState->stringAttribute(RegisterFile::OSKEY_MAX_READS));
791 
792  // add max writes
793  ObjectState* maxWrites = new ObjectState(IU_MAX_WRITES);
794  iUnit->addChild(maxWrites);
795  maxWrites->setValue(
796  iuState->stringAttribute(RegisterFile::OSKEY_MAX_WRITES));
797 
798  // add guard latency
799  if (iuState->intAttribute(ImmediateUnit::OSKEY_GUARD_LATENCY) > 0) {
800  ObjectState* guardLatency = new ObjectState(IU_GUARD_LATENCY);
801  iUnit->addChild(guardLatency);
802  guardLatency->setValue(
803  iuState->stringAttribute(ImmediateUnit::OSKEY_GUARD_LATENCY));
804  }
805 
806  // add read latency element
807  ObjectState* readLatency = new ObjectState(IU_LATENCY);
808  iUnit->addChild(readLatency);
809  readLatency->setValue(
810  iuState->stringAttribute(ImmediateUnit::OSKEY_LATENCY));
811 
812  // add extension element
813  ObjectState* extension = new ObjectState(IU_EXTENSION);
814  iUnit->addChild(extension);
815  extension->setValue(
816  iuState->stringAttribute(ImmediateUnit::OSKEY_EXTENSION));
817 
818  // add ports
819  for (int i = 0; i < iuState->childCount(); i++) {
820  ObjectState* child = iuState->child(i);
821  if (child->name() == RFPort::OSNAME_RFPORT) {
822  iUnit->addChild(mdfPort(child));
823  }
824  }
825 
826  // add instruction templates
827  for (int iTempIndex = 0; iTempIndex < machineState->childCount();
828  iTempIndex++) {
829  ObjectState* iTemp = machineState->child(iTempIndex);
830  if (iTemp->name() ==
831  InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE) {
832  instructionTemplateToMDF(iTemp, iUnit);
833  }
834  }
835 
836  return iUnit;
837 }

References Application::abortProgram(), ObjectState::addChild(), ObjectState::child(), ObjectState::childCount(), IMMEDIATE_UNIT, instructionTemplateToMDF(), ObjectState::intAttribute(), IU_EXTENSION, IU_GUARD_LATENCY, IU_LATENCY, IU_MAX_WRITES, IU_NAME, IU_SIZE, IU_TYPE, IU_TYPE_NORMAL, IU_TYPE_RESERVED, IU_TYPE_VOLATILE, IU_WIDTH, mdfPort(), ObjectState::name(), RF_MAX_READS, ObjectState::setAttribute(), ObjectState::setValue(), ObjectState::stringAttribute(), and Application::writeToErrorLog().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ instructionTemplateToMachine()

void ADFSerializer::instructionTemplateToMachine ( const ObjectState mdfITState,
ObjectState momMachineState,
const std::string &  iuName = std::string("") 
)
staticprivate

Adds/modifies instruction templates to the given ObjectState instance representing machine in machine object model format.

Instruction templates are read from the given ObjectState instance representing a template element inside immediate unit declaration of mdf.

Parameters
mdfITStateObjectState instance representing a template element.
momMachineStateObjectState instance representing a machine in machine object model format.
iuNameName of the immediate unit which contains the template element.
Exceptions
SerializerExceptionIf an error is occurred while processing.

Definition at line 2215 of file ADFSerializer.cc.

2217  {
2218  const string procName = "ADFSerializer::instructionTemplateToMachine";
2219 
2220  string templateName = mdfITState->stringAttribute(IU_TEMPLATE_NAME);
2221  ObjectState* iTemp = NULL;
2222  bool iTempFound = false;
2223 
2224  for (int iTempIndex = 0; iTempIndex < momMachineState->childCount();
2225  iTempIndex++) {
2226  iTemp = momMachineState->child(iTempIndex);
2227  if (iTemp->name() ==
2228  InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE &&
2229  iTemp->stringAttribute(Component::OSKEY_NAME) ==
2230  templateName) {
2231  iTempFound = true;
2232  break;
2233  }
2234  }
2235 
2236  if (!iTempFound) {
2237  iTemp = new ObjectState(
2238  InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE);
2239  momMachineState->addChild(iTemp);
2240  iTemp->setAttribute(Component::OSKEY_NAME, templateName);
2241  }
2242 
2244 
2245  if ((mdfITState->childCount() == 0 && iTempFound &&
2246  iTemp->childCount() > 0) ||
2247  (mdfITState->childCount() > 0 && iTempFound &&
2248  iTemp->childCount() == 0)) {
2249  format errorMsg = textGen.text(
2251  errorMsg % templateName;
2252  throw SerializerException(
2253  __FILE__, __LINE__, procName, errorMsg.str());
2254  }
2255 
2256  for (int slotIndex = 0; slotIndex < mdfITState->childCount();
2257  slotIndex++) {
2258  ObjectState* slot = mdfITState->child(slotIndex);
2259  string slotName =
2261  string width =
2263 
2264  ObjectState* iTempSlot = momTemplateSlot(iTemp, slotName);
2265  if (iTempSlot == NULL) {
2266  iTempSlot = new ObjectState(TemplateSlot::OSNAME_TEMPLATE_SLOT);
2267  iTempSlot->setAttribute(TemplateSlot::OSKEY_SLOT, slotName);
2268  iTempSlot->setAttribute(TemplateSlot::OSKEY_WIDTH, width);
2269  iTempSlot->setAttribute(TemplateSlot::OSKEY_DESTINATION, iuName);
2270  iTemp->addChild(iTempSlot);
2271  } else {
2272  format errorMsg;
2273  if (iTempSlot->stringAttribute(TemplateSlot::OSKEY_DESTINATION) ==
2274  iuName) {
2275  errorMsg = textGen.text(
2277  errorMsg % slotName % iuName % templateName;
2278  } else {
2279  errorMsg = textGen.text(
2281  TXT_MULTIPLE_DESTINATIONS_IN_TEMPLATE_SLOT);
2282  errorMsg % slotName % templateName % iuName %
2283  iTempSlot->stringAttribute(
2284  TemplateSlot::OSKEY_DESTINATION);
2285  }
2286  throw SerializerException(
2287  __FILE__, __LINE__, procName, errorMsg.str());
2288  }
2289  }
2290 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), IU_TEMPLATE_NAME, IU_TEMPLATE_SLOT_NAME, IU_TEMPLATE_SLOT_WIDTH, momTemplateSlot(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::stringAttribute(), ObjectState::stringValue(), Texts::TextGenerator::text(), ADFSerializerTextGenerator::TXT_IT_EMPTY_AND_NON_EMPTY, and ADFSerializerTextGenerator::TXT_SAME_TEMPLATE_SLOT.

Referenced by convertToMachineFormat(), and immediateUnitToMachine().

Here is the call graph for this function:

◆ instructionTemplateToMDF()

void ADFSerializer::instructionTemplateToMDF ( const ObjectState momITState,
ObjectState mdfIUState 
)
staticprivate

Includes the given instruction template information to ObjectState tree representing immediate unit in mdf format.

Parameters
momITStateObjectState instance representing an instruction template in machine object model format.
mdfIUStateObjectState instance representing an immediate unit in mdf format.

Definition at line 2149 of file ADFSerializer.cc.

2151  {
2152 
2153  string iuName = mdfIUState->stringAttribute(IU_NAME);
2154  string iTempName = momITState->stringAttribute(Component::OSKEY_NAME);
2155  for (int slotIndex = 0; slotIndex < momITState->childCount();
2156  slotIndex++) {
2157  ObjectState* slot = momITState->child(slotIndex);
2158  if (slot->stringAttribute(TemplateSlot::OSKEY_DESTINATION) ==
2159  iuName) {
2160  ObjectState* correctTemplate = NULL;
2161 
2162  for (int iuChildIndex = 0;
2163  iuChildIndex < mdfIUState->childCount(); iuChildIndex++) {
2164  ObjectState* iuChild = mdfIUState->child(iuChildIndex);
2165  if (iuChild->name() == IU_TEMPLATE &&
2166  iuChild->stringAttribute(IU_TEMPLATE_NAME) == iTempName) {
2167  correctTemplate = iuChild;
2168  }
2169  }
2170 
2171  if (correctTemplate == NULL) {
2172  correctTemplate = new ObjectState(IU_TEMPLATE);
2173  mdfIUState->addChild(correctTemplate);
2174  correctTemplate->setAttribute(IU_TEMPLATE_NAME, iTempName);
2175  }
2176 
2177  ObjectState* slotElem = new ObjectState(IU_TEMPLATE_SLOT);
2178  correctTemplate->addChild(slotElem);
2180  slotElem->addChild(nameElem);
2181  nameElem->setValue(
2182  slot->stringAttribute(TemplateSlot::OSKEY_SLOT));
2184  slotElem->addChild(widthElem);
2185  widthElem->setValue(
2186  slot->stringAttribute(TemplateSlot::OSKEY_WIDTH));
2187  }
2188  }
2189 
2190 
2191  if (momITState->childCount() == 0) {
2192  ObjectState* emptyTemplate = new ObjectState(IU_TEMPLATE);
2193  mdfIUState->addChild(emptyTemplate);
2194  emptyTemplate->setAttribute(IU_TEMPLATE_NAME, iTempName);
2195  }
2196 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childCount(), IU_NAME, IU_TEMPLATE, IU_TEMPLATE_NAME, IU_TEMPLATE_SLOT, IU_TEMPLATE_SLOT_NAME, IU_TEMPLATE_SLOT_WIDTH, ObjectState::name(), ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by immediateUnitToMDF().

Here is the call graph for this function:

◆ machineFUPort()

ObjectState * ADFSerializer::machineFUPort ( const ObjectState mdfFUPortState)
staticprivate

Creates an ObjectState instance that represent a function unit port in machine object model format.

The ObjectState instance is created according to the given ObjectState instance that represents a function unit port in mdf format. The given instance must have an attribute called 'name' and up to two 'connects-to' children. It has also 'width' child and may also have 'triggers' and 'setsOpcode' children.

Parameters
mdfFUPortStateObjectState instance representing a function port in mdf format.
Returns
The newly created ObjectState instance representing a function unit port in machine object model format.

Definition at line 1863 of file ADFSerializer.cc.

1863  {
1864 
1865  ObjectState* fuPort = new ObjectState(FUPort::OSNAME_FUPORT);
1866  fuPort->setAttribute(Port::OSKEY_NAME, mdfFUPortState->stringAttribute(
1867  PORT_NAME));
1868 
1869  // set socket connections
1870  for (int i = 0; i < mdfFUPortState->childCount(); i++) {
1871  ObjectState* portChild = mdfFUPortState->child(i);
1872  if (portChild->name() == PORT_CONNECTS_TO) {
1873  if (!fuPort->hasAttribute(Port::OSKEY_FIRST_SOCKET)) {
1874  fuPort->setAttribute(
1875  Port::OSKEY_FIRST_SOCKET, portChild->stringValue());
1876  } else {
1877  fuPort->setAttribute(
1878  Port::OSKEY_SECOND_SOCKET, portChild->stringValue());
1879  }
1880  }
1881  }
1882 
1883  // set other attributes
1884  ObjectState* width = mdfFUPortState->childByName(FU_PORT_WIDTH);
1885  fuPort->setAttribute(FUPort::OSKEY_WIDTH, width->stringValue());
1886  fuPort->setAttribute(
1887  FUPort::OSKEY_TRIGGERING, mdfFUPortState->hasChild(
1888  FU_PORT_TRIGGERS));
1889  fuPort->setAttribute(
1890  FUPort::OSKEY_OPCODE_SETTING, mdfFUPortState->hasChild(
1892  fuPort->setAttribute(
1893  FUPort::OSKEY_NO_REGISTER, mdfFUPortState->hasChild(
1895 
1896  return fuPort;
1897 }

References ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FU_PORT_NO_REGISTER, FU_PORT_SETS_OPCODE, FU_PORT_TRIGGERS, FU_PORT_WIDTH, ObjectState::hasAttribute(), ObjectState::hasChild(), ObjectState::name(), PORT_CONNECTS_TO, PORT_NAME, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by controlUnitToMachine(), and functionUnitToMachine().

Here is the call graph for this function:

◆ machineOperation()

ObjectState * ADFSerializer::machineOperation ( const ObjectState mdfOperationState)
staticprivate

Creates an ObjectState instance that represents an operation in machine object model format.

The ObjectState instance is created according to the given ObjectState instance that represents an operation in mdf format.

Parameters
mdfOperationStateObjectState instance representing an operation in mdf format.
Returns
The newly created ObjectState instance representing an operation in machine object model format.

Definition at line 1949 of file ADFSerializer.cc.

1949  {
1950 
1952  HWOperation::OSNAME_OPERATION);
1954  HWOperation::OSKEY_NAME,
1955  mdfOperationState->childByName(FU_OP_NAME)->stringValue());
1956 
1957  // set operand bindings
1958  for (int i = 0; i < mdfOperationState->childCount(); i++) {
1959  ObjectState* child = mdfOperationState->child(i);
1960  if (child->name() == FU_OP_BIND) {
1961  ObjectState* binding = new ObjectState(
1962  HWOperation::OSNAME_OPERAND_BINDING);
1963  machineOperation->addChild(binding);
1964  binding->setAttribute(
1965  HWOperation::OSKEY_OPERAND,
1967  binding->setAttribute(
1968  HWOperation::OSKEY_PORT, child->stringValue());
1969  }
1970  }
1971 
1972  // set pipeline
1973  ObjectState* mdfPipeline = mdfOperationState->childByName(
1974  FU_OP_PIPELINE);
1976 
1977  return machineOperation;
1978 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FU_OP_BIND, FU_OP_BIND_NAME, FU_OP_NAME, FU_OP_PIPELINE, machinePipeline(), mdfPipeline(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by controlUnitToMachine(), and functionUnitToMachine().

Here is the call graph for this function:

◆ machinePipeline()

ObjectState * ADFSerializer::machinePipeline ( const ObjectState mdfPipelineState)
staticprivate

Creates an ObjectState instance that represents a pipeline in machine object model format.

The ObjectState instance is created according to the given ObjectState instance that represents a pipeline in mdf format.

Parameters
mdfPipelineStateObjectState instance representing a pipeline in mdf format.
Returns
The newly created ObjectState instance representing a pipeline in machine object model format.

Definition at line 2035 of file ADFSerializer.cc.

2035  {
2036 
2038  ExecutionPipeline::OSNAME_PIPELINE);
2039 
2040  for (int i = 0; i < mdfPipelineState->childCount(); i++) {
2041  ObjectState* mdfResource = mdfPipelineState->child(i);
2042  ObjectState* machineResource = NULL;
2043  if (mdfResource->name() == FU_OP_PL_RESOURCE) {
2044  machineResource = new ObjectState(
2045  ExecutionPipeline::OSNAME_RESOURCE_USAGE);
2046  machineResource->setAttribute(
2047  ExecutionPipeline::OSKEY_RESOURCE_NAME,
2048  mdfResource->stringAttribute(FU_OP_PL_RES_NAME));
2049  } else if (mdfResource->name() == FU_OP_PL_READS) {
2050  machineResource = new ObjectState(
2051  ExecutionPipeline::OSNAME_OPERAND_READ);
2052  machineResource->setAttribute(
2053  ExecutionPipeline::OSKEY_OPERAND,
2054  mdfResource->stringAttribute(FU_OP_PL_READS_NAME));
2055  } else if (mdfResource->name() == FU_OP_PL_WRITES) {
2056  machineResource = new ObjectState(
2057  ExecutionPipeline::OSNAME_OPERAND_WRITE);
2058  machineResource->setAttribute(
2059  ExecutionPipeline::OSKEY_OPERAND,
2060  mdfResource->stringAttribute(FU_OP_PL_WRITES_NAME));
2061  } else {
2062  const string procName = "ADFSerializer::machinePipeline";
2063  const string errorMsg = "Given pipeline model is invalid.";
2065  __FILE__, __LINE__, procName, errorMsg);
2067  }
2068 
2069  machinePipeline->addChild(machineResource);
2070  machineResource->setAttribute(
2071  ExecutionPipeline::OSKEY_START_CYCLE,
2072  mdfResource->childByName(FU_OP_PL_RES_START_CYCLE)->
2073  stringValue());
2074  machineResource->setAttribute(
2075  ExecutionPipeline::OSKEY_CYCLES,
2076  mdfResource->childByName(FU_OP_PL_RES_CYCLES)->stringValue());
2077  }
2078 
2079  return machinePipeline;
2080 }

References Application::abortProgram(), ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FU_OP_PL_READS, FU_OP_PL_READS_NAME, FU_OP_PL_RES_CYCLES, FU_OP_PL_RES_NAME, FU_OP_PL_RES_START_CYCLE, FU_OP_PL_RESOURCE, FU_OP_PL_WRITES, FU_OP_PL_WRITES_NAME, ObjectState::name(), ObjectState::setAttribute(), ObjectState::stringAttribute(), ObjectState::stringValue(), and Application::writeToErrorLog().

Referenced by machineOperation().

Here is the call graph for this function:

◆ machineRFPort()

ObjectState * ADFSerializer::machineRFPort ( const ObjectState mdfPortState)
staticprivate

Creates an ObjectState instance that represents a register file port in machine object model format.

The ObjectState instance is created according to the given ObjectState instance that represents a port in mdf format. The given instance must have an attribute called 'name' and up to two 'connects-to' children.

Parameters
mdfPortStateObjectState instance representing a normal port in mdf format.
Returns
The newly created ObjectState instance representing a normal port in machine object model format.

Definition at line 1792 of file ADFSerializer.cc.

1792  {
1793 
1794  ObjectState* port = new ObjectState(RFPort::OSNAME_RFPORT);
1795  port->setAttribute(
1796  RFPort::OSKEY_NAME, mdfPortState->stringAttribute(PORT_NAME));
1797 
1798  for (int i = 0; i < mdfPortState->childCount(); i++) {
1799  ObjectState* conn = mdfPortState->child(i);
1800  if (i == 0) {
1801  port->setAttribute(
1802  Port::OSKEY_FIRST_SOCKET, conn->stringValue());
1803  } else {
1804  port->setAttribute(
1805  Port::OSKEY_SECOND_SOCKET, conn->stringValue());
1806  }
1807  }
1808 
1809  return port;
1810 }

References ObjectState::child(), ObjectState::childCount(), PORT_NAME, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by immediateUnitToMachine(), and registerFileToMachine().

Here is the call graph for this function:

◆ machineSRPort()

ObjectState * ADFSerializer::machineSRPort ( const ObjectState mdfSRPortState)
staticprivate

Creates an ObjectState instance that represents a special register port in machine object model format.

The ObjectState instance is created according to the given ObjectState instance that represents a special register port in mdf format.

Parameters
mdfSRPortStateObjectState instance representing a special register port in mdf format.
Returns
The newly created ObjectState instance representing a special register port in machine object model format.

Definition at line 1659 of file ADFSerializer.cc.

1659  {
1660 
1661  assert(mdfSRPortState->name() == CU_SPECIAL_PORT);
1662  ObjectState* machPort =
1663  new ObjectState(SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT);
1664  machPort->setAttribute(
1665  SpecialRegisterPort::OSKEY_NAME,
1666  mdfSRPortState->stringAttribute(PORT_NAME));
1667 
1668  ObjectState* width = mdfSRPortState->childByName(FU_PORT_WIDTH);
1669  machPort->setAttribute(
1670  SpecialRegisterPort::OSKEY_WIDTH, width->stringValue());
1671 
1672  int connIndex = 0;
1673  for (int i = 0; i < mdfSRPortState->childCount(); i++) {
1674  ObjectState* child = mdfSRPortState->child(i);
1675  if (child->name() == PORT_CONNECTS_TO) {
1676  connIndex++;
1677  if (connIndex == 1) {
1678  machPort->setAttribute(
1679  Port::OSKEY_FIRST_SOCKET, child->stringValue());
1680  } else if (connIndex == 2) {
1681  machPort->setAttribute(
1682  Port::OSKEY_SECOND_SOCKET, child->stringValue());
1683  } else {
1684  string procName = "ADFSerializer::machineSRPort";
1685  string errorMsg = "Too many connects-to elements in SR "
1686  "port.";
1688  __FILE__, __LINE__, procName, errorMsg);
1690  }
1691  }
1692  }
1693 
1694  return machPort;
1695 }

References Application::abortProgram(), assert, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), CU_SPECIAL_PORT, FU_PORT_WIDTH, ObjectState::name(), PORT_CONNECTS_TO, PORT_NAME, ObjectState::setAttribute(), ObjectState::stringAttribute(), ObjectState::stringValue(), and Application::writeToErrorLog().

Referenced by controlUnitToMachine().

Here is the call graph for this function:

◆ mdfFUPort()

ObjectState * ADFSerializer::mdfFUPort ( const ObjectState machineFUPortState)
staticprivate

Creates an ObjectState instance that represents a function unit port in mdf format.

The ObjectState instance is created according to the given ObjectState instance that represents a function unit port in machine object model format.

Parameters
machineFUPortStateObjectState instance representing a function unit port in machine object model format.
Returns
The newly created ObjectState instance representing a function unit port in mdf format.

Definition at line 1914 of file ADFSerializer.cc.

1914  {
1915 
1916  ObjectState* mdfFUPort = mdfPort(machineFUPortState);
1917  ObjectState* width = new ObjectState(FU_PORT_WIDTH);
1918  width->setValue(machineFUPortState->stringAttribute(
1919  FUPort::OSKEY_WIDTH));
1920  mdfFUPort->addChild(width);
1921  if (machineFUPortState->intAttribute(FUPort::OSKEY_TRIGGERING)) {
1923  }
1924  if (machineFUPortState->intAttribute(FUPort::OSKEY_OPCODE_SETTING)) {
1926  }
1927 
1928  if (machineFUPortState->intAttribute(FUPort::OSKEY_NO_REGISTER)) {
1930  }
1931 
1932  return mdfFUPort;
1933 }

References ObjectState::addChild(), FU_PORT_NO_REGISTER, FU_PORT_SETS_OPCODE, FU_PORT_TRIGGERS, FU_PORT_WIDTH, ObjectState::intAttribute(), mdfPort(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by controlUnitToMDF(), and functionUnitToMDF().

Here is the call graph for this function:

◆ mdfOperation()

ObjectState * ADFSerializer::mdfOperation ( const ObjectState machineOperationState)
staticprivate

Creates an ObjectState instance that represents an operation in mdf format.

The ObjectState instance is created according to the given ObjectState instance that represents an operation in machine object model format.

Parameters
machineOperationStateObjectState instance representing an operation in machine object model format.
Returns
The newly created ObjectState instance representing an operation in mdf format.

Definition at line 1994 of file ADFSerializer.cc.

1994  {
1995 
1997  ObjectState* name = new ObjectState(FU_OP_NAME);
1998  mdfOperation->addChild(name);
1999  name->setValue(machineOperationState->stringAttribute(
2000  HWOperation::OSKEY_NAME));
2001 
2002  // add bind elements
2003  for (int i = 0; i < machineOperationState->childCount(); i++) {
2004  ObjectState* child = machineOperationState->child(i);
2005  if (child->name() == HWOperation::OSNAME_OPERAND_BINDING) {
2006  ObjectState* bind = new ObjectState(FU_OP_BIND);
2007  mdfOperation->addChild(bind);
2008  bind->setAttribute(
2010  HWOperation::OSKEY_OPERAND));
2011  bind->setValue(child->stringAttribute(HWOperation::OSKEY_PORT));
2012  }
2013  }
2014 
2015  ObjectState* machPipeline = machineOperationState->childByName(
2016  ExecutionPipeline::OSNAME_PIPELINE);
2017  mdfOperation->addChild(mdfPipeline(machPipeline));
2018  return mdfOperation;
2019 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FU_OP_BIND, FU_OP_BIND_NAME, FU_OP_NAME, FU_OPERATION, mdfPipeline(), ObjectState::name(), ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by controlUnitToMDF(), and functionUnitToMDF().

Here is the call graph for this function:

◆ mdfPipeline()

ObjectState * ADFSerializer::mdfPipeline ( const ObjectState machinePipelineState)
staticprivate

Creates an ObjectState instance that represents a pipeline in mdf format.

The ObjectState instance is created according to the given ObjectState instance that represents a pipeline in machine object model format.

Parameters
machinePipelineStateObjectState instance representing a pipeline in machine object model format.
Returns
The newly created ObjectState instance representing a pipeline in mdf format.

Definition at line 2095 of file ADFSerializer.cc.

2095  {
2096 
2098 
2099  for (int i = 0; i < machinePipelineState->childCount(); i++) {
2100  ObjectState* resChild = machinePipelineState->child(i);
2101  ObjectState* mdfChild = NULL;
2102  if (resChild->name() == ExecutionPipeline::OSNAME_RESOURCE_USAGE) {
2103  mdfChild = new ObjectState(FU_OP_PL_RESOURCE);
2104  mdfChild->setAttribute(
2106  resChild->stringAttribute(
2107  ExecutionPipeline::OSKEY_RESOURCE_NAME));
2108  } else if (resChild->name() ==
2109  ExecutionPipeline::OSNAME_OPERAND_READ) {
2110  mdfChild = new ObjectState(FU_OP_PL_READS);
2111  mdfChild->setAttribute(
2113  resChild->stringAttribute(ExecutionPipeline::OSKEY_OPERAND));
2114  } else if (resChild->name() ==
2115  ExecutionPipeline::OSNAME_OPERAND_WRITE) {
2116  mdfChild = new ObjectState(FU_OP_PL_WRITES);
2117  mdfChild->setAttribute(
2119  resChild->stringAttribute(ExecutionPipeline::OSKEY_OPERAND));
2120  } else {
2121  assert(false);
2122  }
2123 
2124  mdfPipeline->addChild(mdfChild);
2126  mdfChild->addChild(startCycle);
2127  startCycle->setValue(
2128  resChild->stringAttribute(ExecutionPipeline::OSKEY_START_CYCLE));
2130  mdfChild->addChild(cycles);
2131  cycles->setValue(
2132  resChild->stringAttribute(ExecutionPipeline::OSKEY_CYCLES));
2133  }
2134 
2135  return mdfPipeline;
2136 }

References ObjectState::addChild(), assert, ObjectState::child(), ObjectState::childCount(), FU_OP_PIPELINE, FU_OP_PL_READS, FU_OP_PL_READS_NAME, FU_OP_PL_RES_CYCLES, FU_OP_PL_RES_NAME, FU_OP_PL_RES_START_CYCLE, FU_OP_PL_RESOURCE, FU_OP_PL_WRITES, FU_OP_PL_WRITES_NAME, ObjectState::name(), ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by machineOperation(), and mdfOperation().

Here is the call graph for this function:

◆ mdfPort()

ObjectState * ADFSerializer::mdfPort ( const ObjectState machinePortState)
staticprivate

Creates an ObjectState instance that represents a normal port in mdf format.

The ObjectState instance is created according to the given ObjectState instance that represents a port in machine object model format.

Parameters
machinePortStateObjectState instance representing a normal port in machine object model format.
Returns
The newly created ObjectState instance representing a normal port in mdf format.

Definition at line 1826 of file ADFSerializer.cc.

1826  {
1827 
1829  mdfPort->setAttribute(PORT_NAME, machinePortState->stringAttribute(
1830  Port::OSKEY_NAME));
1831  if (machinePortState->hasAttribute(Port::OSKEY_FIRST_SOCKET)) {
1833  mdfPort->addChild(conn);
1834  conn->setValue(machinePortState->stringAttribute(
1835  Port::OSKEY_FIRST_SOCKET));
1836  }
1837  if (machinePortState->hasAttribute(Port::OSKEY_SECOND_SOCKET)) {
1839  mdfPort->addChild(conn);
1840  conn->setValue(machinePortState->stringAttribute(
1841  Port::OSKEY_SECOND_SOCKET));
1842  }
1843  return mdfPort;
1844 }

References ObjectState::addChild(), ObjectState::hasAttribute(), PORT, PORT_CONNECTS_TO, PORT_NAME, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by immediateUnitToMDF(), mdfFUPort(), and registerFileToMDF().

Here is the call graph for this function:

◆ mdfSRPort()

ObjectState * ADFSerializer::mdfSRPort ( const ObjectState machineSRPortState)
staticprivate

Creates an ObjectState instance that represents a special register port in mdf format.

The ObjectState instance is created according to the given ObjectState instance that represents a special register port in machine object model format.

Parameters
machineSRPortStateObjectState instance representing a special register port in machine object model format.
Returns
The newly created ObjectState instance representing a special register port in mdf format.

Definition at line 1712 of file ADFSerializer.cc.

1712  {
1713 
1714  assert(machineSRPortState->name() ==
1715  SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT);
1716 
1718  string name =
1719  machineSRPortState->stringAttribute(SpecialRegisterPort::OSKEY_NAME);
1721 
1722  if (machineSRPortState->hasAttribute(FUPort::OSKEY_FIRST_SOCKET)) {
1724  mdfSRPort->addChild(conn);
1725  conn->setValue(machineSRPortState->stringAttribute(
1726  FUPort::OSKEY_FIRST_SOCKET));
1727  }
1728 
1729  if (machineSRPortState->hasAttribute(FUPort::OSKEY_SECOND_SOCKET)) {
1731  mdfSRPort->addChild(conn);
1732  conn->setValue(machineSRPortState->stringAttribute(
1733  FUPort::OSKEY_SECOND_SOCKET));
1734  }
1735 
1736  ObjectState* width = new ObjectState(FU_PORT_WIDTH);
1737  mdfSRPort->addChild(width);
1738  width->setValue(
1739  machineSRPortState->stringAttribute(
1740  SpecialRegisterPort::OSKEY_WIDTH));
1741 
1742  return mdfSRPort;
1743 }

References ObjectState::addChild(), assert, CU_SPECIAL_PORT, FU_PORT_WIDTH, ObjectState::hasAttribute(), ObjectState::name(), PORT_CONNECTS_TO, PORT_NAME, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().

Referenced by controlUnitToMDF().

Here is the call graph for this function:

◆ momTemplateSlot()

ObjectState * ADFSerializer::momTemplateSlot ( const ObjectState momITState,
const std::string &  slotName 
)
staticprivate

Looks for an ObjectState instance which represents a template slot in machine object model format.

The ObjectState instance is searched from inside the given ObjectState instance that represents an instruction template in machine object model format. The instance is seached by the given slot name. Returns NULL if such an instance is not found.

Parameters
momITStateAn ObjectState instance representing an instruction template in machine object model format.
busNameThe name of the slot to look the template slot for.
Returns
ObjectState instance representing a template slot in machine object model format or NULL.

Definition at line 2308 of file ADFSerializer.cc.

2310  {
2311 
2312  for (int i = 0; i < momITState->childCount(); i++) {
2313  ObjectState* slot = momITState->child(i);
2314  if (slot->stringAttribute(TemplateSlot::OSKEY_SLOT) == slotName) {
2315  return slot;
2316  }
2317  }
2318 
2319  return NULL;
2320 }

References ObjectState::child(), ObjectState::childCount(), and ObjectState::stringAttribute().

Referenced by instructionTemplateToMachine().

Here is the call graph for this function:

◆ operator=()

ADFSerializer& ADFSerializer::operator= ( const ADFSerializer )
protected

Assingment forbidden.

◆ readMachine()

Machine * ADFSerializer::readMachine ( )

Reads the current MDF file set and creates a Machine according to it.

Returns
The newly created machine.
Exceptions
SerializerExceptionIf an error occurs while reading the MDF file.
ObjectStateLoadingExceptionIf an error occurs while creating Machine.

Definition at line 275 of file ADFSerializer.cc.

275  {
276  ObjectState* machineState = readState();
277  Machine* mach = new Machine();
278  mach->loadState(machineState);
279 
280  delete machineState;
281  return mach;
282 }

References TTAMachine::Machine::loadState(), and readState().

Referenced by llvm::TCETargetMachine::createMachine(), AddFUArchFromADFCmd::Do(), TTAMachine::Machine::loadFromADF(), loadInputs(), loadMachine(), ProGe::ProGeUI::loadMachine(), SimulatorFrontend::loadMachine(), ProGe::ProGeUI::loadProcessorConfiguration(), main(), Model::Model(), readAdf(), and llvm::TCEStubTargetMachine::TCEStubTargetMachine().

Here is the call graph for this function:

◆ readState()

ObjectState * ADFSerializer::readState ( )
virtual

Reads the current MDF file set and creates an ObjectState tree which can be given to Machine::loadState to create a machine.

Returns
The newly created ObjectState tree.
Exceptions
SerializerExceptionIf an error occurs while reading.

Reimplemented from XMLSerializer.

Definition at line 238 of file ADFSerializer.cc.

238  {
240  ObjectState* machineState;
241  try {
242  machineState = convertToMachineFormat(mdfState);
243  } catch (const SerializerException&) {
244  delete mdfState;
245  throw;
246  }
247 
248  delete mdfState;
249  return machineState;
250 }

References convertToMachineFormat(), and XMLSerializer::readState().

Referenced by DSDBManager::architecture(), readMachine(), and DSDBManager::writeArchitectureToFile().

Here is the call graph for this function:

◆ registerFileToMachine()

ObjectState * ADFSerializer::registerFileToMachine ( const ObjectState rfState)
staticprivate

Creates a new ObjectState tree which can be read by RegisterFile::loadState.

The ObjectState tree is created according to the given ObjectState tree which matches with the syntax of register file declaration in MDF file.

Parameters
rfStateThe ObjectState tree which matches with the syntax of register file declaration in MDF file.
Returns
The newly created ObjectState tree.

Definition at line 1304 of file ADFSerializer.cc.

1304  {
1305 
1306  ObjectState* regFile =
1307  new ObjectState(RegisterFile::OSNAME_REGISTER_FILE);
1308 
1309  // set name
1310  regFile->setAttribute(
1311  Component::OSKEY_NAME, rfState->stringAttribute(RF_NAME));
1312 
1313  // set type
1314  ObjectState* typeChild = rfState->childByName(RF_TYPE);
1315  string type = typeChild->stringValue();
1316  if (type == RF_TYPE_NORMAL) {
1317  regFile->setAttribute(
1318  RegisterFile::OSKEY_TYPE, RegisterFile::OSVALUE_NORMAL);
1319  } else if (type == RF_TYPE_RESERVED) {
1320  regFile->setAttribute(
1321  RegisterFile::OSKEY_TYPE, RegisterFile::OSVALUE_RESERVED);
1322  } else if (type == RF_TYPE_VOLATILE) {
1323  regFile->setAttribute(
1324  RegisterFile::OSKEY_TYPE, RegisterFile::OSVALUE_VOLATILE);
1325  } else {
1326  string procName = "ADFSerializer::registerFileToMachine";
1327  string errorMsg = "Unknown register file type in ObjectState "
1328  "instance.";
1329  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
1331  }
1332 
1333  // set size
1334  ObjectState* size = rfState->childByName(RF_SIZE);
1335  regFile->setAttribute(BaseRegisterFile::OSKEY_SIZE, size->stringValue());
1336 
1337  // set width
1338  ObjectState* width = rfState->childByName(RF_WIDTH);
1339  regFile->setAttribute(
1340  BaseRegisterFile::OSKEY_WIDTH, width->stringValue());
1341 
1342  // set max reads
1343  ObjectState* maxReads = rfState->childByName(RF_MAX_READS);
1344  regFile->setAttribute(
1345  RegisterFile::OSKEY_MAX_READS, maxReads->stringValue());
1346 
1347  // set max writes
1348  ObjectState* maxWrites = rfState->childByName(RF_MAX_WRITES);
1349  regFile->setAttribute(
1350  RegisterFile::OSKEY_MAX_WRITES, maxWrites->stringValue());
1351 
1352  // set guard latency
1353  if (rfState->hasChild(RF_GUARD_LATENCY)) {
1354  ObjectState* latencyChild = rfState->childByName(RF_GUARD_LATENCY);
1355  regFile->setAttribute(
1356  RegisterFile::OSKEY_GUARD_LATENCY, latencyChild->stringValue());
1357  } else {
1358  regFile->setAttribute(RegisterFile::OSKEY_GUARD_LATENCY, 0);
1359  }
1360 
1361  // set ports
1362  for (int i = 0; i < rfState->childCount(); i++) {
1363  ObjectState* child = rfState->child(i);
1364  if (child->name() == PORT) {
1365  regFile->addChild(machineRFPort(child));
1366  }
1367  }
1368 
1369  if (rfState->hasChild(RF_ZERO_REGISTER)) {
1370  ObjectState* zeroRegister = rfState->childByName(RF_ZERO_REGISTER);
1371  regFile->setAttribute(
1372  RegisterFile::OSKEY_ZERO_REGISTER, zeroRegister->boolValue());
1373  }
1374 
1375  return regFile;
1376 }

References Application::abortProgram(), ObjectState::addChild(), ObjectState::boolValue(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), machineRFPort(), ObjectState::name(), PORT, RF_GUARD_LATENCY, RF_MAX_READS, RF_MAX_WRITES, RF_NAME, RF_SIZE, RF_TYPE, RF_TYPE_NORMAL, RF_TYPE_RESERVED, RF_TYPE_VOLATILE, RF_WIDTH, RF_ZERO_REGISTER, ObjectState::setAttribute(), ObjectState::stringAttribute(), ObjectState::stringValue(), and Application::writeToErrorLog().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ registerFileToMDF()

ObjectState * ADFSerializer::registerFileToMDF ( const ObjectState rfState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by RegisterFile::saveState.

Parameters
rfStateRoot node of the ObjectState tree created by RegisterFile::saveState.
Returns
The newly created ObjectState tree.

Definition at line 671 of file ADFSerializer.cc.

671  {
672 
673  ObjectState* regFile = new ObjectState(REGISTER_FILE);
674  regFile->setAttribute(
675  RF_NAME, rfState->stringAttribute(RegisterFile::OSKEY_NAME));
676 
677  ObjectState* type = new ObjectState(RF_TYPE);
678  regFile->addChild(type);
679  string typeValue = rfState->stringAttribute(RegisterFile::OSKEY_TYPE);
680  if (typeValue == RegisterFile::OSVALUE_NORMAL) {
681  type->setValue(RF_TYPE_NORMAL);
682  } else if (typeValue == RegisterFile::OSVALUE_RESERVED) {
683  type->setValue(RF_TYPE_RESERVED);
684  } else if (typeValue == RegisterFile::OSVALUE_VOLATILE) {
685  type->setValue(RF_TYPE_VOLATILE);
686  } else {
687  string procName = "ADFSerializer::registerFileToMDF";
688  string errorMsg = "Unknown register file type in ObjectState "
689  "instance.";
690  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
692  }
693 
694  ObjectState* size = new ObjectState(RF_SIZE);
695  regFile->addChild(size);
696  size->setValue(rfState->stringAttribute(RegisterFile::OSKEY_SIZE));
697 
698  ObjectState* width = new ObjectState(RF_WIDTH);
699  regFile->addChild(width);
700  width->setValue(rfState->stringAttribute(RegisterFile::OSKEY_WIDTH));
701 
702  ObjectState* maxReads = new ObjectState(RF_MAX_READS);
703  regFile->addChild(maxReads);
704  maxReads->setValue(
705  rfState->stringAttribute(RegisterFile::OSKEY_MAX_READS));
706 
707  ObjectState* maxWrites = new ObjectState(RF_MAX_WRITES);
708  regFile->addChild(maxWrites);
709  maxWrites->setValue(
710  rfState->stringAttribute(RegisterFile::OSKEY_MAX_WRITES));
711 
712  if (rfState->intAttribute(RegisterFile::OSKEY_GUARD_LATENCY) > 0) {
713  ObjectState* guardLatency = new ObjectState(RF_GUARD_LATENCY);
714  regFile->addChild(guardLatency);
715  guardLatency->setValue(
716  rfState->stringAttribute(RegisterFile::OSKEY_GUARD_LATENCY));
717  }
718 
719  // add ports
720  for (int i = 0; i < rfState->childCount(); i++) {
721  ObjectState* child = rfState->child(i);
722  regFile->addChild(mdfPort(child));
723  }
724 
725  if (rfState->hasAttribute(RegisterFile::OSKEY_ZERO_REGISTER)) {
726  ObjectState* zeroRegister = new ObjectState(RF_ZERO_REGISTER);
727  regFile->addChild(zeroRegister);
728  zeroRegister->setValue(
729  rfState->boolAttribute(RegisterFile::OSKEY_ZERO_REGISTER));
730  }
731 
732  return regFile;
733 }

References Application::abortProgram(), ObjectState::addChild(), ObjectState::boolAttribute(), ObjectState::child(), ObjectState::childCount(), ObjectState::hasAttribute(), ObjectState::intAttribute(), mdfPort(), REGISTER_FILE, RF_GUARD_LATENCY, RF_MAX_READS, RF_MAX_WRITES, RF_NAME, RF_SIZE, RF_TYPE, RF_TYPE_NORMAL, RF_TYPE_RESERVED, RF_TYPE_VOLATILE, RF_WIDTH, RF_ZERO_REGISTER, ObjectState::setAttribute(), ObjectState::setValue(), ObjectState::stringAttribute(), and Application::writeToErrorLog().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ setIUExtensionMode()

void ADFSerializer::setIUExtensionMode ( const ObjectState mdfIUState,
ObjectState momIUState 
)
staticprivate

Sets extension mode of immediate unit to the given ObjectState tree representing immediate unit in machine object model format.

Parameters
mdfIUStateObjectState instance representing immediate unit in mdf format.
momIUStateObjectState instance representing immediate unit in machine object model format.

Definition at line 1756 of file ADFSerializer.cc.

1758  {
1759 
1760  ObjectState* extension = mdfIUState->childByName(IU_EXTENSION);
1761  string extensionValue = extension->stringValue();
1762  if (extensionValue == SIGN_EXTENSION) {
1763  momIUState->setAttribute(
1764  ImmediateUnit::OSKEY_EXTENSION, ImmediateUnit::OSVALUE_SIGN);
1765  } else if (extensionValue == ZERO_EXTENSION) {
1766  momIUState->setAttribute(
1767  ImmediateUnit::OSKEY_EXTENSION, ImmediateUnit::OSVALUE_ZERO);
1768  } else {
1769  string procName = "ADFSerializer::setIUExtensionMode";
1770  string errorMsg = "Unknown extension attribute value in ObjectState "
1771  "instance.";
1772  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
1774  }
1775 }

References Application::abortProgram(), ObjectState::childByName(), IU_EXTENSION, ObjectState::setAttribute(), SIGN_EXTENSION, ObjectState::stringValue(), Application::writeToErrorLog(), and ZERO_EXTENSION.

Referenced by immediateUnitToMachine().

Here is the call graph for this function:

◆ socketToMachine()

ObjectState * ADFSerializer::socketToMachine ( const ObjectState socketState)
staticprivate

Creates a new ObjectState tree which can be read by Socket::loadState and which corresponds with the given ObjectState tree declaring a socket by MDF syntax.

Parameters
socketStateThe ObjectState tree declaring a socket by MDF syntax.
Returns
The newly created ObjectState tree.

Definition at line 1176 of file ADFSerializer.cc.

1176  {
1177 
1178  ObjectState* socket = new ObjectState(Socket::OSNAME_SOCKET);
1179 
1180  // set name
1181  socket->setAttribute(
1182  Component::OSKEY_NAME, socketState->stringAttribute(SOCKET_NAME));
1183 
1184  // set direction
1185  if (socketState->hasChild(SOCKET_READS_FROM) ||
1186  socketState->hasChild(SOCKET_WRITES_TO)) {
1187 
1188  if (socketState->hasChild(SOCKET_READS_FROM)) {
1189  socket->setAttribute(
1190  Socket::OSKEY_DIRECTION, Socket::OSVALUE_INPUT);
1191  } else {
1192  socket->setAttribute(
1193  Socket::OSKEY_DIRECTION, Socket::OSVALUE_OUTPUT);
1194  }
1195 
1196  // add connections
1197  for (int i = 0; i < socketState->childCount(); i++) {
1198  ObjectState* srcOrDest = socketState->child(i);
1199  ObjectState* conn = new ObjectState(
1200  Connection::OSNAME_CONNECTION);
1201  socket->addChild(conn);
1202  conn->setAttribute(
1203  Connection::OSKEY_SOCKET,
1204  socketState->stringAttribute(SOCKET_NAME));
1205  ObjectState* bus = srcOrDest->childByName(SOCKET_BUS);
1206  conn->setAttribute(Connection::OSKEY_BUS, bus->stringValue());
1207  ObjectState* segment = srcOrDest->childByName(SOCKET_SEGMENT);
1208  conn->setAttribute(
1209  Connection::OSKEY_SEGMENT, segment->stringValue());
1210  }
1211 
1212  } else {
1213  socket->setAttribute(
1214  Socket::OSKEY_DIRECTION, Socket::OSVALUE_UNKNOWN);
1215  }
1216 
1217  return socket;
1218 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), ObjectState::setAttribute(), SOCKET_BUS, SOCKET_NAME, SOCKET_READS_FROM, SOCKET_SEGMENT, SOCKET_WRITES_TO, ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToMachineFormat().

Here is the call graph for this function:

◆ socketToMDF()

ObjectState * ADFSerializer::socketToMDF ( const ObjectState socketState)
staticprivate

Creates a new ObjectState tree which matches one-to-one with MDF specs syntax.

The tree is created according to the given ObjectState tree created by Socket::saveState.

Parameters
socketStateRoot node of the ObjectState tree created by Socket::saveState.
Returns
The newly created ObjectState tree.

Definition at line 543 of file ADFSerializer.cc.

543  {
544 
545  ObjectState* socket = new ObjectState(SOCKET);
546  socket->setAttribute(
547  SOCKET_NAME, socketState->stringAttribute(Socket::OSKEY_NAME));
548 
549  bool input;
550  if (socketState->stringAttribute(Socket::OSKEY_DIRECTION) ==
551  Socket::OSVALUE_INPUT) {
552  input = true;
553  } else if (socketState->stringAttribute(Socket::OSKEY_DIRECTION) ==
554  Socket::OSVALUE_OUTPUT) {
555  input = false;
556  } else {
557  return socket;
558  }
559 
560  for (int i = 0; i < socketState->childCount(); i++) {
561  ObjectState* child = socketState->child(i);
562  ObjectState* conn;
563  if (input) {
564  conn = new ObjectState(SOCKET_READS_FROM);
565  } else {
566  conn = new ObjectState(SOCKET_WRITES_TO);
567  }
568  socket->addChild(conn);
569  ObjectState* bus = new ObjectState(SOCKET_BUS);
570  conn->addChild(bus);
571  bus->setValue(child->stringAttribute(Connection::OSKEY_BUS));
572 
573  ObjectState* segment = new ObjectState(SOCKET_SEGMENT);
574  conn->addChild(segment);
575  if (child->hasAttribute(Connection::OSKEY_SEGMENT)) {
576  segment->setValue(
577  child->stringAttribute(Connection::OSKEY_SEGMENT));
578  }
579  }
580 
581  return socket;
582 }

References ObjectState::addChild(), ObjectState::child(), ObjectState::childCount(), ObjectState::hasAttribute(), ObjectState::setAttribute(), ObjectState::setValue(), SOCKET, SOCKET_BUS, SOCKET_NAME, SOCKET_READS_FROM, SOCKET_SEGMENT, SOCKET_WRITES_TO, and ObjectState::stringAttribute().

Referenced by convertToMDFFormat().

Here is the call graph for this function:

◆ writeMachine()

void ADFSerializer::writeMachine ( const TTAMachine::Machine machine)

Serializes the given machine to mdf file.

Parameters
machineThe machine to be serialized.
Exceptions
SerializerExceptionIf an error occurs while serializing.

Definition at line 259 of file ADFSerializer.cc.

259  {
260  ObjectState* machineState = machine.saveState();
261  writeState(machineState);
262  delete machineState;
263 }

References machine, TTAMachine::Machine::saveState(), and writeState().

Referenced by CompileTools::compileAsC(), CompileTools::compileAsLLVM(), TTAMachine::Machine::hash(), MDFDocument::OnSaveDocument(), DesignSpaceExplorer::schedule(), TDGen::writeBackendCode(), and TTAMachine::Machine::writeToADF().

Here is the call graph for this function:

◆ writeState()

void ADFSerializer::writeState ( const ObjectState machineState)
virtual

Writes the given ObjectState tree created by Machine::saveState to the destination file.

Parameters
machineStateObjectState tree created by Machine::saveState.
Exceptions
SerializerExceptionIf an error occurs while serializing.

Reimplemented from XMLSerializer.

Definition at line 224 of file ADFSerializer.cc.

224  {
225  ObjectState* converted = convertToMDFFormat(machineState);
226  XMLSerializer::writeState(converted);
227  delete converted;
228 }

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

Referenced by DSDBManager::addArchitecture(), DSDBManager::writeArchitectureToFile(), and writeMachine().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
BRIDGE_NAME
const string BRIDGE_NAME
Definition: ADFSerializer.cc:110
CU_RETURN_ADDRESS
const string CU_RETURN_ADDRESS
Definition: ADFSerializer.cc:177
ZERO_EXTENSION
const string ZERO_EXTENSION
Definition: ADFSerializer.cc:85
XMLSerializer::XMLSerializer
XMLSerializer()
Definition: XMLSerializer.cc:78
RF_MAX_WRITES
const string RF_MAX_WRITES
Definition: ADFSerializer.cc:140
ObjectState::hasAttribute
bool hasAttribute(const std::string &name) const
Definition: ObjectState.cc:205
ADDRESS_SPACE
const string ADDRESS_SPACE
Definition: ADFSerializer.cc:164
FU_OP_BIND_NAME
const string FU_OP_BIND_NAME
Definition: ADFSerializer.cc:120
AS_NAME
const string AS_NAME
Definition: ADFSerializer.cc:165
FU_OP_BIND
const string FU_OP_BIND
Definition: ADFSerializer.cc:119
PORT_CONNECTS_TO
const string PORT_CONNECTS_TO
Definition: ADFSerializer.cc:183
FU_OP_PL_RESOURCE
const string FU_OP_PL_RESOURCE
Definition: ADFSerializer.cc:122
SIGN_EXTENSION
const string SIGN_EXTENSION
Definition: ADFSerializer.cc:84
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
ADFSerializer::mdfPipeline
static ObjectState * mdfPipeline(const ObjectState *machinePipelineState)
Definition: ADFSerializer.cc:2095
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
ADFSerializerTextGenerator
Definition: ADFSerializerTextGenerator.hh:41
IMMEDIATE_SLOT
const string IMMEDIATE_SLOT
Definition: ADFSerializer.cc:190
CU_SPECIAL_PORT
const string CU_SPECIAL_PORT
Definition: ADFSerializer.cc:179
SHORT_IMMEDIATE
const string SHORT_IMMEDIATE
Definition: ADFSerializer.cc:81
IU_TYPE
const string IU_TYPE
Definition: ADFSerializer.cc:146
IU_EXTENSION
const string IU_EXTENSION
Definition: ADFSerializer.cc:155
ADFSerializer::socketToMachine
static ObjectState * socketToMachine(const ObjectState *socketState)
Definition: ADFSerializer.cc:1176
SOCKET
const string SOCKET
Definition: ADFSerializer.cc:102
ObjectState::intValue
int intValue() const
ADFSerializer::machinePipeline
static ObjectState * machinePipeline(const ObjectState *mdfPipelineState)
Definition: ADFSerializer.cc:2035
CU_DELAY_SLOTS
const string CU_DELAY_SLOTS
Definition: ADFSerializer.cc:175
Application::writeToErrorLog
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
Definition: Application.cc:224
ADFSerializer::functionUnitToMDF
static ObjectState * functionUnitToMDF(const ObjectState *fuState)
Definition: ADFSerializer.cc:629
MDF
const string MDF
Definition: ADFSerializer.cc:63
ADFSerializer::mdfSRPort
static ObjectState * mdfSRPort(const ObjectState *machineSRPortState)
Definition: ADFSerializer.cc:1712
ADFSerializer::mdfPort
static ObjectState * mdfPort(const ObjectState *machinePortState)
Definition: ADFSerializer.cc:1826
IU_LATENCY
const string IU_LATENCY
Definition: ADFSerializer.cc:151
RF_TYPE_NORMAL
const string RF_TYPE_NORMAL
Definition: ADFSerializer.cc:134
MDF_VERSION_NUMBER
const string MDF_VERSION_NUMBER
Definition: ADFSerializer.cc:66
CONTROL_UNIT
const string CONTROL_UNIT
Definition: ADFSerializer.cc:172
IMMEDIATE_UNIT
const string IMMEDIATE_UNIT
Definition: ADFSerializer.cc:144
IU_TYPE_VOLATILE
const string IU_TYPE_VOLATILE
Definition: ADFSerializer.cc:148
IMMEDIATE_SLOT_NAME
const string IMMEDIATE_SLOT_NAME
Definition: ADFSerializer.cc:191
IU_TYPE_NORMAL
const string IU_TYPE_NORMAL
Definition: ADFSerializer.cc:147
PORT_NAME
const string PORT_NAME
Definition: ADFSerializer.cc:182
BUS_NAME
const string BUS_NAME
Definition: ADFSerializer.cc:79
AS_WIDTH
const string AS_WIDTH
Definition: ADFSerializer.cc:166
ObjectState
Definition: ObjectState.hh:59
ADFSerializer::machineRFPort
static ObjectState * machineRFPort(const ObjectState *mdfPortState)
Definition: ADFSerializer.cc:1792
INVERTED_EXPR
const string INVERTED_EXPR
Definition: ADFSerializer.cc:88
IU_WIDTH
const string IU_WIDTH
Definition: ADFSerializer.cc:152
CU_ADDRESS_SPACE
const string CU_ADDRESS_SPACE
Definition: ADFSerializer.cc:174
ADFSerializer::busToMDF
static ObjectState * busToMDF(const ObjectState *busState)
Definition: ADFSerializer.cc:419
SEGMENT_WRITES_TO
const string SEGMENT_WRITES_TO
Definition: ADFSerializer.cc:100
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
ObjectState::setName
void setName(const std::string &name)
SHORT_IMM_WIDTH
const string SHORT_IMM_WIDTH
Definition: ADFSerializer.cc:82
ADFSerializer::controlUnitToMachine
static ObjectState * controlUnitToMachine(const ObjectState *cuState)
Definition: ADFSerializer.cc:1446
IU_TYPE_RESERVED
const string IU_TYPE_RESERVED
Definition: ADFSerializer.cc:149
RF_MAX_READS
const string RF_MAX_READS
Definition: ADFSerializer.cc:139
FU_OP_PL_WRITES
const string FU_OP_PL_WRITES
Definition: ADFSerializer.cc:128
TTAMachine::Machine::loadState
virtual void loadState(const ObjectState *state)
Definition: Machine.cc:728
ObjectState::childByName
ObjectState * childByName(const std::string &name) const
Definition: ObjectState.cc:443
AS_MAX_ADDRESS
const string AS_MAX_ADDRESS
Definition: ADFSerializer.cc:168
FU_PORT_SETS_OPCODE
const string FU_PORT_SETS_OPCODE
Definition: ADFSerializer.cc:187
ADFSerializer::controlUnitToMDF
static ObjectState * controlUnitToMDF(const ObjectState *cuState)
Definition: ADFSerializer.cc:905
assert
#define assert(condition)
Definition: Application.hh:86
ADFSerializer::bridgeToMachine
static ObjectState * bridgeToMachine(const ObjectState *bridgeState)
Definition: ADFSerializer.cc:1232
FU_NAME
const string FU_NAME
Definition: ADFSerializer.cc:115
SIMPLE_EXPR
const string SIMPLE_EXPR
Definition: ADFSerializer.cc:89
FU_OPERATION
const string FU_OPERATION
Definition: ADFSerializer.cc:117
FU_PORT_TRIGGERS
const string FU_PORT_TRIGGERS
Definition: ADFSerializer.cc:186
FU_OP_PL_READS_NAME
const string FU_OP_PL_READS_NAME
Definition: ADFSerializer.cc:127
IU_TEMPLATE_NAME
const string IU_TEMPLATE_NAME
Definition: ADFSerializer.cc:158
CU_GUARD_LATENCY
const string CU_GUARD_LATENCY
Definition: ADFSerializer.cc:176
AS_MIN_ADDRESS
const string AS_MIN_ADDRESS
Definition: ADFSerializer.cc:167
XMLSerializer::setSchemaFile
void setSchemaFile(const std::string &fileName)
Definition: XMLSerializer.cc:168
GUARD
const string GUARD
Definition: ADFSerializer.cc:87
ADFSerializer::convertToMDFFormat
static ObjectState * convertToMDFFormat(const ObjectState *machineState)
Definition: ADFSerializer.cc:292
RF_TYPE_VOLATILE
const string RF_TYPE_VOLATILE
Definition: ADFSerializer.cc:135
ADFSerializer::hasEmptyInstructionTemplate
static bool hasEmptyInstructionTemplate(const ObjectState *momMachineState)
Definition: ADFSerializer.cc:2332
IU_GUARD_LATENCY
const string IU_GUARD_LATENCY
Definition: ADFSerializer.cc:156
GUARD_UNIT_NAME
const string GUARD_UNIT_NAME
Definition: ADFSerializer.cc:94
ADFSerializerTextGenerator::TXT_IT_EMPTY_AND_NON_EMPTY
@ TXT_IT_EMPTY_AND_NON_EMPTY
Definition: ADFSerializerTextGenerator.hh:50
ADFSerializer::setIUExtensionMode
static void setIUExtensionMode(const ObjectState *mdfIUState, ObjectState *momIUState)
Definition: ADFSerializer.cc:1756
SOCKET_SEGMENT
const string SOCKET_SEGMENT
Definition: ADFSerializer.cc:107
GUARD_UNIT
const string GUARD_UNIT
Definition: ADFSerializer.cc:93
IU_TEMPLATE_SLOT_WIDTH
const string IU_TEMPLATE_SLOT_WIDTH
Definition: ADFSerializer.cc:161
ADFSerializerTextGenerator::TXT_SAME_TEMPLATE_SLOT
@ TXT_SAME_TEMPLATE_SLOT
Definition: ADFSerializerTextGenerator.hh:49
XMLSerializer::readState
virtual ObjectState * readState()
Definition: XMLSerializer.cc:200
ADFSerializer::functionUnitToMachine
static ObjectState * functionUnitToMachine(const ObjectState *fuState, const int orderNumber)
Definition: ADFSerializer.cc:1260
RF_NAME
const string RF_NAME
Definition: ADFSerializer.cc:132
ALWAYS_TRUE_GUARD
const string ALWAYS_TRUE_GUARD
Definition: ADFSerializer.cc:97
SEGMENT
const string SEGMENT
Definition: ADFSerializer.cc:98
GUARD_REGFILE_NAME
const string GUARD_REGFILE_NAME
Definition: ADFSerializer.cc:91
SOCKET_BUS
const string SOCKET_BUS
Definition: ADFSerializer.cc:106
ADFSerializer::addressSpaceToMDF
static ObjectState * addressSpaceToMDF(const ObjectState *asState)
Definition: ADFSerializer.cc:852
ADFSerializer::addressSpaceToMachine
static ObjectState * addressSpaceToMachine(const ObjectState *asState)
Definition: ADFSerializer.cc:1391
Environment::schemaDirPath
static std::string schemaDirPath(const std::string &prog)
Definition: Environment.cc:151
ADFSerializer::mdfFUPort
static ObjectState * mdfFUPort(const ObjectState *machineFUPortState)
Definition: ADFSerializer.cc:1914
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
RF_TYPE
const string RF_TYPE
Definition: ADFSerializer.cc:133
AS_NUMERICAL_ID
const string AS_NUMERICAL_ID
Definition: ADFSerializer.cc:169
ADFSerializer::immediateSlotToMachine
static ObjectState * immediateSlotToMachine(const ObjectState *isState)
Definition: ADFSerializer.cc:1636
ALWAYS_WRITE_BACK_RESULTS
const string ALWAYS_WRITE_BACK_RESULTS
Definition: ADFSerializer.cc:76
ObjectState::childCount
int childCount() const
FUNCTION_UNITS_ORDERED
const string FUNCTION_UNITS_ORDERED
Definition: ADFSerializer.cc:77
SEGMENT_NAME
const string SEGMENT_NAME
Definition: ADFSerializer.cc:99
TTAMachine::Machine::saveState
virtual ObjectState * saveState() const
Definition: Machine.cc:686
RF_WIDTH
const string RF_WIDTH
Definition: ADFSerializer.cc:138
CU_CTRL_OPERATION
const string CU_CTRL_OPERATION
Definition: ADFSerializer.cc:178
SerializerException
Definition: Exception.hh:675
GUARD_UNIT_PORT
const string GUARD_UNIT_PORT
Definition: ADFSerializer.cc:95
ObjectState::hasChild
bool hasChild(const std::string &name) const
Definition: ObjectState.cc:358
BITNESS64
const string BITNESS64
Definition: ADFSerializer.cc:75
ADFSerializer::machineOperation
static ObjectState * machineOperation(const ObjectState *mdfOperationState)
Definition: ADFSerializer.cc:1949
ADFSerializer::machineFUPort
static ObjectState * machineFUPort(const ObjectState *mdfFUPortState)
Definition: ADFSerializer.cc:1863
ADFSerializer::instructionTemplateToMDF
static void instructionTemplateToMDF(const ObjectState *momITState, ObjectState *mdfIUState)
Definition: ADFSerializer.cc:2149
ADFSerializer::machineSRPort
static ObjectState * machineSRPort(const ObjectState *mdfSRPortState)
Definition: ADFSerializer.cc:1659
FU_OP_PL_RES_NAME
const string FU_OP_PL_RES_NAME
Definition: ADFSerializer.cc:123
ObjectState::name
std::string name() const
XMLSerializer::setUseSchema
void setUseSchema(bool useSchema)
Definition: XMLSerializer.cc:179
IU_NAME
const string IU_NAME
Definition: ADFSerializer.cc:145
GUARD_BOOL
const string GUARD_BOOL
Definition: ADFSerializer.cc:90
ADF_SCHEMA_FILE
const string ADF_SCHEMA_FILE
Definition: ADFSerializer.cc:198
ADFSerializer::bridgeToMDF
static ObjectState * bridgeToMDF(const ObjectState *bridgeState)
Definition: ADFSerializer.cc:597
ADFSerializer::readState
ObjectState * readState()
Definition: ADFSerializer.cc:238
RF_SIZE
const string RF_SIZE
Definition: ADFSerializer.cc:137
SOCKET_WRITES_TO
const string SOCKET_WRITES_TO
Definition: ADFSerializer.cc:105
ALWAYS_FALSE_GUARD
const string ALWAYS_FALSE_GUARD
Definition: ADFSerializer.cc:96
SOCKET_READS_FROM
const string SOCKET_READS_FROM
Definition: ADFSerializer.cc:104
FUNCTION_UNIT
const string FUNCTION_UNIT
Definition: ADFSerializer.cc:114
FU_OP_PL_RES_CYCLES
const string FU_OP_PL_RES_CYCLES
Definition: ADFSerializer.cc:125
RF_ZERO_REGISTER
const string RF_ZERO_REGISTER
Definition: ADFSerializer.cc:142
RF_GUARD_LATENCY
const string RF_GUARD_LATENCY
Definition: ADFSerializer.cc:141
IU_MAX_WRITES
const string IU_MAX_WRITES
Definition: ADFSerializer.cc:154
IU_TEMPLATE
const string IU_TEMPLATE
Definition: ADFSerializer.cc:157
FU_OP_PIPELINE
const string FU_OP_PIPELINE
Definition: ADFSerializer.cc:121
FU_OP_PL_RES_START_CYCLE
const string FU_OP_PL_RES_START_CYCLE
Definition: ADFSerializer.cc:124
BRIDGE
const string BRIDGE
Definition: ADFSerializer.cc:109
FU_PORT_NO_REGISTER
const string FU_PORT_NO_REGISTER
Definition: ADFSerializer.cc:188
IU_MAX_READS
const string IU_MAX_READS
Definition: ADFSerializer.cc:153
ADFSerializer::immediateSlotToMDF
static ObjectState * immediateSlotToMDF(const ObjectState *isState)
Definition: ADFSerializer.cc:976
FU_ADDRESS_SPACE
const string FU_ADDRESS_SPACE
Definition: ADFSerializer.cc:116
ObjectState::boolAttribute
bool boolAttribute(const std::string &name) const
Definition: ObjectState.cc:338
ADFSerializer::writeState
void writeState(const ObjectState *machineState)
Definition: ADFSerializer.cc:224
SHORT_IMM_EXTENSION
const string SHORT_IMM_EXTENSION
Definition: ADFSerializer.cc:83
REGISTER_FILE
const string REGISTER_FILE
Definition: ADFSerializer.cc:131
FU_OP_PL_WRITES_NAME
const string FU_OP_PL_WRITES_NAME
Definition: ADFSerializer.cc:129
ADFSerializer::convertToMachineFormat
static ObjectState * convertToMachineFormat(const ObjectState *mdfState)
Definition: ADFSerializer.cc:995
AS_SHARED_MEMORY
const string AS_SHARED_MEMORY
Definition: ADFSerializer.cc:170
ADFSerializer::mdfOperation
static ObjectState * mdfOperation(const ObjectState *machineOperationState)
Definition: ADFSerializer.cc:1994
BRIDGE_READS_FROM
const string BRIDGE_READS_FROM
Definition: ADFSerializer.cc:111
ObjectState::boolValue
bool boolValue() const
PORT
const string PORT
Definition: ADFSerializer.cc:181
ObjectState::stringValue
std::string stringValue() const
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
LITTLE_ENDIAN_MACHINE
const string LITTLE_ENDIAN_MACHINE
Definition: ADFSerializer.cc:74
ADFSerializer::busToMachine
static ObjectState * busToMachine(const ObjectState *busState)
Definition: ADFSerializer.cc:1064
FU_OP_NAME
const string FU_OP_NAME
Definition: ADFSerializer.cc:118
IU_SIZE
const string IU_SIZE
Definition: ADFSerializer.cc:150
BUS_WIDTH
const string BUS_WIDTH
Definition: ADFSerializer.cc:80
CU_NAME
const string CU_NAME
Definition: ADFSerializer.cc:173
Application::abortProgram
static void abortProgram() __attribute__((noreturn))
Definition: Application.cc:266
ADFSerializerTextGenerator::TXT_EMPTY_IT_NOT_DECLARED
@ TXT_EMPTY_IT_NOT_DECLARED
Definition: ADFSerializerTextGenerator.hh:51
SOCKET_NAME
const string SOCKET_NAME
Definition: ADFSerializer.cc:103
ADFSerializer::registerFileToMDF
static ObjectState * registerFileToMDF(const ObjectState *rfState)
Definition: ADFSerializer.cc:671
GUARD_REGFILE_INDEX
const string GUARD_REGFILE_INDEX
Definition: ADFSerializer.cc:92
BRIDGE_WRITES_TO
const string BRIDGE_WRITES_TO
Definition: ADFSerializer.cc:112
MDF_VERSION
const string MDF_VERSION
Definition: ADFSerializer.cc:64
ADFSerializer::registerFileToMachine
static ObjectState * registerFileToMachine(const ObjectState *rfState)
Definition: ADFSerializer.cc:1304
IU_TEMPLATE_SLOT
const string IU_TEMPLATE_SLOT
Definition: ADFSerializer.cc:159
IU_TEMPLATE_SLOT_NAME
const string IU_TEMPLATE_SLOT_NAME
Definition: ADFSerializer.cc:160
ObjectState::setValue
void setValue(const std::string &value)
ADFSerializer::instructionTemplateToMachine
static void instructionTemplateToMachine(const ObjectState *mdfITState, ObjectState *momMachineState, const std::string &iuName=std::string(""))
Definition: ADFSerializer.cc:2215
TRIGGER_INVALIDATES_OLD_RESULTS
const string TRIGGER_INVALIDATES_OLD_RESULTS
Definition: ADFSerializer.cc:73
RF_TYPE_RESERVED
const string RF_TYPE_RESERVED
Definition: ADFSerializer.cc:136
BUS
const string BUS
Definition: ADFSerializer.cc:78
ADFSerializer::momTemplateSlot
static ObjectState * momTemplateSlot(const ObjectState *momITState, const std::string &busName)
Definition: ADFSerializer.cc:2308
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
ADFSerializer::immediateUnitToMachine
static ObjectState * immediateUnitToMachine(const ObjectState *iuState, ObjectState *machineState)
Definition: ADFSerializer.cc:1517
ADFSerializer::immediateUnitToMDF
static ObjectState * immediateUnitToMDF(const ObjectState *iuState, const ObjectState *machineState)
Definition: ADFSerializer.cc:751
TTAMachine::Machine
Definition: Machine.hh:73
FU_PORT_WIDTH
const string FU_PORT_WIDTH
Definition: ADFSerializer.cc:185
XMLSerializer::writeState
virtual void writeState(const ObjectState *rootState)
Definition: XMLSerializer.cc:219
FU_OP_PL_READS
const string FU_OP_PL_READS
Definition: ADFSerializer.cc:126
ADFSerializer::socketToMDF
static ObjectState * socketToMDF(const ObjectState *socketState)
Definition: ADFSerializer.cc:543