OpenASIP
2.0
|
#include <CompiledSimController.hh>
Public Types | |
typedef CompiledSimulation *() | SimulationGetterFunction(const TTAMachine::Machine &machine, InstructionAddress entryAddress, InstructionAddress lastInstruction, SimulatorFrontend &frontend, CompiledSimController &controller, MemorySystem &memorySystem, bool dynamicCompilation, ProcedureBBRelations &procedureBBRelations) |
Function type for the getSimulation() function. More... | |
Public Types inherited from TTASimulationController | |
enum | SimulationStatus { STA_INITIALIZING, STA_INITIALIZED, STA_RUNNING, STA_STOPPED, STA_FINISHED } |
The states of simulation. More... | |
Private Member Functions | |
CompiledSimController (const CompiledSimController &) | |
Copying not allowed. More... | |
CompiledSimController & | operator= (const CompiledSimController &) |
Assignment not allowed. More... | |
Private Attributes | |
PluginTools | pluginTools_ |
Used for loading the compiled simulation plugin. More... | |
boost::shared_ptr< CompiledSimulation > | simulation_ |
Pointer to the loaded simulation. More... | |
std::string | compiledSimulationPath_ |
Path to the generated simulation files. More... | |
bool | leaveDirty_ |
True, if the simulation should leave all the generated code files. More... | |
CompiledSimCodeGenerator::AddressMap | basicBlocks_ |
A map containing the basic blocks' start..end pairs. More... | |
ProcedureBBRelations | procedureBBRelations_ |
A struct for tracking basic blocks and their relation to their procedures. More... | |
int | instanceId_ |
The unique identifier for this simulation engine. Used for enabling multiple compiled engines in the same process while still having ccache hits (which would not happen when using the object address as the id). More... | |
Additional Inherited Members | |
Protected Types inherited from TTASimulationController | |
typedef std::set< StopReason > | StopReasonContainer |
The container type for reasons why simulation stop was requested. More... | |
Protected Member Functions inherited from TTASimulationController | |
TTASimulationController (const TTASimulationController &) | |
Copying not allowed. More... | |
TTASimulationController & | operator= (const TTASimulationController &) |
Assignment not allowed. More... | |
Protected Attributes inherited from TTASimulationController | |
SimulatorFrontend & | frontend_ |
Reference to the simulator frontend. More... | |
const TTAMachine::Machine & | sourceMachine_ |
The simulated Machine Object Model. More... | |
const TTAProgram::Program & | program_ |
Program object model of the simulated program. More... | |
bool | stopRequested_ |
Flag indicating that simulation should stop. More... | |
StopReasonContainer | stopReasons_ |
The set of reasons the simulation was stopped. More... | |
SimulationStatus | state_ |
The current state of the simulation. More... | |
ClockCycleCount | clockCount_ |
How many clock cycles have been simulated. More... | |
std::vector< InstructionAddress > | lastExecutedInstruction_ |
The address of the last executed instruction. More... | |
InstructionAddress | initialPC_ |
The address of the first executed instruction. More... | |
bool | automaticFinishImpossible_ |
If this is true, simulation cannot be finished automatically. More... | |
InstructionAddress | firstIllegalInstructionIndex_ |
The index of the first illegal instruction in the instruction sequence. More... | |
A Simulation controller that uses the compiled simulation techniques.
Definition at line 52 of file CompiledSimController.hh.
typedef CompiledSimulation*() CompiledSimController::SimulationGetterFunction(const TTAMachine::Machine &machine, InstructionAddress entryAddress, InstructionAddress lastInstruction, SimulatorFrontend &frontend, CompiledSimController &controller, MemorySystem &memorySystem, bool dynamicCompilation, ProcedureBBRelations &procedureBBRelations) |
Function type for the getSimulation() function.
Definition at line 81 of file CompiledSimController.hh.
CompiledSimController::CompiledSimController | ( | SimulatorFrontend & | frontend, |
const TTAMachine::Machine & | machine, | ||
const TTAProgram::Program & | program, | ||
bool | leaveDirty = false |
||
) |
The constructor
frontend | Simulator frontend |
machine | The machine model |
program | The program to be simulated |
leaveDirty | Set to true in case the engine should not clean up the source files to the engine (in /tmp) after finishing, e.g., for debugging purposes. |
Definition at line 68 of file CompiledSimController.cc.
References instanceId_, leaveDirty_, and reset().
|
virtual |
The destructor
Definition at line 94 of file CompiledSimController.cc.
References deleteGeneratedFiles().
|
private |
Copying not allowed.
InstructionAddress CompiledSimController::basicBlockStart | ( | InstructionAddress | address | ) | const |
Returns the start of the basic block containing address
address |
Definition at line 385 of file CompiledSimController.cc.
References basicBlocks_.
Referenced by CompiledSimulation::basicBlockStart(), and runUntil().
|
virtual |
Returns the count of clock cycles simulated.
Reimplemented from TTASimulationController.
Definition at line 345 of file CompiledSimController.cc.
References simulation_.
|
virtual |
Returns a pointer to the current CompiledSimulation object
Definition at line 359 of file CompiledSimController.cc.
References simulation_.
Referenced by FUPortValue(), immediateUnitRegisterValue(), prepareToStop(), registerFileValue(), and SimulatorFrontend::utilizationStatistics().
|
virtual |
Will delete all generated code files if leaveDirty_ is not set
Definition at line 367 of file CompiledSimController.cc.
References compiledSimulationPath_, FileSystem::fileExists(), leaveDirty_, and FileSystem::removeFileOrDirectory().
Referenced by reset(), and ~CompiledSimController().
|
virtual |
Returns a FU port's value
fuName | name of the function unit |
portIndex | Index of the port |
Implements TTASimulationController.
Definition at line 460 of file CompiledSimController.cc.
References compiledSimulation().
|
virtual |
Returns the current value of a IU register
iuName | name of the immediate unit |
index | index of the register |
Implements TTASimulationController.
Definition at line 445 of file CompiledSimController.cc.
References compiledSimulation().
|
virtual |
Returns the address of the last executed instruction.
Definition at line 335 of file CompiledSimController.cc.
References simulation_.
|
virtual |
Advances simulation by a given amout of steps and skip procedure calls.,
@Note The accuracy of this function is one basic block!
Implements TTASimulationController.
Definition at line 138 of file CompiledSimController.cc.
References assert, SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), prepareToStop(), SimulationEventHandler::SE_SIMULATION_STOPPED, simulation_, SRE_AFTER_STEPPING, SRE_RUNTIME_ERROR, TTASimulationController::STA_FINISHED, TTASimulationController::STA_INITIALIZED, TTASimulationController::STA_RUNNING, TTASimulationController::STA_STOPPED, TTASimulationController::state_, TTASimulationController::stopReasons_, and TTASimulationController::stopRequested_.
|
private |
Assignment not allowed.
|
virtual |
Sends a stop request to the simulation controller and compiled simulation
reason | The stop reason |
Reimplemented from TTASimulationController.
Definition at line 472 of file CompiledSimController.cc.
References compiledSimulation(), and TTASimulationController::prepareToStop().
Referenced by next(), run(), runUntil(), and step().
const TTAProgram::Program & CompiledSimController::program | ( | ) | const |
Returns the program model
Definition at line 394 of file CompiledSimController.cc.
References TTASimulationController::program_.
Referenced by CompiledSimulation::CompiledSimulation(), and CompiledSimulation::moveExecutionCount().
|
virtual |
Returns the program counter value.
Implements TTASimulationController.
Definition at line 325 of file CompiledSimController.cc.
References simulation_.
|
virtual |
Returns a string containing the value(s) of the register file
rfName | name of the register file to search for |
registerIndex | index of the register. if -1, all registers are listed |
InstanceNotFound | If the register cannot be found. |
Implements TTASimulationController.
Definition at line 407 of file CompiledSimController.cc.
References compiledSimulation(), SimValue::hexValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::registerFileNavigator(), TTASimulationController::sourceMachine_, and Conversion::toString().
|
virtual |
Resets the simulation so it can be started from the beginning.
Resets everything to initial values (program counter, clock cycles etc.)
Implements TTASimulationController.
Definition at line 243 of file CompiledSimController.cc.
References TTAProgram::Instruction::address(), PluginTools::addSearchPath(), CompiledSimCodeGenerator::basicBlocks(), basicBlocks_, CATCH_ANY, TTASimulationController::clockCount_, CompiledSimCompiler::compileDirectory(), compiledSimulationPath_, CompiledSimCompiler::compileFile(), CompiledSimCompiler::compileToSO(), FileSystem::createTempDirectory(), deleteGeneratedFiles(), FileSystem::DIRECTORY_SEPARATOR, TTAProgram::Program::entryAddress(), SimulatorFrontend::executionTracing(), FileSystem::fileOfPath(), TTASimulationController::frontend_, SimulatorFrontend::fuResourceConflictDetection(), CompiledSimCodeGenerator::generateToDirectory(), FileSystem::globPath(), PluginTools::importSymbol(), instanceId_, TTAProgram::Program::lastInstruction(), TTAProgram::Address::location(), Application::logStream(), TTASimulationController::memorySystem(), pluginTools_, CompiledSimCodeGenerator::procedureBBRelations(), procedureBBRelations_, SimulatorFrontend::procedureTransferTracing(), TTASimulationController::program_, PluginTools::registerModule(), simulation_, TTASimulationController::sourceMachine_, TTASimulationController::STA_INITIALIZED, TTASimulationController::STA_INITIALIZING, TTASimulationController::state_, SimulatorFrontend::staticCompilation(), TTASimulationController::stopRequested_, and Conversion::toString().
Referenced by CompiledSimController().
|
virtual |
Advances the simulation until the program ends
SimulationExecutionError | If a runtime error occurs in the simulated program. |
Implements TTASimulationController.
Definition at line 173 of file CompiledSimController.cc.
References SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), prepareToStop(), SimulationEventHandler::SE_SIMULATION_STOPPED, simulation_, SRE_RUNTIME_ERROR, TTASimulationController::STA_FINISHED, TTASimulationController::STA_RUNNING, TTASimulationController::STA_STOPPED, TTASimulationController::state_, TTASimulationController::stopReasons_, and TTASimulationController::stopRequested_.
|
virtual |
Advances the simulation until a given address is reached.
@Note The accuracy of this function is one basic block!
address | the address after the simulation execution should end |
SimulationExecutionError | If a runtime error occurs in the simulated program. |
Implements TTASimulationController.
Definition at line 209 of file CompiledSimController.cc.
References basicBlockStart(), SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), prepareToStop(), SimulationEventHandler::SE_SIMULATION_STOPPED, simulation_, SRE_AFTER_UNTIL, SRE_RUNTIME_ERROR, TTASimulationController::STA_FINISHED, TTASimulationController::STA_RUNNING, TTASimulationController::STA_STOPPED, TTASimulationController::state_, TTASimulationController::stopReasons_, and TTASimulationController::stopRequested_.
|
virtual |
Advances simulation by given amount of cycles
@Note The accuracy of this function is one basic block!
Implements TTASimulationController.
Definition at line 104 of file CompiledSimController.cc.
References assert, SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), prepareToStop(), SimulationEventHandler::SE_SIMULATION_STOPPED, simulation_, SRE_AFTER_STEPPING, SRE_RUNTIME_ERROR, TTASimulationController::STA_FINISHED, TTASimulationController::STA_INITIALIZED, TTASimulationController::STA_RUNNING, TTASimulationController::STA_STOPPED, TTASimulationController::state_, TTASimulationController::stopReasons_, and TTASimulationController::stopRequested_.
|
private |
A map containing the basic blocks' start..end pairs.
Definition at line 126 of file CompiledSimController.hh.
Referenced by basicBlockStart(), and reset().
|
private |
Path to the generated simulation files.
Definition at line 120 of file CompiledSimController.hh.
Referenced by deleteGeneratedFiles(), and reset().
|
private |
The unique identifier for this simulation engine. Used for enabling multiple compiled engines in the same process while still having ccache hits (which would not happen when using the object address as the id).
Definition at line 133 of file CompiledSimController.hh.
Referenced by CompiledSimController(), and reset().
|
private |
True, if the simulation should leave all the generated code files.
Definition at line 123 of file CompiledSimController.hh.
Referenced by CompiledSimController(), and deleteGeneratedFiles().
|
private |
Used for loading the compiled simulation plugin.
Definition at line 114 of file CompiledSimController.hh.
Referenced by reset().
|
private |
A struct for tracking basic blocks and their relation to their procedures.
Definition at line 128 of file CompiledSimController.hh.
Referenced by reset().
|
private |
Pointer to the loaded simulation.
Definition at line 117 of file CompiledSimController.hh.
Referenced by clockCount(), compiledSimulation(), lastExecutedInstruction(), next(), programCounter(), reset(), run(), runUntil(), and step().