Go to the documentation of this file.
58 std::numeric_limits<ClockCycleCount>::max();
79 bool dynamicCompilation,
83 jumpTarget_(entryAddress),
84 programCounter_(entryAddress),
85 lastExecutedInstruction_(0),
87 stopRequested_(
false),
89 conflictDetected_(
false),
90 dynamicCompilation_(dynamicCompilation),
91 procedureBBRelations_(procedureBBRelations),
93 entryAddress_(entryAddress),
102 for (
int i = 0; i < moveCount; ++i) {
106 int bbCount = lastInstruction - entryAddress + 1;
108 for (
int i = 0; i < bbCount; ++i) {
173 "Command nexti not yet supported in the compiled simulation!");
259 std::string registerFile = symbolGen.
registerSymbol(rf, registerIndex);
261 CompiledSimulationPimpl::Symbols::const_iterator rfIterator =
264 return *(rfIterator->second);
267 "Register file " + std::string(rfName) +
" not found.");
287 CompiledSimulationPimpl::Symbols::const_iterator iuIterator =
290 return *(iuIterator->second);
293 "Immediate unit " + std::string(iuName) +
" not found.");
318 CompiledSimulationPimpl::Symbols::const_iterator fuPortIterator =
321 return *(fuPortIterator->second);
324 "FU port " + std::string(fuPort) +
" not found.");
376 programStartAddress);
420 FUName)->addressSpace()).get());
467 const char* procedure,
468 const char* message)
const {
498 if (targetFunction != 0) {
499 return targetFunction;
505 if (targetFunction != 0) {
506 return targetFunction;
512 ". Please try with the interpretive simulation engine." );
541 std::set<std::string> compiledFiles;
546 typedef ProcedureBBRelations::BasicBlockStarts::iterator BBIterator;
547 std::pair<BBIterator, BBIterator> equalRange =
551 for (BBIterator it = equalRange.first; it != equalRange.second; ++it) {
555 if (compiledFiles.find(file) == compiledFiles.end()) {
561 compiledFiles.insert(file);
581 CompiledSimulationPimpl::Symbols::iterator it =
pimpl_->
symbols_.find(
582 std::string(symbolName));
void compileAndLoadFunction(InstructionAddress address)
std::string immediateRegisterSymbol(const TTAProgram::Terminal &terminal) const
virtual void requestToStop()
ClockCycleCount cycleCount_
Number of cycles simulated so far.
std::map< InstructionAddress, InstructionAddress > procedureStart
Procedure start per basic block starts.
UInt32 InstructionAddress
TTAMachine::Machine * machine
the architecture definition of the estimated processor
virtual InstructionAddress programCounter() const
virtual void step(double count)
std::string portSymbol(const TTAMachine::Port &port) const
bool isUnconditional() const
virtual bool stopRequested() const
virtual SimValue FUPortValue(const char *fuName, const char *portName)
virtual ~CompiledSimulation()
void setJumpTargetFunction(InstructionAddress address, SimulateFunction fp)
SimulatorFrontend & frontend() const
ClockCycleCount * moveExecCounts_
Move execution counts in a C style table.
InstructionAddress programCounter_
The program counter. i.e. which address the simulation is currently at.
MemorySystem * memorySystem_
The memory system.
virtual BaseFUPort * port(const std::string &name) const
virtual SimValue immediateUnitRegisterValue(const char *iuName, int index)
static std::ostream & logStream()
InstructionAddress jumpTarget_
The jump target. Allows jumping to different addresses in the code.
static std::string toString(const T &source)
CompiledSimController * controller_
Simulation controller.
InstructionAddress lastExecutedInstruction_
Last executed instruction.
virtual bool isFinished() const
MemorySystem * memorySystem() const
#define assert(condition)
CompiledSimulationPimpl * pimpl_
Private implementation in a separate source file.
bool isFinished_
Is the simulation finished?
virtual ControlUnit * controlUnit() const
void(* SimulateFunction)(void *engine)
Type for the simulateXXXXX basic block functions.
ClockCycleCount * bbExecCounts_
Basic block execution counts in a C style table.
ProcedureBBRelations & procedureBBRelations_
A struct for finding out procedure begins from procedure's basic blocks.
std::string basicBlockSymbol(InstructionAddress startAddress) const
JumpTable jumpTable_
The jump table.
virtual ImmediateUnitNavigator immediateUnitNavigator() const
virtual std::set< InstructionAddress > findProgramExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine) const
SimulatorFrontend * frontend_
The simulator frontend.
std::map< InstructionAddress, std::string > basicBlockFiles
Basic block starts and their corresponding .cpp files.
void haltSimulation(const char *file, int line, const char *procedure, const char *message) const
std::string registerSymbol(const TTAProgram::Terminal &terminal) const
@ SE_CYCLE_END
Generated before advancing the simulator clock at the end of a simulation cycle.
SimulateFunction getSimulateFunction(InstructionAddress address)
static std::string directoryOfPath(const std::string fileName)
virtual void simulateCycle()=0
virtual FunctionUnitNavigator functionUnitNavigator() const
CompiledSimulation(const TTAMachine::Machine &machine, InstructionAddress entryAddress, InstructionAddress lastInstruction, SimulatorFrontend &frontend, CompiledSimController &controller, MemorySystem &memorySystem, bool dynamicCompilation, ProcedureBBRelations &procedureBBRelations)
void resizeJumpTable(int newSize)
SimValue * getSymbolValue(const char *symbolName)
const TTAMachine::Machine & machine_
The simulated machine.
std::set< InstructionAddress > exitPoints_
Program exit points in a set.
Symbols symbols_
A Symbol map for easily getting the SimValues out of the simulation.
BasicBlockStarts basicBlockStarts
All basic block start addresses per procedure start.
virtual ClockCycleCount moveExecutionCount(int moveNumber, InstructionAddress address) const
CompiledSimCompiler compiler_
The Compiled Simulation compiler.
static const std::string DIRECTORY_SEPARATOR
InstructionAddress basicBlockStart(InstructionAddress address) const
const TTAProgram::Program & program() const
virtual RegisterFileNavigator registerFileNavigator() const
SimulationEventHandler & eventHandler()
find Finds info of the inner loops in the false
PluginTools pluginTools_
Plugintools used to load the compiled .so files.
bool dynamicCompilation_
Is this a dynamic compiled simulation?
bool stopRequested_
Should the simulation stop or not?
virtual InstructionAddress lastExecutedInstruction() const
DirectAccessMemory & FUMemory(const char *FUName) const
MemoryPtr memory(const TTAMachine::AddressSpace &as)
virtual void runUntil(UIntWord address)
int compileToSO(const std::string &path, const std::string &flags="", bool verbose=false) const
void addSymbol(const char *symbolName, SimValue &value)
virtual void next(int count)
ClockCycleCount cyclesToSimulate_
Number of cycles left to simulate until the execution returns.
CycleCount ClockCycleCount
Alias for ClockCycleCount.
static const ClockCycleCount MAX_CYCLES
ComponentType * item(int index) const
find Finds info of the inner loops in the program
virtual InstructionAddress basicBlockStart(InstructionAddress address) const
virtual ClockCycleCount cycleCount() const
A struct for tracking basic blocks and their relation to their procedures.
static std::string fileNameBody(const std::string &fileName)
virtual SimValue registerFileValue(const char *rfName, int registerIndex)
TTAMachine::FunctionUnit & functionUnit(const char *name) const
void msg(const char *message) const