63 const string MDF =
"adf";
78 const string BUS =
"bus";
299 Machine::OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS) &&
301 Machine::OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS)) {
304 if (machineState->
hasAttribute(Machine::OSKEY_ALWAYS_WRITE_BACK_RESULTS) &&
305 machineState->
boolAttribute(Machine::OSKEY_ALWAYS_WRITE_BACK_RESULTS)) {
308 if (machineState->
hasAttribute(Machine::OSKEY_FUNCTION_UNITS_ORDERED) &&
309 machineState->
boolAttribute(Machine::OSKEY_FUNCTION_UNITS_ORDERED)) {
323 for (
int i = 0; i < machineState->
childCount(); i++) {
325 if (child->
name() == Bus::OSNAME_BUS) {
331 for (
int i = 0; i < machineState->
childCount(); i++) {
333 if (child->
name() == Socket::OSNAME_SOCKET) {
339 for (
int i = 0; i < machineState->
childCount(); i++) {
341 if (child->
name() == Bridge::OSNAME_BRIDGE) {
347 for (
int i = 0; i < machineState->
childCount(); i++) {
349 if (child->
name() == FunctionUnit::OSNAME_FU) {
355 for (
int i = 0; i < machineState->
childCount(); i++) {
357 if (child->
name() == RegisterFile::OSNAME_REGISTER_FILE) {
363 for (
int i = 0; i < machineState->
childCount(); i++) {
365 if (child->
name() == AddressSpace::OSNAME_ADDRESS_SPACE) {
371 for (
int i = 0; i < machineState->
childCount(); i++) {
373 if (child->
name() == ControlUnit::OSNAME_CONTROL_UNIT) {
379 for (
int i = 0; i < machineState->
childCount(); i++) {
381 if (child->
name() == ImmediateUnit::OSNAME_IMMEDIATE_UNIT) {
387 for (
int i = 0; i < machineState->
childCount(); i++) {
389 if (child->
name() == ImmediateSlot::OSNAME_IMMEDIATE_SLOT) {
395 for (
int i = 0; i < machineState->
childCount(); i++) {
397 if (child->
name() == OperationTriggeredFormat::OSNAME_FORMAT) {
430 for (
int i = 0; i < busState->
childCount(); i++) {
433 if (child->
name() == PortGuard::OSNAME_PORT_GUARD ||
434 child->
name() == RegisterGuard::OSNAME_REGISTER_GUARD) {
438 string unitNameAttrib;
439 string targetNameAttrib;
440 if (child->
name() == PortGuard::OSNAME_PORT_GUARD) {
444 unitNameAttrib = PortGuard::OSKEY_FU;
445 targetNameAttrib = PortGuard::OSKEY_PORT;
446 }
else if (child->
name() ==
447 RegisterGuard::OSNAME_REGISTER_GUARD) {
451 unitNameAttrib = RegisterGuard::OSKEY_REGFILE;
452 targetNameAttrib = RegisterGuard::OSKEY_INDEX;
463 guardChild->
addChild(conditionalChild);
465 conditionalChild->
addChild(typeChild);
473 }
else if (child->
name() ==
474 UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD) {
488 for (
int i = 0; i < busState->
childCount(); i++) {
491 if (child->
name() == Segment::OSNAME_SEGMENT) {
510 if (extension == Bus::OSVALUE_SIGN) {
512 }
else if (extension == Bus::OSVALUE_ZERO) {
515 string procName =
"MDFSerialiser::busToMDF";
516 string errorMsg =
"Unknown extension attribute value in ObjectState "
522 sImmChild->
addChild(extensionChild);
524 sImmChild->
addChild(sImmWidthChild);
551 Socket::OSVALUE_INPUT) {
554 Socket::OSVALUE_OUTPUT) {
560 for (
int i = 0; i < socketState->
childCount(); i++) {
636 for (
int i = 0; i < fuState->
childCount(); i++) {
638 if (child->
name() == FUPort::OSNAME_FUPORT) {
640 }
else if (child->
name() == HWOperation::OSNAME_OPERATION) {
680 if (typeValue == RegisterFile::OSVALUE_NORMAL) {
682 }
else if (typeValue == RegisterFile::OSVALUE_RESERVED) {
684 }
else if (typeValue == RegisterFile::OSVALUE_VOLATILE) {
687 string procName =
"ADFSerializer::registerFileToMDF";
688 string errorMsg =
"Unknown register file type in ObjectState "
712 if (rfState->
intAttribute(RegisterFile::OSKEY_GUARD_LATENCY) > 0) {
720 for (
int i = 0; i < rfState->
childCount(); i++) {
725 if (rfState->
hasAttribute(RegisterFile::OSKEY_ZERO_REGISTER)) {
762 if (typeValue == ImmediateUnit::OSVALUE_NORMAL) {
764 }
else if (typeValue == ImmediateUnit::OSVALUE_RESERVED) {
766 }
else if (typeValue == ImmediateUnit::OSVALUE_VOLATILE) {
769 string procName =
"ADFSerializer::immediateUnitToMDF";
770 string errorMsg =
"Unknown immediate unit type in ObjectState "
799 if (iuState->
intAttribute(ImmediateUnit::OSKEY_GUARD_LATENCY) > 0) {
819 for (
int i = 0; i < iuState->
childCount(); i++) {
821 if (child->
name() == RFPort::OSNAME_RFPORT) {
827 for (
int iTempIndex = 0; iTempIndex < machineState->
childCount();
831 InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE) {
875 if (asState->
hasAttribute(AddressSpace::OSKEY_SHARED_MEMORY)) {
882 for (
int i = 0; i < asState->
childCount(); i++) {
884 if (child->
name() == AddressSpace::OSKEY_NUMERICAL_ID) {
912 for (
int i = 0; i < cuState->
childCount(); i++) {
914 if (child->
name() == FUPort::OSNAME_FUPORT) {
920 for (
int i = 0; i < cuState->
childCount(); i++) {
922 if (child->
name() == SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT) {
930 if (cuState->
hasAttribute(ControlUnit::OSKEY_RA_PORT)) {
936 for (
int i = 0; i < cuState->
childCount(); i++) {
938 if (child->
name() == HWOperation::OSNAME_OPERATION) {
981 return immediateSlot;
1000 int orderNumber = 0;
1003 for (
int i = 0; i < mdfState->
childCount(); i++) {
1007 Machine::OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS,
true);
1010 Machine::OSKEY_ALWAYS_WRITE_BACK_RESULTS,
true);
1017 Machine::OSKEY_FUNCTION_UNITS_ORDERED,
true);
1018 }
else if (child->
name() ==
BUS) {
1042 child->
name() == OperationTriggeredFormat::OSNAME_FORMAT) {
1083 bus->
setAttribute(Bus::OSKEY_EXTENSION, Bus::OSVALUE_SIGN);
1085 bus->
setAttribute(Bus::OSKEY_EXTENSION, Bus::OSVALUE_ZERO);
1087 string procName =
"ADFSerializer::busToMachine";
1088 string errorMsg =
"Unknown extension value in ObjectState.";
1094 for (
int i = 0; i < busState->
childCount(); i++) {
1103 if (destination !=
"") {
1105 Segment::OSKEY_DESTINATION, writesTo->
stringValue());
1111 UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD);
1116 UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD);
1122 string objectStateName;
1123 string unitNameElem;
1124 string unitNameAttrib;
1125 string targetNameElem;
1126 string targetNameAttrib;
1128 objectStateName = RegisterGuard::OSNAME_REGISTER_GUARD;
1130 unitNameAttrib = RegisterGuard::OSKEY_REGFILE;
1132 targetNameAttrib = RegisterGuard::OSKEY_INDEX;
1134 objectStateName = PortGuard::OSNAME_PORT_GUARD;
1136 unitNameAttrib = PortGuard::OSKEY_FU;
1138 targetNameAttrib = PortGuard::OSKEY_PORT;
1140 string procName =
"ADFSerializer::busToMachine";
1141 string errorMsg =
"Unknown ObjectState name.";
1143 __FILE__, __LINE__, procName, errorMsg);
1190 Socket::OSKEY_DIRECTION, Socket::OSVALUE_INPUT);
1193 Socket::OSKEY_DIRECTION, Socket::OSVALUE_OUTPUT);
1197 for (
int i = 0; i < socketState->
childCount(); i++) {
1200 Connection::OSNAME_CONNECTION);
1203 Connection::OSKEY_SOCKET,
1209 Connection::OSKEY_SEGMENT, segment->
stringValue());
1214 Socket::OSKEY_DIRECTION, Socket::OSVALUE_UNKNOWN);
1241 Bridge::OSKEY_DESTINATION_BUS, writesTo->
stringValue());
1262 const int orderNumber) {
1270 fu->
setAttribute(FunctionUnit::OSKEY_ORDER_NUMBER, orderNumber);
1279 for (
int i = 0; i < fuState->
childCount(); i++) {
1307 new ObjectState(RegisterFile::OSNAME_REGISTER_FILE);
1318 RegisterFile::OSKEY_TYPE, RegisterFile::OSVALUE_NORMAL);
1321 RegisterFile::OSKEY_TYPE, RegisterFile::OSVALUE_RESERVED);
1324 RegisterFile::OSKEY_TYPE, RegisterFile::OSVALUE_VOLATILE);
1326 string procName =
"ADFSerializer::registerFileToMachine";
1327 string errorMsg =
"Unknown register file type in ObjectState "
1340 BaseRegisterFile::OSKEY_WIDTH, width->
stringValue());
1345 RegisterFile::OSKEY_MAX_READS, maxReads->
stringValue());
1350 RegisterFile::OSKEY_MAX_WRITES, maxWrites->
stringValue());
1356 RegisterFile::OSKEY_GUARD_LATENCY, latencyChild->
stringValue());
1358 regFile->
setAttribute(RegisterFile::OSKEY_GUARD_LATENCY, 0);
1362 for (
int i = 0; i < rfState->
childCount(); i++) {
1372 RegisterFile::OSKEY_ZERO_REGISTER, zeroRegister->
boolValue());
1406 AddressSpace::OSKEY_MIN_ADDRESS, minAddress->
stringValue());
1411 AddressSpace::OSKEY_MAX_ADDRESS, maxAddress->
stringValue());
1416 AddressSpace::OSKEY_SHARED_MEMORY, shared->
boolValue());
1420 for (
int i = 0; i < asState->
childCount(); i++) {
1424 new ObjectState(AddressSpace::OSKEY_NUMERICAL_ID, as);
1464 ControlUnit::OSKEY_DELAY_SLOTS, delaySlots->
stringValue());
1469 ControlUnit::OSKEY_GUARD_LATENCY, gLatency->
stringValue());
1472 for (
int i = 0; i < cuState->
childCount(); i++) {
1484 if (raPortName !=
"") {
1485 cu->
setAttribute(ControlUnit::OSKEY_RA_PORT, raPortName);
1489 for (
int i = 0; i < cuState->
childCount(); i++) {
1530 ImmediateUnit::OSKEY_TYPE, ImmediateUnit::OSVALUE_NORMAL);
1533 ImmediateUnit::OSKEY_TYPE, ImmediateUnit::OSVALUE_RESERVED);
1536 ImmediateUnit::OSKEY_TYPE, ImmediateUnit::OSVALUE_VOLATILE);
1538 string procName =
"ADFSerializer::registerFileToMachine";
1539 string errorMsg =
"Unknown register file type in ObjectState "
1556 ImmediateUnit::OSKEY_MAX_READS, maxReads->
stringValue());
1561 ImmediateUnit::OSKEY_MAX_WRITES, maxWrites->
stringValue());
1568 ImmediateUnit::OSKEY_GUARD_LATENCY,
1571 iu->
setAttribute(ImmediateUnit::OSKEY_GUARD_LATENCY, 0);
1578 ImmediateUnit::OSKEY_LATENCY, readLatencyChild->
stringValue());
1586 for (
int i = 0; i < iuState->
childCount(); i++) {
1604 bool emptyFound =
false;
1605 for (
int i = 0; i < iuState->
childCount(); i++) {
1615 format errorMsg = textGen.
text(
1618 string procName =
"ADFSerializer::immediateUnitToMachine";
1620 __FILE__, __LINE__, procName, errorMsg.str());
1638 ImmediateSlot::OSNAME_IMMEDIATE_SLOT);
1640 ImmediateSlot::OSKEY_NAME,
1642 return immediateSlot;
1663 new ObjectState(SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT);
1665 SpecialRegisterPort::OSKEY_NAME,
1670 SpecialRegisterPort::OSKEY_WIDTH, width->
stringValue());
1673 for (
int i = 0; i < mdfSRPortState->
childCount(); i++) {
1677 if (connIndex == 1) {
1680 }
else if (connIndex == 2) {
1684 string procName =
"ADFSerializer::machineSRPort";
1685 string errorMsg =
"Too many connects-to elements in SR "
1688 __FILE__, __LINE__, procName, errorMsg);
1715 SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT);
1722 if (machineSRPortState->
hasAttribute(FUPort::OSKEY_FIRST_SOCKET)) {
1726 FUPort::OSKEY_FIRST_SOCKET));
1729 if (machineSRPortState->
hasAttribute(FUPort::OSKEY_SECOND_SOCKET)) {
1733 FUPort::OSKEY_SECOND_SOCKET));
1740 SpecialRegisterPort::OSKEY_WIDTH));
1764 ImmediateUnit::OSKEY_EXTENSION, ImmediateUnit::OSVALUE_SIGN);
1767 ImmediateUnit::OSKEY_EXTENSION, ImmediateUnit::OSVALUE_ZERO);
1769 string procName =
"ADFSerializer::setIUExtensionMode";
1770 string errorMsg =
"Unknown extension attribute value in ObjectState "
1798 for (
int i = 0; i < mdfPortState->
childCount(); i++) {
1831 if (machinePortState->
hasAttribute(Port::OSKEY_FIRST_SOCKET)) {
1835 Port::OSKEY_FIRST_SOCKET));
1837 if (machinePortState->
hasAttribute(Port::OSKEY_SECOND_SOCKET)) {
1841 Port::OSKEY_SECOND_SOCKET));
1870 for (
int i = 0; i < mdfFUPortState->
childCount(); i++) {
1875 Port::OSKEY_FIRST_SOCKET, portChild->
stringValue());
1878 Port::OSKEY_SECOND_SOCKET, portChild->
stringValue());
1887 FUPort::OSKEY_TRIGGERING, mdfFUPortState->
hasChild(
1890 FUPort::OSKEY_OPCODE_SETTING, mdfFUPortState->
hasChild(
1893 FUPort::OSKEY_NO_REGISTER, mdfFUPortState->
hasChild(
1919 FUPort::OSKEY_WIDTH));
1921 if (machineFUPortState->
intAttribute(FUPort::OSKEY_TRIGGERING)) {
1924 if (machineFUPortState->
intAttribute(FUPort::OSKEY_OPCODE_SETTING)) {
1928 if (machineFUPortState->
intAttribute(FUPort::OSKEY_NO_REGISTER)) {
1952 HWOperation::OSNAME_OPERATION);
1954 HWOperation::OSKEY_NAME,
1958 for (
int i = 0; i < mdfOperationState->
childCount(); i++) {
1962 HWOperation::OSNAME_OPERAND_BINDING);
1965 HWOperation::OSKEY_OPERAND,
2000 HWOperation::OSKEY_NAME));
2003 for (
int i = 0; i < machineOperationState->
childCount(); i++) {
2005 if (child->
name() == HWOperation::OSNAME_OPERAND_BINDING) {
2010 HWOperation::OSKEY_OPERAND));
2016 ExecutionPipeline::OSNAME_PIPELINE);
2038 ExecutionPipeline::OSNAME_PIPELINE);
2040 for (
int i = 0; i < mdfPipelineState->
childCount(); i++) {
2045 ExecutionPipeline::OSNAME_RESOURCE_USAGE);
2047 ExecutionPipeline::OSKEY_RESOURCE_NAME,
2051 ExecutionPipeline::OSNAME_OPERAND_READ);
2053 ExecutionPipeline::OSKEY_OPERAND,
2057 ExecutionPipeline::OSNAME_OPERAND_WRITE);
2059 ExecutionPipeline::OSKEY_OPERAND,
2062 const string procName =
"ADFSerializer::machinePipeline";
2063 const string errorMsg =
"Given pipeline model is invalid.";
2065 __FILE__, __LINE__, procName, errorMsg);
2071 ExecutionPipeline::OSKEY_START_CYCLE,
2075 ExecutionPipeline::OSKEY_CYCLES,
2099 for (
int i = 0; i < machinePipelineState->
childCount(); i++) {
2102 if (resChild->
name() == ExecutionPipeline::OSNAME_RESOURCE_USAGE) {
2107 ExecutionPipeline::OSKEY_RESOURCE_NAME));
2108 }
else if (resChild->
name() ==
2109 ExecutionPipeline::OSNAME_OPERAND_READ) {
2114 }
else if (resChild->
name() ==
2115 ExecutionPipeline::OSNAME_OPERAND_WRITE) {
2154 string iTempName = momITState->
stringAttribute(Component::OSKEY_NAME);
2155 for (
int slotIndex = 0; slotIndex < momITState->
childCount();
2162 for (
int iuChildIndex = 0;
2163 iuChildIndex < mdfIUState->
childCount(); iuChildIndex++) {
2167 correctTemplate = iuChild;
2171 if (correctTemplate == NULL) {
2173 mdfIUState->
addChild(correctTemplate);
2178 correctTemplate->
addChild(slotElem);
2193 mdfIUState->
addChild(emptyTemplate);
2217 const std::string& iuName) {
2218 const string procName =
"ADFSerializer::instructionTemplateToMachine";
2222 bool iTempFound =
false;
2224 for (
int iTempIndex = 0; iTempIndex < momMachineState->
childCount();
2226 iTemp = momMachineState->
child(iTempIndex);
2227 if (iTemp->
name() ==
2228 InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE &&
2238 InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE);
2240 iTemp->
setAttribute(Component::OSKEY_NAME, templateName);
2245 if ((mdfITState->
childCount() == 0 && iTempFound &&
2247 (mdfITState->
childCount() > 0 && iTempFound &&
2249 format errorMsg = textGen.
text(
2251 errorMsg % templateName;
2253 __FILE__, __LINE__, procName, errorMsg.str());
2256 for (
int slotIndex = 0; slotIndex < mdfITState->
childCount();
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);
2275 errorMsg = textGen.
text(
2277 errorMsg % slotName % iuName % templateName;
2279 errorMsg = textGen.
text(
2281 TXT_MULTIPLE_DESTINATIONS_IN_TEMPLATE_SLOT);
2282 errorMsg % slotName % templateName % iuName %
2284 TemplateSlot::OSKEY_DESTINATION);
2287 __FILE__, __LINE__, procName, errorMsg.str());
2310 const std::string& slotName) {
2312 for (
int i = 0; i < momITState->
childCount(); i++) {
2335 for (
int i = 0; i < momMachineState->
childCount(); i++) {
2337 if (child->
name() ==
2338 InstructionTemplate::OSNAME_INSTRUCTION_TEMPLATE &&