OpenASIP
2.0
|
#include <MachineStateBuilder.hh>
Public Member Functions | |
MachineStateBuilder (bool detailedSimulationModel=false) | |
virtual | ~MachineStateBuilder () |
MachineState * | build (const TTAMachine::Machine &machine, MemorySystem &memSys) |
MachineState * | build (const TTAMachine::Machine &machine, MemorySystem &memSys, FUConflictDetectorIndex &detectors, bool throwWhenConflict=true) |
MachineState * | build (const TTAMachine::Machine &machine, MemorySystem &memSys, StateLocator &locator) |
Private Member Functions | |
MachineStateBuilder (const MachineStateBuilder &) | |
Copying not allowed. More... | |
MachineStateBuilder & | operator= (const MachineStateBuilder &) |
Assignment not allowed. More... | |
MachineState * | buildMachineState (const TTAMachine::Machine &machine, MemorySystem &memSys, StateLocator &locator) |
void | addPortToFU (MachineState *machineState, TTAMachine::BaseFUPort *port, FUState *state, TTAMachine::FunctionUnit *fu, StateLocator &locator) |
void | addPortToFU (MachineState *machineState, TTAMachine::BaseFUPort *port, FUState *state, TTAMachine::FunctionUnit *fu, StateLocator &locator, SimValue &sharedRegister) |
void | bindPortsToOperands (OperationExecutor &executor, TTAMachine::HWOperation &hwOperation, MachineState &machineState, FUState &state, TTAMachine::FunctionUnit &unit) |
void | addVirtualOpcodeSettingPortsToFU (MachineState &machineState, FUState &state, TTAMachine::FunctionUnit &unit) |
Private Attributes | |
FUConflictDetectorIndex * | detectors_ |
The FU resource conflict detectors. They are needed while building the machine state model. More... | |
bool | throwWhenConflict_ |
True in case the built model should throw an exception in case of a resource conflict. More... | |
bool | detailedSimulationModel_ |
Set to true in case should build a detailed model which simulates FU stages, possibly with an external system-level model. More... | |
Builds MachineState from Machine Object Model.
Definition at line 62 of file MachineStateBuilder.hh.
MachineStateBuilder::MachineStateBuilder | ( | bool | detailedSimulationModel = false | ) |
Constructor.
Definition at line 84 of file MachineStateBuilder.cc.
|
virtual |
|
private |
Copying not allowed.
|
private |
Adds a port that does not share a register to FU.
machineState | Machine state which is built. |
port | Port to be added. |
state | FUState in which port is added. |
fu | FU of which FUState is build from. |
locator | StateLocator. |
Definition at line 644 of file MachineStateBuilder.cc.
References NullSimValue::instance().
Referenced by buildMachineState().
|
private |
Adds a port that shares a register to FU.
machineState | Machine state which is built. |
port | Port to be added. |
state | FUState in which port is added. |
fu | FU of which FUState is build from. |
locator | StateLocator. |
sharedRegister | The register the FUPort shares, if any. If this is set to NullSimValue then a new register (SimValue) is created for the FUPort. |
Definition at line 510 of file MachineStateBuilder.cc.
References FUState::addInputPortState(), FUState::addOutputPortState(), MachineState::addPortState(), StateLocator::addState(), TTAMachine::Port::inputSocket(), NullSimValue::instance(), TTAMachine::HWOperation::isBound(), TTAMachine::BaseFUPort::isOpcodeSetting(), TTAMachine::ExecutionPipeline::isPortRead(), TTAMachine::ExecutionPipeline::isPortWritten(), TTAMachine::BaseFUPort::isTriggering(), TTAMachine::ExecutionPipeline::latency(), TTAMachine::Port::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::Port::outputSocket(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::HWOperation::pipeline(), Application::warningStream(), and TTAMachine::BaseFUPort::width().
|
private |
Adds the virtual opcode-setting ports to the FU.
Expects that the FU is otherwise completely built.
machineState | The machine state to use. |
state | The FUState to add the ports. |
unit | The static function unit data from MOM. |
Definition at line 368 of file MachineStateBuilder.cc.
References __func__, FUState::addInputPortState(), FUState::addOperationExecutor(), MachineState::addOperationExecutor(), MachineState::addPortState(), assert, bindPortsToOperands(), detailedSimulationModel_, detectors_, Exception::errorMessage(), FUState::executor(), NullPortState::instance(), Operation::isNull(), TTAMachine::BaseFUPort::isOpcodeSetting(), TTAMachine::HWOperation::latency(), TTAMachine::HWOperation::name(), TTAMachine::Port::name(), TTAMachine::Component::name(), Operation::name(), TTAMachine::FunctionUnit::needsConflictDetection(), Operation::numberOfInputs(), Operation::numberOfOutputs(), OperationPool::operation(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), FUResourceConflictDetector::operationID(), SimulatorToolbox::operationPool(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), MachineState::portState(), StringTools::stringToLower(), and throwWhenConflict_.
Referenced by buildMachineState().
|
private |
Binds ports to operands.
Operands are bound for OperationExecutor which is not yet inserted to the machine.
executor | OperationExecutor to bind the ports for. |
machineState | MachineState to be built. |
state | FUState of which ports are bound. |
unit | FunctionUnit that owns the ports that are bound. |
IllegalMachine | If binding fails. |
Definition at line 667 of file MachineStateBuilder.cc.
References __func__, OperationExecutor::addBinding(), Exception::errorMessage(), NullOperation::instance(), TTAMachine::HWOperation::name(), TTAMachine::Port::name(), TTAMachine::Component::name(), Operation::numberOfInputs(), Operation::numberOfOutputs(), OperationPool::operation(), SimulatorToolbox::operationPool(), TTAMachine::HWOperation::port(), MachineState::portState(), Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), and Texts::TXT_OPERATION_X_NOT_FOUND.
Referenced by addVirtualOpcodeSettingPortsToFU().
MachineState * MachineStateBuilder::build | ( | const TTAMachine::Machine & | machine, |
MemorySystem & | memSys | ||
) |
Builds machine state from given machine.
machine | The machine of which machine state is built from. |
memSys | Memory system instance. |
IllegalMachine | If machine state building fails. |
Definition at line 104 of file MachineStateBuilder.cc.
References buildMachineState(), detectors_, and machine.
Referenced by RFTestbenchGenerator::createMachineState(), FUTestbenchGenerator::createMachineState(), and SimulationController::SimulationController().
MachineState * MachineStateBuilder::build | ( | const TTAMachine::Machine & | machine, |
MemorySystem & | memSys, | ||
FUConflictDetectorIndex & | detectors, | ||
bool | throwWhenConflict = true |
||
) |
Builds machine state from given machine.
This method allows giving an index of FU resource conflict detectors to create a model that detects FU resource conflicts.
machine | The machine of which machine state is built from. |
memSys | Memory system instance. |
detectors | The FU resource conflict detectors. |
throwWhenConflict | Builds a model that throws an exception in case of resource conflict is detected. |
IllegalMachine | If machine state building fails. |
Definition at line 128 of file MachineStateBuilder.cc.
References buildMachineState(), detectors_, machine, and throwWhenConflict_.
MachineState * MachineStateBuilder::build | ( | const TTAMachine::Machine & | machine, |
MemorySystem & | memSys, | ||
StateLocator & | locator | ||
) |
Builds machine state from given machine.
machine | Machine of which machine state is build from. |
memSys | Memory system. |
locator | Indexes states with components as keys. |
IllegalMachine | If machine state building fails. |
Definition at line 150 of file MachineStateBuilder.cc.
References buildMachineState(), detectors_, and machine.
|
private |
Builds MachineState from given Machine.
machine | Machine. |
memSys | Memory system. |
locator | State locator. |
IllegalMachine | If machine state building fails. |
Definition at line 168 of file MachineStateBuilder.cc.
References __func__, abortWithError, MachineState::addBusState(), MachineState::addFUState(), MachineState::addGCUState(), MachineState::addGuardState(), MachineState::addLongImmediateUnitState(), addPortToFU(), MachineState::addRegisterFileState(), TTAMachine::FunctionUnit::addressSpace(), StateLocator::addState(), addVirtualOpcodeSettingPortsToFU(), assert, TTAMachine::Machine::busNavigator(), AddressSpaceCheck::check(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::ControlUnit::delaySlots(), MachineCheckResults::error(), Exception::errorMessage(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::ControlUnit::globalGuardLatency(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::RegisterFile::guardLatency(), TTAMachine::ControlUnit::hasReturnAddressPort(), TTAMachine::Machine::immediateUnitNavigator(), NullPortState::instance(), NullRegisterFileState::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, MemorySystem::memory(), TTAMachine::Port::name(), TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), SimulatorToolbox::operationPool(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::FunctionUnit::port(), TTAMachine::PortGuard::port(), TTAMachine::Unit::portCount(), MachineState::portState(), TTAMachine::RegisterGuard::registerFile(), TTAMachine::Machine::registerFileNavigator(), MachineState::registerFileState(), TTAMachine::RegisterGuard::registerIndex(), RegisterFileState::registerState(), TTAMachine::ControlUnit::returnAddressPort(), GCUState::returnAddressRegister(), TTAMachine::Machine::SIGN, SimulatorToolbox::textGenerator(), Texts::TXT_ILLEGAL_PROGRAM_PORT_STATE_NOT_FOUND, Texts::TXT_ILLEGAL_PROGRAM_RF_STATE_NOT_FOUND, TTAMachine::BaseRegisterFile::width(), TTAMachine::Bus::width(), and TTAMachine::RegisterFile::zeroRegister().
Referenced by build().
|
private |
Assignment not allowed.
|
private |
Set to true in case should build a detailed model which simulates FU stages, possibly with an external system-level model.
Definition at line 128 of file MachineStateBuilder.hh.
Referenced by addVirtualOpcodeSettingPortsToFU().
|
private |
The FU resource conflict detectors. They are needed while building the machine state model.
Definition at line 120 of file MachineStateBuilder.hh.
Referenced by addVirtualOpcodeSettingPortsToFU(), and build().
|
private |
True in case the built model should throw an exception in case of a resource conflict.
Definition at line 124 of file MachineStateBuilder.hh.
Referenced by addVirtualOpcodeSettingPortsToFU(), and build().