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