63const string MDF =
"adf";
78const string BUS =
"bus";
323 for (
int i = 0; i < machineState->
childCount(); i++) {
331 for (
int i = 0; i < machineState->
childCount(); i++) {
339 for (
int i = 0; i < machineState->
childCount(); i++) {
347 for (
int i = 0; i < machineState->
childCount(); i++) {
355 for (
int i = 0; i < machineState->
childCount(); i++) {
363 for (
int i = 0; i < machineState->
childCount(); i++) {
371 for (
int i = 0; i < machineState->
childCount(); i++) {
379 for (
int i = 0; i < machineState->
childCount(); i++) {
387 for (
int i = 0; i < machineState->
childCount(); i++) {
395 for (
int i = 0; i < machineState->
childCount(); i++) {
430 for (
int i = 0; i < busState->
childCount(); i++) {
438 string unitNameAttrib;
439 string targetNameAttrib;
446 }
else if (child->
name() ==
463 guardChild->
addChild(conditionalChild);
465 conditionalChild->
addChild(typeChild);
473 }
else if (child->
name() ==
488 for (
int i = 0; i < busState->
childCount(); i++) {
515 string procName =
"MDFSerialiser::busToMDF";
516 string errorMsg =
"Unknown extension attribute value in ObjectState "
522 sImmChild->
addChild(extensionChild);
524 sImmChild->
addChild(sImmWidthChild);
560 for (
int i = 0; i < socketState->
childCount(); i++) {
636 for (
int i = 0; i < fuState->
childCount(); i++) {
687 string procName =
"ADFSerializer::registerFileToMDF";
688 string errorMsg =
"Unknown register file type in ObjectState "
720 for (
int i = 0; i < rfState->
childCount(); i++) {
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++) {
827 for (
int iTempIndex = 0; iTempIndex < machineState->
childCount();
882 for (
int i = 0; i < asState->
childCount(); i++) {
912 for (
int i = 0; i < cuState->
childCount(); i++) {
920 for (
int i = 0; i < cuState->
childCount(); i++) {
936 for (
int i = 0; i < cuState->
childCount(); i++) {
981 return immediateSlot;
1000 int orderNumber = 0;
1003 for (
int i = 0; i < mdfState->
childCount(); i++) {
1018 }
else if (child->
name() ==
BUS) {
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 !=
"") {
1122 string objectStateName;
1123 string unitNameElem;
1124 string unitNameAttrib;
1125 string targetNameElem;
1126 string targetNameAttrib;
1140 string procName =
"ADFSerializer::busToMachine";
1141 string errorMsg =
"Unknown ObjectState name.";
1143 __FILE__, __LINE__, procName, errorMsg);
1197 for (
int i = 0; i < socketState->
childCount(); i++) {
1262 const int orderNumber) {
1279 for (
int i = 0; i < fuState->
childCount(); i++) {
1326 string procName =
"ADFSerializer::registerFileToMachine";
1327 string errorMsg =
"Unknown register file type in ObjectState "
1362 for (
int i = 0; i < rfState->
childCount(); i++) {
1420 for (
int i = 0; i < asState->
childCount(); i++) {
1472 for (
int i = 0; i < cuState->
childCount(); i++) {
1484 if (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);
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());
1640 ImmediateSlot::OSKEY_NAME,
1642 return immediateSlot;
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);
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));
1769 string procName =
"ADFSerializer::setIUExtensionMode";
1770 string errorMsg =
"Unknown extension attribute value in ObjectState "
1798 for (
int i = 0; i < mdfPortState->
childCount(); i++) {
1870 for (
int i = 0; i < mdfFUPortState->
childCount(); i++) {
1919 FUPort::OSKEY_WIDTH));
1958 for (
int i = 0; i < mdfOperationState->
childCount(); i++) {
2003 for (
int i = 0; i < machineOperationState->
childCount(); i++) {
2040 for (
int i = 0; i < mdfPipelineState->
childCount(); i++) {
2062 const string procName =
"ADFSerializer::machinePipeline";
2063 const string errorMsg =
"Given pipeline model is invalid.";
2065 __FILE__, __LINE__, procName, errorMsg);
2099 for (
int i = 0; i < machinePipelineState->
childCount(); i++) {
2108 }
else if (resChild->
name() ==
2114 }
else if (resChild->
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() ==
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) {
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 %
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() ==
const string FU_PORT_WIDTH
const string TEMPLATE_FU_READ
const string FU_ADDRESS_SPACE
const string FUNCTION_UNITS_ORDERED
const string ADDRESS_SPACE
const string FU_OP_PL_RESOURCE
const string ALWAYS_WRITE_BACK_RESULTS
const string CU_ADDRESS_SPACE
const string FU_OP_PL_RES_START_CYCLE
const string GUARD_UNIT_PORT
const string IU_TEMPLATE_NAME
const string AS_MAX_ADDRESS
const string CONTROL_UNIT
const string IU_TEMPLATE_SLOT_NAME
const string FUNCTION_UNIT
const string RF_TYPE_VOLATILE
const string ADF_SCHEMA_FILE
const string SIGN_EXTENSION
const string TEMPLATE_RF_WRITE
const string FU_PORT_NO_REGISTER
const string FU_OPERATION
const string FU_OP_PL_RES_CYCLES
const string IU_EXTENSION
const string BRIDGE_WRITES_TO
const string SOCKET_READS_FROM
const string REGISTER_FILE
const string CU_SPECIAL_PORT
const string CU_GUARD_LATENCY
const string IU_TYPE_RESERVED
const string IMMEDIATE_UNIT
const string GUARD_REGFILE_NAME
const string ALWAYS_FALSE_GUARD
const string SHORT_IMM_EXTENSION
const string SOCKET_WRITES_TO
const string SHORT_IMM_WIDTH
const string ALWAYS_TRUE_GUARD
const string RF_GUARD_LATENCY
const string MDF_VERSION_NUMBER
const string RF_TYPE_RESERVED
const string GUARD_REGFILE_INDEX
const string BRIDGE_READS_FROM
const string FU_PORT_SETS_OPCODE
const string INVERTED_EXPR
const string IU_GUARD_LATENCY
const string GUARD_UNIT_NAME
const string FU_OP_PL_WRITES
const string RF_MAX_WRITES
const string PORT_CONNECTS_TO
const string IU_TEMPLATE_BUS
const string IU_MAX_WRITES
const string FU_OP_PL_READS
const string CU_DELAY_SLOTS
const string SHORT_IMMEDIATE
const string CU_RETURN_ADDRESS
const string SEGMENT_NAME
const string TEMPLATE_FU_WRITE
const string AS_MIN_ADDRESS
const string RF_ZERO_REGISTER
const string SOCKET_SEGMENT
const string AS_NUMERICAL_ID
const string TEMPLATE_RF_READ
const string SEGMENT_WRITES_TO
const string FU_PORT_TRIGGERS
const string RF_MAX_READS
const string LITTLE_ENDIAN_MACHINE
const string IU_TEMPLATE_SLOT_WIDTH
const string FU_OP_BIND_NAME
const string IU_TYPE_NORMAL
const string IU_MAX_READS
const string FU_OP_PL_READS_NAME
const string FU_OP_PL_WRITES_NAME
const string IU_TYPE_VOLATILE
const string IMMEDIATE_SLOT
const string FU_OP_PL_RES_NAME
const string IU_TEMPLATE_SLOT
const string ZERO_EXTENSION
const string AS_SHARED_MEMORY
const string FU_OP_PIPELINE
const string CU_CTRL_OPERATION
const string RF_TYPE_NORMAL
const string IMMEDIATE_SLOT_NAME
const string TRIGGER_INVALIDATES_OLD_RESULTS
#define assert(condition)
const string IMMEDIATE_SLOT
const string IMMEDIATE_SLOT_NAME
TTAMachine::Machine * machine
the architecture definition of the estimated processor
#define PORT(FUNAME, PORTNAME)
@ TXT_EMPTY_IT_NOT_DECLARED
@ TXT_IT_EMPTY_AND_NON_EMPTY
static ObjectState * convertToMachineFormat(const ObjectState *mdfState)
void writeMachine(const TTAMachine::Machine &machine)
TTAMachine::Machine * readMachine()
static ObjectState * machineOperation(const ObjectState *mdfOperationState)
static ObjectState * immediateUnitToMachine(const ObjectState *iuState, ObjectState *machineState)
static ObjectState * addressSpaceToMDF(const ObjectState *asState)
static ObjectState * momTemplateSlot(const ObjectState *momITState, const std::string &busName)
static bool hasEmptyInstructionTemplate(const ObjectState *momMachineState)
static ObjectState * mdfSRPort(const ObjectState *machineSRPortState)
static ObjectState * controlUnitToMDF(const ObjectState *cuState)
static ObjectState * controlUnitToMachine(const ObjectState *cuState)
static ObjectState * machineSRPort(const ObjectState *mdfSRPortState)
static ObjectState * mdfOperation(const ObjectState *machineOperationState)
static ObjectState * functionUnitToMDF(const ObjectState *fuState)
static ObjectState * functionUnitToMachine(const ObjectState *fuState, const int orderNumber)
static ObjectState * busToMachine(const ObjectState *busState)
static ObjectState * machineRFPort(const ObjectState *mdfPortState)
static ObjectState * mdfPort(const ObjectState *machinePortState)
static ObjectState * socketToMachine(const ObjectState *socketState)
void writeState(const ObjectState *machineState)
static ObjectState * addressSpaceToMachine(const ObjectState *asState)
static ObjectState * registerFileToMachine(const ObjectState *rfState)
static void instructionTemplateToMachine(const ObjectState *mdfITState, ObjectState *momMachineState, const std::string &iuName=std::string(""))
static ObjectState * bridgeToMachine(const ObjectState *bridgeState)
static ObjectState * immediateSlotToMDF(const ObjectState *isState)
static ObjectState * machinePipeline(const ObjectState *mdfPipelineState)
static ObjectState * convertToMDFFormat(const ObjectState *machineState)
static ObjectState * immediateSlotToMachine(const ObjectState *isState)
static void instructionTemplateToMDF(const ObjectState *momITState, ObjectState *mdfIUState)
static ObjectState * machineFUPort(const ObjectState *mdfFUPortState)
static ObjectState * mdfPipeline(const ObjectState *machinePipelineState)
static ObjectState * socketToMDF(const ObjectState *socketState)
ObjectState * readState()
static ObjectState * mdfFUPort(const ObjectState *machineFUPortState)
static ObjectState * immediateUnitToMDF(const ObjectState *iuState, const ObjectState *machineState)
static void setIUExtensionMode(const ObjectState *mdfIUState, ObjectState *momIUState)
static ObjectState * bridgeToMDF(const ObjectState *bridgeState)
static ObjectState * busToMDF(const ObjectState *busState)
static ObjectState * registerFileToMDF(const ObjectState *rfState)
static void abortProgram() __attribute__((noreturn))
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
static std::string schemaDirPath(const std::string &prog)
bool hasAttribute(const std::string &name) const
ObjectState * childByName(const std::string &name) const
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void setValue(const std::string &value)
bool hasChild(const std::string &name) const
ObjectState * child(int index) const
void addChild(ObjectState *child)
std::string stringAttribute(const std::string &name) const
bool boolAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string stringValue() const
static const std::string OSKEY_NUMERICAL_ID
static const std::string OSNAME_ADDRESS_SPACE
ObjectState name for AddressSpace.
static const std::string OSKEY_SHARED_MEMORY
static const std::string OSKEY_MAX_ADDRESS
ObjectState attribute key for maximum address.
static const std::string OSKEY_MIN_ADDRESS
ObjectState attribute key for minimum address.
static const std::string OSKEY_WIDTH
ObjectState attribute key for the bit width.
static const std::string OSKEY_SIZE
ObjectState attribute key for the number of registers.
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width of the registers.
static const std::string OSNAME_BRIDGE
ObjectState name for bridge.
static const std::string OSKEY_DESTINATION_BUS
ObjectState attribute key for destination bus name.
static const std::string OSKEY_SOURCE_BUS
ObjectState attribute key for source bus name.
static const std::string OSKEY_EXTENSION
ObjectState attribute key for extension mode.
static const std::string OSKEY_WIDTH
ObjectState attribute key for bus width.
static const std::string OSNAME_BUS
ObjectState name for Bus ObjectState.
static const std::string OSVALUE_ZERO
ObjectState attribute key for zero extension.
static const std::string OSVALUE_SIGN
ObjectState attribute value for sign extension.
static const std::string OSKEY_IMMWIDTH
ObjectState attribute key for immediate width.
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the component.
static const std::string OSKEY_SEGMENT
ObjectState attribute key for segment name.
static const std::string OSKEY_BUS
ObjectState attribute key for bus name.
static const std::string OSKEY_SOCKET
ObjectState attribute key for socket name.
static const std::string OSNAME_CONNECTION
ObjectState name for Connection.
static const std::string OSNAME_CONTROL_UNIT
ObjectState name for ControlUnit.
static const std::string OSKEY_DELAY_SLOTS
ObjectState attribute key for the number of delay slots.
static const std::string OSKEY_GUARD_LATENCY
ObjectState attribute key for the global guard latency.
static const std::string OSKEY_RA_PORT
ObjectState attribute key for the name of the return address port.
static const std::string OSKEY_RESOURCE_NAME
ObjectState attribute key for name of resource.
static const std::string OSNAME_OPERAND_WRITE
ObjectState name for operand write.
static const std::string OSKEY_START_CYCLE
ObjectState attribute key for start cycle of a resource usage.
static const std::string OSKEY_OPERAND
ObjectState attribute key for operand number.
static const std::string OSNAME_OPERAND_READ
ObjectState name for operand read.
static const std::string OSNAME_PIPELINE
ObjectState name for ExecutionPipeline.
static const std::string OSNAME_RESOURCE_USAGE
ObjectState name for pipeline resource usage.
static const std::string OSKEY_CYCLES
ObjectState attribute key for duration of a resource usage.
static const std::string OSNAME_FUPORT
ObjectState name for FUPort.
static const std::string OSKEY_OPCODE_SETTING
ObjectState attribute key for operand code setting feature.
static const std::string OSKEY_NO_REGISTER
ObjectState attribute key for noRegister setting feature.
static const std::string OSKEY_TRIGGERING
ObjectState attribute key for triggering feature.
static const std::string OSNAME_FU
ObjectState name for function unit.
static const std::string OSKEY_AS
ObjectState attribute key for name of the address space.
static const std::string OSKEY_ORDER_NUMBER
ObjectState attribute key for FU order number name.
static const std::string OSKEY_INVERTED
ObjectState attribute key for inverted feature.
static const std::string OSKEY_NAME
ObjectState attribute key for name of the operation.
static const std::string OSKEY_PORT
ObjectState attribute key for port name.
static const std::string OSKEY_OPERAND
ObjectState attribute key for operand index.
static const std::string OSNAME_OPERAND_BINDING
ObjectState name for an operand binding.
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.
static const std::string OSNAME_INSTRUCTION_TEMPLATE
ObjectState name for instruction template.
static const std::string OSKEY_ALWAYS_WRITE_BACK_RESULTS
ObjectState attribute key for always-write-back-results.
static const std::string OSKEY_TRIGGER_INVALIDATES_OLD_RESULTS
ObjectState attribute key for trigger-invalidates-old-results.
virtual void loadState(const ObjectState *state)
virtual ObjectState * saveState() const
static const std::string OSKEY_FUNCTION_UNITS_ORDERED
ObjectState attribute key for function units ordered in order of their sequential presence in ADF.
static const std::string OSNAME_MACHINE
ObjectState name for Machine.
static const std::string OSKEY_PORT
ObjectState attribute key for port name.
static const std::string OSKEY_FU
ObjectState attribute key for function unit name.
static const std::string OSNAME_PORT_GUARD
ObjectState name for PortGuard ObjectState.
static const std::string OSKEY_FIRST_SOCKET
ObjectState attribute key for the name of the connected socket.
static const std::string OSKEY_SECOND_SOCKET
ObjectState attribute key for the name of the other connected socket.
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the port.
static const std::string OSNAME_RFPORT
ObjectState name for register file port.
static const std::string OSKEY_MAX_WRITES
ObjectState attribute key for maximum simultaneous writers.
static const std::string OSKEY_MAX_READS
ObjectState attribute key for maximum simultaneous readers.
static const std::string OSKEY_ZERO_REGISTER
ObjectState attribute key for zero register flag.
static const std::string OSKEY_GUARD_LATENCY
ObjectState attribute key for the guard latency.
static const std::string OSVALUE_RESERVED
ObjectState attribute value for reserved register file type.
static const std::string OSVALUE_VOLATILE
ObjectState attribute value for volatile register file type.
static const std::string OSKEY_TYPE
ObjectState attribute key for register file type.
static const std::string OSNAME_REGISTER_FILE
ObjectState name for RegisterFile.
static const std::string OSVALUE_NORMAL
ObjectState attribute value for normal register file type.
static const std::string OSNAME_REGISTER_GUARD
ObjectState name for RegisterGuard.
static const std::string OSKEY_INDEX
ObjectState attribute key for register index.
static const std::string OSKEY_REGFILE
ObjectState attribute key for register file name.
static const std::string OSKEY_DESTINATION
ObjectState attribute key for destination segment name.
static const std::string OSNAME_SEGMENT
ObjectState name for Segment.
static const std::string OSKEY_NAME
ObjectState attribute key for segment name.
static const std::string OSVALUE_INPUT
ObjectState attribute value for input direction.
static const std::string OSNAME_SOCKET
ObjectState name for socket.
static const std::string OSKEY_DIRECTION
ObjectState attribute key for socket direction.
static const std::string OSVALUE_OUTPUT
ObjectState attribute value for output direction.
static const std::string OSVALUE_UNKNOWN
ObjectState attribute value for unknown direction.
static const std::string OSNAME_SPECIAL_REG_PORT
ObjectState name for special register port.
static const std::string OSNAME_TEMPLATE_SLOT
ObjectState name for template slot.
static const std::string OSKEY_SLOT
ObjectState attribute key for slot name.
static const std::string OSKEY_DESTINATION
ObjectState attribute key for destination.
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width.
static const std::string OSNAME_UNCONDITIONAL_GUARD
ObjectState name for UnconditionalGuard.
virtual boost::format text(int textId)
void setUseSchema(bool useSchema)
void setSchemaFile(const std::string &fileName)
virtual void writeState(const ObjectState *rootState)
virtual ObjectState * readState()