OpenASIP  2.0
Public Types | Public Member Functions | List of all members
TracedSimulatorFrontend Class Reference

#include <TracedSimulatorFrontend.hh>

Inheritance diagram for TracedSimulatorFrontend:
Inheritance graph
Collaboration diagram for TracedSimulatorFrontend:
Collaboration graph

Public Types

enum  event {
  SIMULATOR_MACHINE_LOADED = 0, SIMULATOR_PROGRAM_LOADED, SIMULATOR_START, SIMULATOR_STOP,
  SIMULATOR_RUN, SIMULATOR_LOADING_PROGRAM, SIMULATOR_LOADING_MACHINE, SIMULATOR_RESET
}
 IDs for the simulator events. More...
 
- Public Types inherited from SimulatorFrontend
enum  RuntimeErrorSeverity { RES_MINOR, RES_FATAL }
 The severities of runtime errors. More...
 
enum  SimulationType {
  SIM_NORMAL, SIM_COMPILED, SIM_REMOTE, SIM_CUSTOM,
  SIM_OTA
}
 Which type of simulation this SimulatorFrontend controls or connects to. More...
 

Public Member Functions

 TracedSimulatorFrontend ()
 
virtual ~TracedSimulatorFrontend ()
 
virtual void loadMachine (const std::string &fileName)
 
virtual void loadProgram (const std::string &fileName)
 
virtual void run ()
 
virtual void runUntil (UIntWord address)
 
virtual void step (double count=1)
 
virtual void next (int count=1)
 
virtual void killSimulation ()
 
- Public Member Functions inherited from SimulatorFrontend
 SimulatorFrontend (SimulationType backend=SIM_NORMAL)
 
virtual ~SimulatorFrontend ()
 
void loadProgram (const TTAProgram::Program &program)
 
void loadMachine (const TTAMachine::Machine &machine)
 
void loadProcessorConfiguration (const std::string &fileName)
 
const TTAMachine::Machinemachine () const
 
const TTAProgram::Programprogram () const
 
const SimValuestateValue (std::string searchString)
 
StateDatastate (std::string searchString)
 
MachineStatemachineState (int core=-1)
 
void prepareToStop (StopReason reason)
 
unsigned int stopReasonCount () const
 
StopReason stopReason (unsigned int index) const
 
bool stoppedByUser () const
 
StopPointManagerstopPointManager ()
 
MemorySystemmemorySystem (int coreId=-1)
 
bool isSimulationInitialized () const
 
bool isSimulationRunning () const
 
bool isSimulationStopped () const
 
bool isProgramLoaded () const
 
bool isMachineLoaded () const
 
bool hasSimulationEnded () const
 
bool isCompiledSimulation () const
 
bool isTCEDebugger () const
 
bool isCustomDebugger () const
 
void setCompiledSimulationLeaveDirty (bool dirty)
 
bool executionTracing () const
 
bool busTracing () const
 
bool rfAccessTracing () const
 
bool procedureTransferTracing () const
 
bool profileDataSaving () const
 
bool utilizationDataSaving () const
 
bool staticCompilation () const
 
const RFAccessTrackerrfAccessTracker () const
 
void setCompiledSimulation (bool value)
 
void setExecutionTracing (bool value)
 
void setBusTracing (bool value)
 
void setRFAccessTracing (bool value)
 
void setProcedureTransferTracing (bool value)
 
void setProfileDataSaving (bool value)
 
void setUtilizationDataSaving (bool value)
 
void forceTraceDBFileName (const std::string &fileName)
 
void setTimeout (unsigned int value)
 
void setStaticCompilation (bool value)
 
std::ostream & outputStream ()
 
void setOutputStream (std::ostream &stream)
 
std::string disassembleInstruction (UIntWord instructionAddress) const
 
std::string programLocationDescription () const
 
InstructionAddress programCounter () const
 
virtual InstructionAddress lastExecutedInstruction (int coreId=-1) const
 
