Go to the documentation of this file.
33 #ifndef TTA_SIMULATOR_FRONTEND
34 #define TTA_SIMULATOR_FRONTEND
42 #include <boost/timer.hpp>
113 virtual void loadProgram(
const std::string& fileName);
115 virtual void loadMachine(
const std::string& fileName);
132 virtual void next(
int count = 1);
133 virtual void step(
double count = 1);
196 const std::string& rfName,
197 int registerIndex = -1);
200 const std::string& iuName,
204 const std::string& fuName,
205 const std::string& portName);
287 typedef std::pair<RuntimeErrorSeverity, std::string>
const CallPathTracker & callPathTracker(int core=-1) const
double lastRunTime_
The wall clock time of the last non-interrupted simulation phase in seconds.
bool saveProfileData_
Is saving of profile data to TraceDB enabled.
bool simulationTimeStatistics() const
bool printNextInstruction_
If true, the next simulated instructions is printed to stdout when simulation stops.
std::vector< bool > traceDBOwned_
Whether traceDB at index is owned by simulator (or taken away by client using lastTraceDB())
void setControllerForMemories(RemoteController *con)
std::vector< UtilizationStats * > utilizationStats_
Processor utilization statistics.
void setProcedureTransferTracing(bool value)
UInt32 InstructionAddress
void setMemoryAccessTracking(bool value)
SimulatorFrontend(SimulationType backend=SIM_NORMAL)
bool memoryAccessTracking() const
@ SIM_REMOTE
Remote debugger, not a simulator at all.
bool procedureTransferTracing_
Is procedure transfer access tracking enabled.
TTASimulationController * simCon_
If simulation is initialized, this contains a pointer to the simulation controller.
const TTAProgram::Program & program() const
@ SIM_COMPILED
Compiled, faster simulation.
void initializeMemorySystem()
bool rfAccessTracing() const
bool procedureTransferTracing() const
void selectCore(int core)
SimulationType currentBackend_
Type of "backend" this Frontend has.
bool busTracing_
Is bus tracing, i.e., storing the values of buses in each clock cycle enabled.
std::string forcedTraceDBFileName_
If set, forces the SQLite filename of trace DB to this name.
bool profileDataSaving() const
friend void timeoutThread(unsigned int timeout, SimulatorFrontend *simFE)
const TTAMachine::Machine & machine() const
virtual SimValue immediateUnitRegisterValue(const std::string &iuName, int index=-1)
bool zeroFillMemoriesOnReset_
Set to true in case the memories should be set to zero at reset.
bool stoppedByUser() const
std::size_t callHistoryLength() const
std::vector< ExecutionTrace * > traceDBs_
The database to use for execution trace data.
std::vector< ProgramErrorDescription > ProgramErrorDescriptionList
Container for simulated program error descriptions.
std::ostream & outputStream()
bool fuResourceConflictDetection() const
bool isSimulationStopped() const
virtual void next(int count=1)
void setStaticCompilation(bool value)
std::vector< ProcedureTransferTracker * > procedureTransferTrackers_
The procedure transfer tracker.
void setOutputStream(std::ostream &stream)
void initializeDataMemories(const TTAMachine::AddressSpace *onlyOne=NULL)
bool printSimulationTimeStatistics_
True if the simulation time statistics should be printed out.
bool isMachineLoaded() const
void loadProcessorConfiguration(const std::string &fileName)
StopPointManager * stopPointManager_
The breakpoint manager to be used to bookkeep breakpoints.
bool staticCompilation() const
unsigned int stopReasonCount() const
StateData & findBooleanRegister()
std::pair< RuntimeErrorSeverity, std::string > ProgramErrorDescription
A type for storing a program error description.
void setTimeout(unsigned int value)
const TTAProgram::Program * currentProgram_
Program to be simulated.
SimulationType
Which type of simulation this SimulatorFrontend controls or connects to.
void initializeDisassembler() const
InstructionAddress programCounter() const
virtual void loadMachine(const std::string &fileName)
std::ostream * outputStream_
Default output stream.
unsigned int simulationTimeout_
Simulation timeout in seconds.
StateData & findRegister(const std::string &rfName, int registerIndex)
void setCallHistoryLength(std::size_t length)
std::size_t callHistoryLength_
The length of call history to store in memory for the commands that need it.
bool fuResourceConflictDetection_
If this is enabled before initialization, FU resource conflicts are detected (slows down simulation).
#define abortWithError(message)
TPEF::Binary * tpef_
The source TPEF file.
bool programOwnedByFrontend_
Is the program owned by SimulatorFrontend or by the client?
ClockCycleCount lastRunCycleCount_
The cycle count of the last non-interrupted simulation phase.
const UtilizationStats & utilizationStatistics(int core=-1)
bool compareState(SimulatorFrontend &other, std::ostream *differences=NULL)
const ExecutableInstruction & executableInstructionAt(InstructionAddress address) const
const SimValue & stateValue(std::string searchString)
std::string programErrorReport(RuntimeErrorSeverity severity, std::size_t index)
std::vector< BusTracker * > busTrackers_
The tracker for saving bus trace.
virtual void loadProgram(const std::string &fileName)
virtual ~SimulatorFrontend()
@ SIM_OTA
Simulation with operation-triggered implicit data transports.
StopReason
The reasons to stop simulation.
std::vector< CallPathTracker * > callPathTrackers_
The call path trackers for each core, in case tracking is enabled.
bool traceFileNameSetByUser_
Flag that indicates is the trace file name set by user.
void setProfileDataSaving(bool value)
@ RES_MINOR
Minor runtime error, no abort necessary.
@ RES_FATAL
Fatal runtime error, there is a serious error in the simulated program, thus it makes no sense to go ...
bool isCompiledSimulation() const
virtual InstructionAddress lastExecutedInstruction(int coreId=-1) const
bool hasStopReason(StopReason reason) const
std::size_t programErrorReportCount(RuntimeErrorSeverity severity)
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)
bool leaveCompiledDirty_
True in case the compilation simulation should not cleanup at destruction the engine source files.
StateData & findPort(const std::string &fuName, const std::string &portName)
ProgramErrorDescriptionList programErrorReports_
Runtime error reports.
std::time_t startTime_
The time of the last simulation start. Used to compute simulation speed.
void setupCallHistoryTracking()
@ SIM_CUSTOM
User-implemented remote HW debugger.
void forceTraceDBFileName(const std::string &fileName)
bool isSimulationRunning() const
StateData & state(std::string searchString)
virtual void killSimulation()
void clearProgramErrorReports()
bool isCustomDebugger() const
const TTAProgram::Procedure & currentProcedure() const
void setRFAccessTracing(bool value)
bool isProgramLoaded() const
const TTAMachine::Machine * currentMachine_
Machine to run simulation with.
ClockCycleCount cycleCount() const
virtual void step(double count=1)
POMDisassembler * disassembler_
The disassembler used to print out instructions. This is initialized on demand.
void setUtilizationDataSaving(bool value)
MemorySystem & memorySystem(int coreId=-1)
SimulationEventHandler & eventHandler()
bool executionTracing_
Is execution tracing, i.e., storing the executed instruction addresses to the trace database,...
std::vector< RFAccessTracker * > rfAccessTrackers_
The register file access tracker.
long long CycleCount
Type for storing simulation cycle counts.
MachineState & machineState(int core=-1)
void setExecutionTracing(bool value)
bool utilizationDataSaving() const
const RFAccessTracker & rfAccessTracker() const
bool memoryAccessTracking_
If this is enabled before initialization, memory access tracking is enabled. (slows down simulation)
void setZeroFillMemoriesOnReset(bool val)
bool machineOwnedByFrontend_
Is the machine owned by SimulatorFrontend or by the client?
void setSimulationTimeStatistics(bool value)
CycleCount lastRunCycleCount() const
virtual void initializeSimulation()
void setDetailedSimulation(bool val)
CycleCount startCycleCount_
The cycle count when the latest simulation was started. Used to compute simulation speed.
bool detailedSimulation_
Set to true in case should build a detailed model which simulates FU stages, possibly with an externa...
virtual void runUntil(UIntWord address)
void setCompiledSimulationLeaveDirty(bool dirty)
std::string disassembleInstruction(UIntWord instructionAddress) const
StopReason stopReason(unsigned int index) const
double lastRunTime() const
bool staticCompilation_
True if the compiled simulation should use static compilation.
CycleCount ClockCycleCount
Alias for ClockCycleCount.
bool saveUtilizationData_
Is saving of utilization data to TraceDB enabled.
bool executionTracing() const
std::string programLocationDescription() const
void setNextInstructionPrinting(bool value)
std::vector< ExecutionTracker * > executionTrackers_
The simple execution tracker for storing trace of executed instructions.
virtual std::string registerFileValue(const std::string &rfName, int registerIndex=-1)
bool hasSimulationEnded() const
bool nextInstructionPrinting() const
void setFUResourceConflictDetection(bool value)
SimulationEventHandler * eventHandler_
Per simulation instance of SimulationEventHandler.
std::vector< MemorySystem * > memorySystems_
The simulation models of the memories in the currently loaded machine for each core.
bool isTCEDebugger() const
void reportSimulatedProgramError(RuntimeErrorSeverity severity, const std::string &description)
const ExecutableInstruction & lastExecInstruction() const
bool isSimulationInitialized() const
std::string programFileName_
The source file of the program to be simulated. Used to generate the file name of the trace data base...
StopPointManager & stopPointManager()
void setBusTracing(bool value)
RuntimeErrorSeverity
The severities of runtime errors.
void setCompiledSimulation(bool value)
bool automaticFinishImpossible() const
ExecutionTrace * lastTraceDB(int core=-1)
bool rfAccessTracing_
Is register file (concurrent) access tracking enabled.
void prepareToStop(StopReason reason)
@ SIM_NORMAL
Default, interpreted simulation (debugging engine).