72 pluginTools_(true,
false), compiledSimulationPath_(
""),
73 leaveDirty_(leaveDirty) {
75#ifdef DEBUG_COMPILED_SIMULATION
81 static int instanceCount = 0;
254 <<
"Cannot create temporary path "
255 <<
"for the generated simulation code!" << endl;
269#ifdef DEBUG_COMPILED_SIMULATION
270 std::cerr <<
"Generated compiled simulation sources to: '"
292 "-xc++-header",
".gch");
299 std::vector<std::string> sos;
301 for (std::size_t i = 0; i < sos.size(); ++i) {
358boost::shared_ptr<CompiledSimulation>
408 const std::string& rfName,
int registerIndex) {
409 std::string stringValue(
"");
411 if (registerIndex >= 0) {
419 bool firstReg =
true;
423 const std::string registerName =
428 stringValue += registerName +
" " + value.
hexValue();
446 const std::string& iuName,
461 const std::string& fuName,
462 const std::string& portName) {
#define assert(condition)
UInt32 InstructionAddress
TTAMachine::Machine * machine
the architecture definition of the estimated processor
find Finds info of the inner loops in the program
find Finds info of the inner loops in the false
CycleCount ClockCycleCount
Alias for ClockCycleCount.
StopReason
The reasons to stop simulation.
@ SRE_AFTER_UNTIL
Stopped after running to the wanted.
@ SRE_AFTER_STEPPING
Stopped after stepping the given count.
@ SRE_RUNTIME_ERROR
A fatal runtime error occured in the simulated program.
static std::ostream & logStream()
virtual AddressMap basicBlocks() const
virtual void generateToDirectory(const std::string &dirName)
virtual ProcedureBBRelations procedureBBRelations() const
int compileFile(const std::string &path, const std::string &flags="", const std::string &outputExtension=".o", bool verbose=false) const
int compileToSO(const std::string &path, const std::string &flags="", bool verbose=false) const
int compileDirectory(const std::string &dirName, const std::string &flags="", bool verbose=false) const
virtual void next(int count=1)
int instanceId_
The unique identifier for this simulation engine. Used for enabling multiple compiled engines in the ...
ProcedureBBRelations procedureBBRelations_
A struct for tracking basic blocks and their relation to their procedures.
boost::shared_ptr< CompiledSimulation > simulation_
Pointer to the loaded simulation.
virtual ~CompiledSimController()
virtual InstructionAddress lastExecutedInstruction() const
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.
virtual void step(double count=1)
virtual boost::shared_ptr< CompiledSimulation > compiledSimulation()
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)
CompiledSimController(SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program, bool leaveDirty=false)
virtual void deleteGeneratedFiles()
virtual void prepareToStop(StopReason reason)
bool leaveDirty_
True, if the simulation should leave all the generated code files.
virtual SimValue immediateUnitRegisterValue(const std::string &iuName, int index=-1)
const TTAProgram::Program & program() const
virtual ClockCycleCount clockCount() const
virtual std::string registerFileValue(const std::string &rfName, int registerIndex=-1)
virtual InstructionAddress programCounter() const
InstructionAddress basicBlockStart(InstructionAddress address) const
virtual void runUntil(UIntWord address)
std::string compiledSimulationPath_
Path to the generated simulation files.
PluginTools pluginTools_
Used for loading the compiled simulation plugin.
CompiledSimCodeGenerator::AddressMap basicBlocks_
A map containing the basic blocks' start..end pairs.
static std::string toString(const T &source)
static void globPath(const std::string &pattern, std::vector< std::string > &filenames)
static bool removeFileOrDirectory(const std::string &path)
static const std::string DIRECTORY_SEPARATOR
static std::string createTempDirectory(const std::string &path="/tmp", const std::string &tempDirPrefix="tmp_tce_")
static std::string fileOfPath(const std::string pathName)
static bool fileExists(const std::string fileName)
TCEString hexValue(bool noHexIdentifier=false) const
@ SE_SIMULATION_STOPPED
Generated after simulation has stopped, temporarily or permantently, and control is being returned to...
SimulationEventHandler & eventHandler()
bool staticCompilation() const
bool fuResourceConflictDetection() const
bool executionTracing() const
bool procedureTransferTracing() const
virtual int numberOfRegisters() const
ComponentType * item(int index) const
virtual RegisterFileNavigator registerFileNavigator() const
InstructionAddress location() const
Address entryAddress() const
Instruction & lastInstruction() const
StopReasonContainer stopReasons_
The set of reasons the simulation was stopped.
const TTAMachine::Machine & sourceMachine_
The simulated Machine Object Model.
bool stopRequested_
Flag indicating that simulation should stop.
virtual void prepareToStop(StopReason reason)
@ STA_FINISHED
Simulation ended after executing the last instruction.
@ STA_INITIALIZING
Simulation is being initialized.
@ STA_RUNNING
A run command (run, stepi, until...) given.
@ STA_STOPPED
Simulation stopped for some reason.
@ STA_INITIALIZED
Simulation initialized and ready to run.
const TTAProgram::Program & program_
Program object model of the simulated program.
SimulationStatus state_
The current state of the simulation.
ClockCycleCount clockCount_
How many clock cycles have been simulated.
SimulatorFrontend & frontend_
Reference to the simulator frontend.
virtual MemorySystem & memorySystem(int coreId=-1)