ClockCycleCount cycleCount () const
 
const TTAProgram::ProcedurecurrentProcedure () const
 
virtual std::string registerFileValue (const std::string &rfName, int registerIndex=-1)
 
virtual SimValue immediateUnitRegisterValue (const std::string &iuName, int index=-1)
 
virtual SimValue FUPortValue (const std::string &fuName, const std::string &portName)
 
StateDatafindRegister (const std::string &rfName, int registerIndex)
 
StateDatafindBooleanRegister ()
 
StateDatafindPort (const std::string &fuName, const std::string &portName)
 
const UtilizationStatsutilizationStatistics (int core=-1)
 
const ExecutableInstructionlastExecInstruction () const
 
const ExecutableInstructionexecutableInstructionAt (InstructionAddress address) const
 
bool automaticFinishImpossible () const
 
void setFUResourceConflictDetection (bool value)
 
bool fuResourceConflictDetection () const
 
void setNextInstructionPrinting (bool value)
 
bool nextInstructionPrinting () const
 
void setSimulationTimeStatistics (bool value)
 
bool simulationTimeStatistics () const
 
ExecutionTracelastTraceDB (int core=-1)
 
void setMemoryAccessTracking (bool value)
 
bool memoryAccessTracking () const
 
void finishSimulation ()
 
void setZeroFillMemoriesOnReset (bool val)
 
void setDetailedSimulation (bool val)
 
CycleCount lastRunCycleCount () const
 
SimulationEventHandlereventHandler ()
 
double lastRunTime () const
 
void reportSimulatedProgramError (RuntimeErrorSeverity severity, const std::string &description)
 
std::string programErrorReport (RuntimeErrorSeverity severity, std::size_t index)
 
std::size_t programErrorReportCount (RuntimeErrorSeverity severity)
 
void clearProgramErrorReports ()
 
int selectedCore () const
 
void selectCore (int core)
 
bool compareState (SimulatorFrontend &other, std::ostream *differences=NULL)
 
std::size_t callHistoryLength () const
 
void setCallHistoryLength (std::size_t length)
 
const CallPathTrackercallPathTracker (int core=-1) const
 
void initializeDataMemories (const TTAMachine::AddressSpace *onlyOne=NULL)
 
- Public Member Functions inherited from Informer
 Informer ()
 
virtual ~Informer ()
 
void handleEvent (int event)
 
virtual bool registerListener (int event, Listener *listener)
 
virtual bool unregisterListener (int event, Listener *listener)
 

Additional Inherited Members

- Protected Types inherited from SimulatorFrontend
typedef std::pair< RuntimeErrorSeverity, std::string > ProgramErrorDescription
 A type for storing a program error description. More...
 
typedef std::vector< ProgramErrorDescriptionProgramErrorDescriptionList
 Container for simulated program error descriptions. More...
 
- Protected Member Functions inherited from SimulatorFrontend
virtual void initializeSimulation ()
 
void initializeTracing ()
 
void initializeDisassembler () const
 
void initializeMemorySystem ()
 
void setControllerForMemories (RemoteController *con)
 
bool hasStopReason (StopReason reason) const
 
void startTimer ()
 
void stopTimer ()
 
void setupCallHistoryTracking ()
 
- Protected Attributes inherited from SimulatorFrontend
const TTAMachine::MachinecurrentMachine_
 Machine to run simulation with. More...
 
TTASimulationControllersimCon_
 If simulation is initialized, this contains a pointer to the simulation controller. More...
 
bool machineOwnedByFrontend_
 Is the machine owned by SimulatorFrontend or by the client? More...
 
const TTAProgram::ProgramcurrentProgram_
 Program to be simulated. More...
 
std::string programFileName_
 The source file of the program to be simulated. Used to generate the file name of the trace data base. More...
 
bool programOwnedByFrontend_
 Is the program owned by SimulatorFrontend or by the client? More...
 
SimulationType currentBackend_
 Type of "backend" this Frontend has. More...
 
