OpenASIP
2.0
|
#include <ADFSerializer.hh>
Public Member Functions | |
ADFSerializer () | |
virtual | ~ADFSerializer () |
void | writeState (const ObjectState *machineState) |
ObjectState * | readState () |
void | writeMachine (const TTAMachine::Machine &machine) |
TTAMachine::Machine * | readMachine () |
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... | |
ADFSerializer & | operator= (const ADFSerializer &) |
Assingment forbidden. More... | |
Protected Member Functions inherited from XMLSerializer | |
std::string | sourceFile () const |
Static Private Member Functions | |
static ObjectState * | convertToMDFFormat (const ObjectState *machineState) |
static ObjectState * | busToMDF (const ObjectState *busState) |
static ObjectState * | socketToMDF (const ObjectState *socketState) |
static ObjectState * | bridgeToMDF (const ObjectState *bridgeState) |
static ObjectState * | functionUnitToMDF (const ObjectState *fuState) |
static ObjectState * | registerFileToMDF (const ObjectState *rfState) |
static ObjectState * | immediateUnitToMDF (const ObjectState *iuState, const ObjectState *machineState) |
static ObjectState * | addressSpaceToMDF (const ObjectState *asState) |
static ObjectState * | controlUnitToMDF (const ObjectState *cuState) |
static ObjectState * | immediateSlotToMDF (const ObjectState *isState) |
static ObjectState * | convertToMachineFormat (const ObjectState *mdfState) |
static ObjectState * | busToMachine (const ObjectState *busState) |
static ObjectState * | socketToMachine (const ObjectState *socketState) |
static ObjectState * | bridgeToMachine (const ObjectState *bridgeState) |
static ObjectState * | functionUnitToMachine (const ObjectState *fuState, const int orderNumber) |
static ObjectState * | registerFileToMachine (const ObjectState *rfState) |
static ObjectState * | addressSpaceToMachine (const ObjectState *asState) |
static ObjectState * | controlUnitToMachine (const ObjectState *cuState) |
static ObjectState * | immediateUnitToMachine (const ObjectState *iuState, ObjectState *machineState) |
static ObjectState * | immediateSlotToMachine (const ObjectState *isState) |
static ObjectState * | machineSRPort (const ObjectState *mdfSRPortState) |
static ObjectState * | mdfSRPort (const ObjectState *machineSRPortState) |
static void | setIUExtensionMode (const ObjectState *mdfIUState, ObjectState *momIUState) |
static ObjectState * | machineRFPort (const ObjectState *mdfPortState) |
static ObjectState * | mdfPort (const ObjectState *machinePortState) |
static ObjectState * | machineFUPort (const ObjectState *mdfFUPortState) |
static ObjectState * | mdfFUPort (const ObjectState *machineFUPortState) |
static ObjectState * | machineOperation (const ObjectState *mdfOperationState) |
static ObjectState * | mdfOperation (const ObjectState *machineOperationState) |
static ObjectState * | machinePipeline (const ObjectState *mdfPipelineState) |
static ObjectState * | mdfPipeline (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 ObjectState * | momTemplateSlot (const ObjectState *momITState, const std::string &busName) |
static bool | hasEmptyInstructionTemplate (const ObjectState *momMachineState) |
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.
ADFSerializer::ADFSerializer | ( | ) |
Constructor.
Definition at line 203 of file ADFSerializer.cc.
References ADF_SCHEMA_FILE, Environment::schemaDirPath(), XMLSerializer::setSchemaFile(), and XMLSerializer::setUseSchema().
|
virtual |
|
protected |
Copying forbidden.
|
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.
asState | The ObjectState tree which matches with the syntax of address space declaration in MDF file. |
Definition at line 1391 of file ADFSerializer.cc.
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().
|
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.
asState | Root node of the ObjectState tree created by AddressSpace::saveState. |
Definition at line 852 of file ADFSerializer.cc.
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().
|
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.
bridgeState | The ObjectState tree which matches with the syntax of bridge declaration in MDF file. |
Definition at line 1232 of file ADFSerializer.cc.
References BRIDGE_NAME, BRIDGE_READS_FROM, BRIDGE_WRITES_TO, ObjectState::childByName(), ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().
Referenced by convertToMachineFormat().
|
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.
bridgeState | Root node of the ObjectState tree created by Bridge::saveState. |
Definition at line 597 of file ADFSerializer.cc.
References ObjectState::addChild(), BRIDGE, BRIDGE_NAME, BRIDGE_READS_FROM, BRIDGE_WRITES_TO, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().
Referenced by convertToMDFFormat().
|
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.
busState | The ObjectState tree declaring a bus by MDF syntax. |
Definition at line 1064 of file ADFSerializer.cc.
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().
|
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.
busState | Root node of the ObjectState tree created by Bus::saveState. |
Definition at line 419 of file ADFSerializer.cc.
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().
|
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.
cuState | The ObjectState tree which matches with the syntax of control unit declaration in MDF file. |
Definition at line 1446 of file ADFSerializer.cc.
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().
|
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.
cuState | Root node of the ObjectState tree created by ControlUnit::saveState. |
Definition at line 905 of file ADFSerializer.cc.
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().
|
staticprivate |
Creates a new ObjectState tree which can be read by Machine::loadState and which corresponds with the given ObjectState tree.
mdfState | An ObjectState tree whose structure matches with MDF file structure. |
SerializerException | If an error occurs while converting. |
Definition at line 995 of file ADFSerializer.cc.
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().
|
staticprivate |
Converts the given ObjectState tree created by Machine to correspond with MDF format.
machineState | Root of the ObjectState tree. |
Definition at line 292 of file ADFSerializer.cc.
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().
|
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.
fuState | The ObjectState tree which matches with the syntax of function unit declaration in MDF file. |
orderNumber | The number indicating sequential position of the FU in the ADF. |
Definition at line 1260 of file ADFSerializer.cc.
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().
|
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.
fuState | Root node of the ObjectState tree created by FunctionUnit::saveState. |
Definition at line 629 of file ADFSerializer.cc.
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().
|
staticprivate |
Checks whether the machine represented by the given ObjectState tree contains an empty instruction template.
momMachineState | The ObjectState tree. |
Definition at line 2332 of file ADFSerializer.cc.
References ObjectState::child(), ObjectState::childCount(), and ObjectState::name().
Referenced by immediateUnitToMachine().
|
staticprivate |
Creates an ObjectState instance that can be loaded by ImmediateSlot instance.
isState | An ObjectState instance that represents an immediate-slot element of ADF file. |
Definition at line 1636 of file ADFSerializer.cc.
References IMMEDIATE_SLOT_NAME, ObjectState::setAttribute(), and ObjectState::stringAttribute().
Referenced by convertToMachineFormat().
|
staticprivate |
Creates a new ObjectState instance that matches with the syntax of immediate-slot element in ADF file.
isState | ObjectState instance representing ImmediateSlot instance. |
Definition at line 976 of file ADFSerializer.cc.
References IMMEDIATE_SLOT, IMMEDIATE_SLOT_NAME, ObjectState::setAttribute(), and ObjectState::stringAttribute().
Referenced by convertToMDFFormat().
|
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.
iuState | The ObjectState tree which matches with the syntax of immediate unit declaration in MDF file. |
machineState | The ObjectState tree containing tree instruction templates as child objects. |
SerializerException | If an error occurs while processing. |
Definition at line 1517 of file ADFSerializer.cc.
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().
|
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.
iuState | Root node of the ObjectState tree created by ImmediateUnit::saveState. |
machineState | The ObjectState tree created by Machine::saveState. |
Definition at line 751 of file ADFSerializer.cc.
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().
|
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.
mdfITState | ObjectState instance representing a template element. |
momMachineState | ObjectState instance representing a machine in machine object model format. |
iuName | Name of the immediate unit which contains the template element. |
SerializerException | If an error is occurred while processing. |
Definition at line 2215 of file ADFSerializer.cc.
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().
|
staticprivate |
Includes the given instruction template information to ObjectState tree representing immediate unit in mdf format.
momITState | ObjectState instance representing an instruction template in machine object model format. |
mdfIUState | ObjectState instance representing an immediate unit in mdf format. |
Definition at line 2149 of file ADFSerializer.cc.
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().
|
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.
mdfFUPortState | ObjectState instance representing a function port in mdf format. |
Definition at line 1863 of file ADFSerializer.cc.
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().
|
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.
mdfOperationState | ObjectState instance representing an operation in mdf format. |
Definition at line 1949 of file ADFSerializer.cc.
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().
|
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.
mdfPipelineState | ObjectState instance representing a pipeline in mdf format. |
Definition at line 2035 of file ADFSerializer.cc.
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().
|
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.
mdfPortState | ObjectState instance representing a normal port in mdf format. |
Definition at line 1792 of file ADFSerializer.cc.
References ObjectState::child(), ObjectState::childCount(), PORT_NAME, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().
Referenced by immediateUnitToMachine(), and registerFileToMachine().
|
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.
mdfSRPortState | ObjectState instance representing a special register port in mdf format. |
Definition at line 1659 of file ADFSerializer.cc.
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().
|
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.
machineFUPortState | ObjectState instance representing a function unit port in machine object model format. |
Definition at line 1914 of file ADFSerializer.cc.
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().
|
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.
machineOperationState | ObjectState instance representing an operation in machine object model format. |
Definition at line 1994 of file ADFSerializer.cc.
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().
|
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.
machinePipelineState | ObjectState instance representing a pipeline in machine object model format. |
Definition at line 2095 of file ADFSerializer.cc.
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().
|
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.
machinePortState | ObjectState instance representing a normal port in machine object model format. |
Definition at line 1826 of file ADFSerializer.cc.
References ObjectState::addChild(), ObjectState::hasAttribute(), PORT, PORT_CONNECTS_TO, PORT_NAME, ObjectState::setAttribute(), ObjectState::setValue(), and ObjectState::stringAttribute().
Referenced by immediateUnitToMDF(), mdfFUPort(), and registerFileToMDF().
|
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.
machineSRPortState | ObjectState instance representing a special register port in machine object model format. |
Definition at line 1712 of file ADFSerializer.cc.
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().
|
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.
momITState | An ObjectState instance representing an instruction template in machine object model format. |
busName | The name of the slot to look the template slot for. |
Definition at line 2308 of file ADFSerializer.cc.
References ObjectState::child(), ObjectState::childCount(), and ObjectState::stringAttribute().
Referenced by instructionTemplateToMachine().
|
protected |
Assingment forbidden.
Machine * ADFSerializer::readMachine | ( | ) |
Reads the current MDF file set and creates a Machine according to it.
SerializerException | If an error occurs while reading the MDF file. |
ObjectStateLoadingException | If an error occurs while creating Machine. |
Definition at line 275 of file ADFSerializer.cc.
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().
|
virtual |
Reads the current MDF file set and creates an ObjectState tree which can be given to Machine::loadState to create a machine.
SerializerException | If an error occurs while reading. |
Reimplemented from XMLSerializer.
Definition at line 238 of file ADFSerializer.cc.
References convertToMachineFormat(), and XMLSerializer::readState().
Referenced by DSDBManager::architecture(), readMachine(), and DSDBManager::writeArchitectureToFile().
|
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.
rfState | The ObjectState tree which matches with the syntax of register file declaration in MDF file. |
Definition at line 1304 of file ADFSerializer.cc.
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().
|
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.
rfState | Root node of the ObjectState tree created by RegisterFile::saveState. |
Definition at line 671 of file ADFSerializer.cc.
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().
|
staticprivate |
Sets extension mode of immediate unit to the given ObjectState tree representing immediate unit in machine object model format.
mdfIUState | ObjectState instance representing immediate unit in mdf format. |
momIUState | ObjectState instance representing immediate unit in machine object model format. |
Definition at line 1756 of file ADFSerializer.cc.
References Application::abortProgram(), ObjectState::childByName(), IU_EXTENSION, ObjectState::setAttribute(), SIGN_EXTENSION, ObjectState::stringValue(), Application::writeToErrorLog(), and ZERO_EXTENSION.
Referenced by immediateUnitToMachine().
|
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.
socketState | The ObjectState tree declaring a socket by MDF syntax. |
Definition at line 1176 of file ADFSerializer.cc.
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().
|
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.
socketState | Root node of the ObjectState tree created by Socket::saveState. |
Definition at line 543 of file ADFSerializer.cc.
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().
void ADFSerializer::writeMachine | ( | const TTAMachine::Machine & | machine | ) |
Serializes the given machine to mdf file.
machine | The machine to be serialized. |
SerializerException | If an error occurs while serializing. |
Definition at line 259 of file ADFSerializer.cc.
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().
|
virtual |
Writes the given ObjectState tree created by Machine::saveState to the destination file.
machineState | ObjectState tree created by Machine::saveState. |
SerializerException | If an error occurs while serializing. |
Reimplemented from XMLSerializer.
Definition at line 224 of file ADFSerializer.cc.
References convertToMDFFormat(), and XMLSerializer::writeState().
Referenced by DSDBManager::addArchitecture(), DSDBManager::writeArchitectureToFile(), and writeMachine().