POMDisassemblerdisassembler_
 The disassembler used to print out instructions. This is initialized on demand. More...
 
bool executionTracing_
 Is execution tracing, i.e., storing the executed instruction addresses to the trace database, enabled. More...
 
bool busTracing_
 Is bus tracing, i.e., storing the values of buses in each clock cycle enabled. More...
 
bool rfAccessTracing_
 Is register file (concurrent) access tracking enabled. More...
 
bool procedureTransferTracing_
 Is procedure transfer access tracking enabled. More...
 
bool saveProfileData_
 Is saving of profile data to TraceDB enabled. More...
 
bool saveUtilizationData_
 Is saving of utilization data to TraceDB enabled. More...
 
std::vector< ExecutionTrace * > traceDBs_
 The database to use for execution trace data. More...
 
std::vector< bool > traceDBOwned_
 Whether traceDB at index is owned by simulator (or taken away by client using lastTraceDB()) More...
 
std::vector< ExecutionTracker * > executionTrackers_
 The simple execution tracker for storing trace of executed instructions. More...
 
std::vector< BusTracker * > busTrackers_
 The tracker for saving bus trace. More...
 
std::vector< RFAccessTracker * > rfAccessTrackers_
 The register file access tracker. More...
 
std::vector< ProcedureTransferTracker * > procedureTransferTrackers_
 The procedure transfer tracker. More...
 
StopPointManagerstopPointManager_
 The breakpoint manager to be used to bookkeep breakpoints. More...
 
std::vector< UtilizationStats * > utilizationStats_
 Processor utilization statistics. More...
 
TPEF::Binarytpef_
 The source TPEF file. More...
 
bool fuResourceConflictDetection_
 If this is enabled before initialization, FU resource conflicts are detected (slows down simulation). More...
 
bool printNextInstruction_
 If true, the next simulated instructions is printed to stdout when simulation stops. More...
 
bool printSimulationTimeStatistics_
 True if the simulation time statistics should be printed out. More...
 
bool staticCompilation_
 True if the compiled simulation should use static compilation. More...
 
bool traceFileNameSetByUser_
 Flag that indicates is the trace file name set by user. More...
 
std::ostream * outputStream_
 Default output stream. More...
 
bool memoryAccessTracking_
 If this is enabled before initialization, memory access tracking is enabled. (slows down simulation) More...
 
SimulationEventHandlereventHandler_
 Per simulation instance of SimulationEventHandler. More...
 
ClockCycleCount lastRunCycleCount_
 The cycle count of the last non-interrupted simulation phase. More...
 
double lastRunTime_
 The wall clock time of the last non-interrupted simulation phase in seconds. More...
 
std::time_t startTime_
 The time of the last simulation start. Used to compute simulation speed. More...
 
CycleCount startCycleCount_
 The cycle count when the latest simulation was started. Used to compute simulation speed. More...
 
unsigned int simulationTimeout_
 Simulation timeout in seconds. More...
 
ProgramErrorDescriptionList programErrorReports_
 Runtime error reports. More...
 
bool leaveCompiledDirty_
 True in case the compilation simulation should not cleanup at destruction the engine source files. More...
 
std::size_t callHistoryLength_
 The length of call history to store in memory for the commands that need it. More...
 
std::vector< CallPathTracker * > callPathTrackers_
 The call path trackers for each core, in case tracking is enabled. More...
 
std::string forcedTraceDBFileName_
 If set, forces the SQLite filename of trace DB to this name. More...
 
std::vector< MemorySystem * > memorySystems_
 The simulation models of the memories in the currently loaded machine for each core. More...
 
bool zeroFillMemoriesOnReset_
 Set to true in case the memories should be set to zero at reset. More...
 
bool detailedSimulation_
 Set to true in case should build a detailed model which simulates FU stages, possibly with an external system-level model. More...
 

Detailed Description

TracedSimulatorFrontend is a class which adds event passing to the SimulatorFrontend baseclass.

TracedSimulatorFrontend implements the Informer interface and passes events whenever the simulator state changes. This allows a client to track the simulator state by registering itself as a listener of the simulator events.

Definition at line 49 of file TracedSimulatorFrontend.hh.

Member Enumeration Documentation

◆ event

IDs for the simulator events.

Enumerator
SIMULATOR_MACHINE_LOADED 
SIMULATOR_PROGRAM_LOADED 
SIMULATOR_START 
SIMULATOR_STOP 
SIMULATOR_RUN 
SIMULATOR_LOADING_PROGRAM 
SIMULATOR_LOADING_MACHINE 
SIMULATOR_RESET 

Definition at line 69 of file TracedSimulatorFrontend.hh.

Constructor & Destructor Documentation

◆ TracedSimulatorFrontend()

TracedSimulatorFrontend::TracedSimulatorFrontend ( )

The constructor.

Definition at line 40 of file TracedSimulatorFrontend.cc.

40  :
42 }

◆ ~TracedSimulatorFrontend()

TracedSimulatorFrontend::~TracedSimulatorFrontend ( )
virtual

The Destrcutor.

Definition at line 47 of file TracedSimulatorFrontend.cc.

47  {
48 }

Member Function Documentation

◆ killSimulation()

void TracedSimulatorFrontend::killSimulation ( )
virtual

Informs listeners when simulation is killed.

Reimplemented from SimulatorFrontend.

Definition at line 94 of file TracedSimulatorFrontend.cc.

References Informer::handleEvent(), SimulatorFrontend::killSimulation(), and SIMULATOR_STOP.

Referenced by ProximSimulationThread::killSimulation().

Here is the call graph for this function:

◆ loadMachine()

void TracedSimulatorFrontend::loadMachine ( const std::string &  machine)
virtual

Informs listeners whenever a new machine is loaded to the simulator.

Parameters
machineMachine file name passed to the baseclass.

Reimplemented from SimulatorFrontend.

Definition at line 57 of file TracedSimulatorFrontend.cc.

References Informer::handleEvent(), SimulatorFrontend::loadMachine(), SimulatorFrontend::machine(), SIMULATOR_LOADING_MACHINE, SIMULATOR_MACHINE_LOADED, and SIMULATOR_RESET.

Here is the call graph for this function:

◆ loadProgram()

void TracedSimulatorFrontend::loadProgram ( const std::string &  program)
virtual

Informs listeners when a new program is loaded to the simulator.

Parameters
programProgram file name passed to the baseclass.

Reimplemented from SimulatorFrontend.

Definition at line 70 of file TracedSimulatorFrontend.cc.

References Informer::handleEvent(), SimulatorFrontend::loadProgram(), SimulatorFrontend::program(), SIMULATOR_LOADING_PROGRAM, SIMULATOR_PROGRAM_LOADED, and SIMULATOR_RESET.

Here is the call graph for this function:

◆ next()

void TracedSimulatorFrontend::next ( int  count = 1)
virtual

Informs listeners when the simulation starts and stops.

Parameters
countNumber of nexts passed to the baseclass.

Reimplemented from SimulatorFrontend.

Definition at line 118 of file TracedSimulatorFrontend.cc.

References Informer::handleEvent(), SimulatorFrontend::next(), SIMULATOR_RUN, SIMULATOR_START, and SIMULATOR_STOP.

Here is the call graph for this function:

◆ run()

void TracedSimulatorFrontend::run ( )
virtual

Informs listeners when the simulation starts and stops.

Reimplemented from SimulatorFrontend.

Definition at line 83 of file TracedSimulatorFrontend.cc.

References Informer::handleEvent(), SimulatorFrontend::run(), SIMULATOR_RUN, SIMULATOR_START, and SIMULATOR_STOP.

Here is the call graph for this function:

◆ runUntil()

void TracedSimulatorFrontend::runUntil ( UIntWord  address)
virtual

Informs listeners when the simulation starts and stops.

Parameters
addressAddress passed to the baseclass.

Reimplemented from SimulatorFrontend.

Definition at line 105 of file TracedSimulatorFrontend.cc.

References Informer::handleEvent(), SimulatorFrontend::runUntil(), SIMULATOR_RUN, SIMULATOR_START, and SIMULATOR_STOP.

Here is the call graph for this function:

◆ step()

void TracedSimulatorFrontend::step ( double  count = 1)
virtual

Informs listeners when the simulation starts and stops.

Parameters
countNumber of steps passed to the baseclass.

Reimplemented from SimulatorFrontend.

Definition at line 131 of file TracedSimulatorFrontend.cc.

131  {
132  if (!isSimulationRunning()) {
134  }
135 
137 
138  if (!isSimulationRunning()) {
140  }
141 }

References Informer::handleEvent(), SimulatorFrontend::isSimulationRunning(), SIMULATOR_START, SIMULATOR_STOP, and SimulatorFrontend::step().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TracedSimulatorFrontend::SIMULATOR_START
@ SIMULATOR_START
Definition: TracedSimulatorFrontend.hh:72
SimulatorFrontend::SimulatorFrontend
SimulatorFrontend(SimulationType backend=SIM_NORMAL)
Definition: SimulatorFrontend.cc:120
SimulatorFrontend::program
const TTAProgram::Program & program() const
Definition: SimulatorFrontend.cc:276
SimulatorFrontend::machine
const TTAMachine::Machine & machine() const
Definition: SimulatorFrontend.cc:263
TracedSimulatorFrontend::SIMULATOR_RUN
@ SIMULATOR_RUN
Definition: TracedSimulatorFrontend.hh:74
SimulatorFrontend::next
virtual void next(int count=1)
Definition: SimulatorFrontend.cc:1052
TracedSimulatorFrontend::SIMULATOR_LOADING_PROGRAM
@ SIMULATOR_LOADING_PROGRAM
Definition: TracedSimulatorFrontend.hh:75
SimulatorFrontend::run
virtual void run()
Definition: SimulatorFrontend.cc:997
TracedSimulatorFrontend::SIMULATOR_MACHINE_LOADED
@ SIMULATOR_MACHINE_LOADED
Definition: TracedSimulatorFrontend.hh:70
SimulatorFrontend::loadMachine
virtual void loadMachine(const std::string &fileName)
Definition: SimulatorFrontend.cc:534
TracedSimulatorFrontend::SIMULATOR_STOP
@ SIMULATOR_STOP
Definition: TracedSimulatorFrontend.hh:73
SimulatorFrontend::loadProgram
virtual void loadProgram(const std::string &fileName)
Definition: SimulatorFrontend.cc:299
SimulatorFrontend::isSimulationRunning
bool isSimulationRunning() const
Definition: SimulatorFrontend.cc:1260
SimulatorFrontend::killSimulation
virtual void killSimulation()
Definition: SimulatorFrontend.cc:1784
SimulatorFrontend::step
virtual void step(double count=1)
Definition: SimulatorFrontend.cc:1034
TracedSimulatorFrontend::SIMULATOR_LOADING_MACHINE
@ SIMULATOR_LOADING_MACHINE
Definition: TracedSimulatorFrontend.hh:76
SimulatorFrontend::runUntil
virtual void runUntil(UIntWord address)
Definition: SimulatorFrontend.cc:1014
TracedSimulatorFrontend::SIMULATOR_RESET
@ SIMULATOR_RESET
Definition: TracedSimulatorFrontend.hh:77
TracedSimulatorFrontend::SIMULATOR_PROGRAM_LOADED
@ SIMULATOR_PROGRAM_LOADED
Definition: TracedSimulatorFrontend.hh:71
Informer::handleEvent
void handleEvent(int event)
SimulatorFrontend::SIM_NORMAL
@ SIM_NORMAL
Default, interpreted simulation (debugging engine).
Definition: SimulatorFrontend.hh:102