OpenASIP  2.0
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
SimulatorFrontend Class Reference

#include <SimulatorFrontend.hh>

Inheritance diagram for SimulatorFrontend:
Inheritance graph
Collaboration diagram for SimulatorFrontend:
Collaboration graph

Public Types

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

 SimulatorFrontend (SimulationType backend=SIM_NORMAL)
 
virtual ~SimulatorFrontend ()
 
virtual void loadProgram (const std::string &fileName)
 
virtual void loadMachine (const std::string &fileName)
 
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)
 
virtual void next (int count=1)
 
virtual void step (double count=1)
 
virtual void run ()
 
virtual void runUntil (UIntWord address)
 
void prepareToStop (StopReason reason)
 
unsigned int stopReasonCount () const
 
StopReason stopReason (unsigned int index) const
 
bool stoppedByUser () const
 
virtual void killSimulation ()
 
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)
 

Protected Types

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

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

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...
 

Friends

void timeoutThread (unsigned int timeout, SimulatorFrontend *simFE)
 

Detailed Description

Frontend to simulator functionality.

User interfaces use this class as the access point to simulation functionality. It acts as a "facade" hiding the complexity of simulator engine. Error messages of exceptions thrown by the methods of this class are generated using SimulatorTextGenerator, thus they can be used in user interfaces directly.

Definition at line 89 of file SimulatorFrontend.hh.

Member Typedef Documentation

◆ ProgramErrorDescription

typedef std::pair<RuntimeErrorSeverity, std::string> SimulatorFrontend::ProgramErrorDescription
protected

A type for storing a program error description.

Definition at line 288 of file SimulatorFrontend.hh.

◆ ProgramErrorDescriptionList

Container for simulated program error descriptions.

Definition at line 290 of file SimulatorFrontend.hh.

Member Enumeration Documentation

◆ RuntimeErrorSeverity

The severities of runtime errors.

Enumerator
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 on with the simulation.

Definition at line 93 of file SimulatorFrontend.hh.

93  {
94  RES_MINOR, ///< Minor runtime error, no abort necessary.
95  RES_FATAL ///< Fatal runtime error, there is a serious error in the
96  /// simulated program, thus it makes no sense to go on
97  /// with the simulation.

◆ SimulationType

Which type of simulation this SimulatorFrontend controls or connects to.

Enumerator
SIM_NORMAL 

Default, interpreted simulation (debugging engine).

SIM_COMPILED 

Compiled, faster simulation.

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.

Definition at line 101 of file SimulatorFrontend.hh.

101  {
102  SIM_NORMAL, ///< Default, interpreted simulation (debugging engine).
103  SIM_COMPILED, ///< Compiled, faster simulation.
104  SIM_REMOTE, ///< Remote debugger, not a simulator at all
105  SIM_CUSTOM, ///< User-implemented remote HW debugger
106  SIM_OTA ///< Simulation with operation-triggered implicit data
107  /// transports.
108  } SimulationType;

Constructor & Destructor Documentation

◆ SimulatorFrontend()

SimulatorFrontend::SimulatorFrontend ( SimulationType  backendType = SIM_NORMAL)

Constructor.

Definition at line 120 of file SimulatorFrontend.cc.

120  :
121  currentMachine_(NULL), simCon_(NULL),
124  currentBackend_(backendType),
125  disassembler_(NULL), executionTracing_(false),
126  busTracing_(false),
128  saveProfileData_(false), saveUtilizationData_(false),
129  stopPointManager_(NULL), tpef_(NULL),
136 
137  if (backendType == SIM_COMPILED) {
138  setCompiledSimulation(true);
139  setFUResourceConflictDetection(false); // disabled by default
141  } else {
142  setCompiledSimulation(false);
143  }
144 }

References SimulatorTextGenerator::generateCompiledSimTexts(), setCompiledSimulation(), setFUResourceConflictDetection(), SIM_COMPILED, and SimulatorToolbox::textGenerator().

Here is the call graph for this function:

◆ ~SimulatorFrontend()

SimulatorFrontend::~SimulatorFrontend ( )
virtual

Destructor.

Definition at line 149 of file SimulatorFrontend.cc.

149  {
150 
152 
154  delete currentMachine_;
155  currentMachine_ = NULL;
156  }
157 
159  delete currentProgram_;
160  currentProgram_ = NULL;
161  programFileName_ = "";
162  }
163 
164  delete disassembler_;
165  disassembler_ = NULL;
166  delete simCon_;
167  simCon_ = NULL;
168  delete stopPointManager_;
169  stopPointManager_ = NULL;
170  delete tpef_;
171  tpef_ = NULL;
172  delete eventHandler_;
173  eventHandler_ = NULL;
174  delete simCon_;
175  simCon_ = NULL;
177 
179 
180 }

References clearProgramErrorReports(), currentMachine_, currentProgram_, SequenceTools::deleteAllItems(), disassembler_, eventHandler_, finishSimulation(), machineOwnedByFrontend_, memorySystems_, programFileName_, programOwnedByFrontend_, simCon_, stopPointManager_, and tpef_.

Here is the call graph for this function:

Member Function Documentation

◆ automaticFinishImpossible()

bool SimulatorFrontend::automaticFinishImpossible ( ) const

Returns true in case simulation with the currently loaded program cannot be finished automatically.

In order for this method to return false, it means that while loading the simulated program, a probable ending point in the program was detected and it is possible that when running the simulation it is possible to finish it automatically at that position. If this method returns true it is impossible to finish simulation automatically.

Returns
True if it's not possible to end simulation automatically.

Definition at line 2230 of file SimulatorFrontend.cc.

2230  {
2231  return simCon_ != NULL && simCon_->automaticFinishImpossible();
2232 }

References TTASimulationController::automaticFinishImpossible(), and simCon_.

Referenced by ProgCommand::execute().

Here is the call graph for this function:

◆ busTracing()

bool SimulatorFrontend::busTracing ( ) const

Returns true in case bus tracing is enabled.

Returns
True in case bus tracing is enabled.

Definition at line 1808 of file SimulatorFrontend.cc.

1808  {
1809  return busTracing_;
1810 }

References busTracing_.

Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ callHistoryLength()

std::size_t SimulatorFrontend::callHistoryLength ( ) const
inline

Definition at line 267 of file SimulatorFrontend.hh.

267 { return callHistoryLength_; }

References callHistoryLength_.

Referenced by BackTraceCommand::execute().

◆ callPathTracker()

const CallPathTracker & SimulatorFrontend::callPathTracker ( int  core = -1) const

Definition at line 2393 of file SimulatorFrontend.cc.

2393  {
2394  assert(callPathTrackers_.size() > 0);
2395  if (core == -1) {
2396  return *callPathTrackers_.at(selectedCore());
2397  } else {
2398  return *callPathTrackers_.at(core);
2399  }
2400 }

References assert, callPathTrackers_, and selectedCore().

Referenced by BackTraceCommand::execute().

Here is the call graph for this function:

◆ clearProgramErrorReports()

void SimulatorFrontend::clearProgramErrorReports ( )

Clears the runtime error report list.

Definition at line 2360 of file SimulatorFrontend.cc.

2360  {
2361  programErrorReports_.clear();
2362 }

References programErrorReports_.

Referenced by ProximRuntimeErrorHandler::handleEvent(), RuntimeErrorReporter::handleEvent(), and ~SimulatorFrontend().

◆ compareState()

bool SimulatorFrontend::compareState ( SimulatorFrontend other,
std::ostream *  differences = NULL 
)

Compares the states of two simulator engines.

This is useful in debugging bugs in an simulator engine implementation. It assumes the engines have been stepped equal amount of instruction cycles and, thus, the TTA programmer visible context should be equal.

Parameters
otherA frontend to the other engine to compare this one to.
differencesAn optional output stream where to output information of the possible differences.
Returns
true in case the states are equal, false otherwise.

Definition at line 2415 of file SimulatorFrontend.cc.

2416  {
2417 
2418  static InstructionAddress previousPC = 0;
2419 
2420  if (programCounter() != other.programCounter()) {
2421  if (differences != NULL)
2422  *differences
2423  << "SIMULATION ERROR DETECTED (PCs DIFFER)" << std::endl
2424  << "--------------------------------------" << std::endl
2425  << " cycle: " << cycleCount() << std::endl
2426  << " other's PC: " << other.programCounter() << std::endl
2427  << " this' PC: " << programCounter() << std::endl;
2428  return false;
2429  }
2430 
2431  bool errorLocationPrinted = false;
2432  bool equal = true;
2433 
2436  for (int i = 0; i < rfNav.count(); ++i) {
2437  TTAMachine::RegisterFile& rf = *rfNav.item(i);
2438  for (int reg = 0; reg < rf.size(); ++reg) {
2439  std::string thisReg =
2440  registerFileValue(rf.name(), reg);
2441  std::string otherReg =
2442  other.registerFileValue(rf.name(), reg);
2443  if (thisReg != otherReg) {
2444  equal = false;
2445  if (!errorLocationPrinted && differences != NULL) {
2446  std::string procedureName =
2447  (dynamic_cast<TTAProgram::Procedure&>(
2448  program().instructionAt(programCounter()).parent())).name();
2449 
2450  *differences
2451  << "DIFFERING REGISTER FILE VALUES" << std::endl
2452  << "------------------------------" << std::endl
2453  << " cycle: " << cycleCount() << std::endl
2454  << " PC: " << programCounter() << std::endl
2455  << "previous PC: " << previousPC << std::endl
2456  << " function: " << procedureName << std::endl
2457  << "disassembly around previous PC:" << std::endl;
2458  int start =
2459  std::max(0, (int)previousPC - 5);
2460  int end = previousPC + 5;
2461  for (int instr = start; instr <= end; ++instr) {
2462  if (instr == (int)previousPC)
2463  *differences << "==> ";
2464  *differences
2466  program().instructionAt(instr),
2467  true)
2468  << std::endl;
2469  }
2470  errorLocationPrinted = true;
2471  }
2472  if (differences != NULL)
2473  *differences
2474  << rf.name() << "." << reg << ": "
2475  << thisReg << " (this) vs. "
2476  << otherReg << " (other)" << std::endl;
2477  }
2478  }
2479  }
2480 
2481  errorLocationPrinted = false;
2482 
2485  for (int i = 0; i < fuNav.count(); ++i) {
2486  TTAMachine::FunctionUnit& fu = *fuNav.item(i);
2487 
2488  for (int port = 0; port < fu.portCount(); ++port) {
2489  // skip output ports as compiled sim is not exact with them at BB boundaries
2490  if (fu.port(port)->isOutput())
2491  continue;
2492  std::string portName = fu.port(port)->name();
2493  DisassemblyFUPort portString(fu.name(), portName);
2494  SimValue thisReg =
2495  FUPortValue(fu.name(), portName);
2496  SimValue otherReg =
2497  other.FUPortValue(fu.name(), portName);
2498  if (thisReg.intValue() != otherReg.intValue()) {
2499  equal = false;
2500  if (!errorLocationPrinted && differences != NULL) {
2501  std::string procedureName =
2502  (dynamic_cast<TTAProgram::Procedure&>(
2503  program().instructionAt(programCounter()).parent())).name();
2504 
2505  *differences
2506  << "DIFFERING FUNCTION UNIT PORT VALUES" << std::endl
2507  << "-----------------------------------" << std::endl
2508  << " cycle: " << cycleCount() << std::endl
2509  << " PC: " << programCounter() << std::endl
2510  << "previous PC: " << previousPC << std::endl
2511  << " function: " << procedureName << std::endl
2512  << "disassembly around previous PC:" << std::endl;
2513  int start =
2514  std::max(0, (int)previousPC - 5);
2515  int end = previousPC + 5;
2516  for (int instr = start; instr <= end; ++instr) {
2517  if (instr == (int)previousPC)
2518  *differences << "==> ";
2519  *differences
2521  program().instructionAt(instr), true)
2522  << std::endl;
2523  }
2524  errorLocationPrinted = true;
2525  }
2526  if (differences != NULL)
2527  *differences
2528  << portString.toString() << ": "
2529  << thisReg.intValue() << " (this) vs. "
2530  << otherReg.intValue() << " (other)" << std::endl;
2531  }
2532 
2533  }
2534 
2535 
2536  }
2537 
2538  previousPC = programCounter();
2539 
2540  return equal;
2541 }

References TTAMachine::Machine::Navigator< ComponentType >::count(), cycleCount(), POMDisassembler::disassemble(), TTAMachine::Machine::functionUnitNavigator(), FUPortValue(), TTAProgram::Program::instructionAt(), SimValue::intValue(), TTAMachine::Port::isOutput(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine(), TTAMachine::Port::name(), TTAMachine::Component::name(), TTAProgram::Instruction::parent(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), program(), programCounter(), TTAMachine::Machine::registerFileNavigator(), registerFileValue(), TTAMachine::BaseRegisterFile::size(), and DisassemblyFUPort::toString().

Referenced by tandemSimulate().

Here is the call graph for this function:

◆ currentProcedure()

const Procedure & SimulatorFrontend::currentProcedure ( ) const

Returns the current procedure.

The current procedure is expected to be the nearest procedure behind the program counter.

Returns
The current procedure.
Todo:
Throw exception if simulation is not initialized

Definition at line 1210 of file SimulatorFrontend.cc.

1210  {
1211  assert(simCon_ != NULL);
1212  assert(currentProgram_ != NULL);
1213  InstructionAddress address = programCounter();
1214  if (address > currentProgram_->lastInstruction().address().location()) {
1215  return currentProgram_->lastProcedure();
1216  } else {
1217  return dynamic_cast<const Procedure&>(
1219  }
1220 }

References TTAProgram::Instruction::address(), assert, currentProgram_, TTAProgram::Program::instructionAt(), TTAProgram::Program::lastInstruction(), TTAProgram::Program::lastProcedure(), TTAProgram::Address::location(), TTAProgram::Instruction::parent(), programCounter(), and simCon_.

Referenced by DisassembleCommand::execute().

Here is the call graph for this function:

◆ cycleCount()

ClockCycleCount SimulatorFrontend::cycleCount ( ) const

◆ disassembleInstruction()

std::string SimulatorFrontend::disassembleInstruction ( UIntWord  instructionAddress) const

Returns the disassembly of instruction at given address.

Parameters
instructionAddressAddress (index) of the instruction wanted to disassemble.
Returns
Disassembly of an instruction.
Todo:
print all labels associated at address

Definition at line 1073 of file SimulatorFrontend.cc.

1073  {
1074 
1075  const Instruction& theInstruction =
1076  currentProgram_->instructionAt(instructionAddress);
1077  const Procedure& currentProc = dynamic_cast<const Procedure&>(
1078  theInstruction.parent());
1079 
1080  bool firstInstructionInProcedure =
1081  (currentProc.startAddress().location() == instructionAddress);
1082 
1083  std::string disassembly = "";
1084 
1085  /// @todo print all labels associated at address
1086 
1087  if (firstInstructionInProcedure) {
1088  disassembly += "\n" + currentProc.name() + ":\n";
1089  }
1090 
1092 
1093  disassembly +=
1094  Conversion::toString(instructionAddress) + ":\t\t" +
1095  disassembler_->disassembleInstruction(theInstruction);
1096  return disassembly;
1097 }

References currentProgram_, POMDisassembler::disassembleInstruction(), disassembler_, initializeDisassembler(), TTAProgram::Program::instructionAt(), TTAProgram::Address::location(), TTAProgram::Procedure::name(), TTAProgram::Instruction::parent(), TTAProgram::CodeSnippet::startAddress(), and Conversion::toString().

Referenced by DisassembleCommand::execute().

Here is the call graph for this function:

◆ eventHandler()

SimulationEventHandler & SimulatorFrontend::eventHandler ( )

Returns the instance of SimulationEventHandler.

Returns
The instance of SimulationEventHandler.
Todo:
This should probably be an inline function as it used to be in the SimulatorToolbox class...

Definition at line 2260 of file SimulatorFrontend.cc.

2260  {
2261  if (eventHandler_ == NULL) {
2263  }
2264  return *eventHandler_;
2265 }

References eventHandler_.

Referenced by BusTracker::BusTracker(), CompiledSimulation::cycleEnd(), ExecutionTracker::ExecutionTracker(), initializeSimulation(), SimulationController::next(), CompiledSimController::next(), ProcedureTransferTracker::ProcedureTransferTracker(), ProximRuntimeErrorHandler::ProximRuntimeErrorHandler(), MemoryProxy::read(), SimpleSimulatorFrontend::registerEventListener(), reportSimulatedProgramError(), RFAccessTracker::RFAccessTracker(), SimulationController::run(), CompiledSimController::run(), RuntimeErrorReporter::RuntimeErrorReporter(), SimulationController::runUntil(), CompiledSimController::runUntil(), OTASimulationController::simulateCycle(), SimulationController::simulateCycle(), SimulationController::step(), CompiledSimController::step(), SimpleSimulatorFrontend::unregisterEventListener(), MemoryProxy::write(), BusTracker::~BusTracker(), ExecutionTracker::~ExecutionTracker(), ProcedureTransferTracker::~ProcedureTransferTracker(), ProximRuntimeErrorHandler::~ProximRuntimeErrorHandler(), RFAccessTracker::~RFAccessTracker(), and RuntimeErrorReporter::~RuntimeErrorReporter().

◆ executableInstructionAt()

const ExecutableInstruction & SimulatorFrontend::executableInstructionAt ( InstructionAddress  address) const

Returns reference to the instruction at given address.

Returns
Instruction at the given address.

Definition at line 2208 of file SimulatorFrontend.cc.

2209  {
2210 
2211  assert(simCon_ != NULL);
2212  const InstructionMemory& memory = dynamic_cast<SimulationController*>(
2213  simCon_)->instructionMemory();
2214  return memory.instructionAtConst(address);
2215 }

References assert, InstructionMemory::instructionAtConst(), and simCon_.

Referenced by DisasmExecPercentageAttrProvider::moveCellAttr(), DisasmTopCountAttrProvider::moveCellAttr(), DesignSpaceExplorer::simulate(), and DisasmTopCountAttrProvider::updateTopCountTable().

Here is the call graph for this function:

◆ executionTracing()

bool SimulatorFrontend::executionTracing ( ) const

Returns true in case execution tracing is enabled.

Returns
True in case execution tracing is enabled.

Definition at line 1798 of file SimulatorFrontend.cc.

1798  {
1799  return executionTracing_;
1800 }

References executionTracing_.

Referenced by SimulatorSettingsDialog::onOK(), CompiledSimController::reset(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ findBooleanRegister()

StateData & SimulatorFrontend::findBooleanRegister ( )

Finds the state connected to the boolean register.

Currently boolean register is expected to be the first register in a register file with only one register of width 1.

Todo:
Improve evaluation when the correct way is known.
Returns
State connected to the bool register.
Exceptions
InstanceNotFoundIf bool register cannot be found.

Definition at line 709 of file SimulatorFrontend.cc.

709  {
710  assert(currentMachine_ != NULL);
711 
712  Machine::RegisterFileNavigator navigator =
714 
715  // go through all the register files in the machine
716  for (int i = 0; i < navigator.count(); ++i) {
717  RegisterFile* rf = navigator.item(i);
718  if (rf->width() == 1 && rf->numberOfRegisters() == 1) {
719  RegisterFileState& rfState =
721  return rfState.registerState(0);
722  }
723  }
724 
725  throw InstanceNotFound(
726  __FILE__, __LINE__, __func__, "No boolean register found.");
727 }

References __func__, assert, TTAMachine::Machine::Navigator< ComponentType >::count(), currentMachine_, TTAMachine::Machine::Navigator< ComponentType >::item(), machineState(), TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::registerFileNavigator(), MachineState::registerFileState(), RegisterFileState::registerState(), and TTAMachine::BaseRegisterFile::width().

Referenced by state().

Here is the call graph for this function:

◆ findPort()

StateData & SimulatorFrontend::findPort ( const std::string &  fuName,
const std::string &  portName 
)

Finds the port using a search string.

The search string supported currently is of format {function unit name].{port name}.

Parameters
fuNameThe name of the operation or the function unit.
portNameThe name of the operand or the port.
Returns
State connected to the register.
Exceptions
InstanceNotFoundIf the register cannot be found.
Todo:
Get the list of control operations from GCU instead of hard coding like this

Definition at line 819 of file SimulatorFrontend.cc.

820  {
821  assert(currentMachine_ != NULL);
822 
823  const std::string exceptionMessage =
824  std::string("No port ") + fuName + "." + portName + " found.";
825 
826  // first try to fetch the port from GCU
827  PortState& foundState =
829  portName, currentMachine_->controlUnit()->name());
830 
831  if (&foundState != &NullPortState::instance()) {
832  return foundState;
833  }
834 
835  /// @todo Get the list of control operations from GCU instead of
836  /// hard coding like this
837  if (StringTools::ciEqual(fuName, "call") ||
838  StringTools::ciEqual(fuName, "jump")) {
839 
840  // we'll try converting the port name to an operand number
841  int operandNumber = -1;
842  try {
843  operandNumber = Conversion::toInt(portName);
844  } catch (const NumberFormatException&) {
845  // portName was not a number, we cannot find it in the
846  // GCU for sure
847  throw InstanceNotFound(
848  __FILE__, __LINE__, __func__, exceptionMessage);
849  }
850 
851  // it's a control flow operand, we should get the port from GCU
852  return machineState().portState(
854  operandNumber)->name(),
856  }
857 
858  return machineState().portState(
859  StringTools::stringToLower(portName),
861  throw InstanceNotFound(
862  __FILE__, __LINE__, __func__, exceptionMessage);
863 }

References __func__, assert, StringTools::ciEqual(), TTAMachine::Machine::controlUnit(), currentMachine_, NullPortState::instance(), machineState(), TTAMachine::Port::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), MachineState::portState(), StringTools::stringToLower(), and Conversion::toInt().

Referenced by state().

Here is the call graph for this function:

◆ findRegister()

StateData & SimulatorFrontend::findRegister ( const std::string &  rfName,
int  registerIndex 
)

Finds the state connected to a register.

Todo:
Improve evaluation when the parallel assembler syntax is known.
Parameters
rfNameThe name of the register file.
registerIndexIndex of the register in the register file.
Returns
State connected to the register.
Exceptions
InstanceNotFoundIf the register cannot be found.

Definition at line 785 of file SimulatorFrontend.cc.

785  {
786  assert(currentMachine_ != NULL);
787 
788  Machine::RegisterFileNavigator navigator =
790 
791  std::string regFileName = rfName;
792  if (!navigator.hasItem(rfName)) {
793  throw InstanceNotFound(
794  __FILE__, __LINE__, __func__,
795  "Register file " + rfName + " not found.");
796  }
797  try {
799  regFileName).registerState(registerIndex);
800  } catch (const OutOfRange&) {
801  throw InstanceNotFound(
802  __FILE__, __LINE__, __func__,
803  "Register index out of range");
804  }
805 }

References __func__, assert, currentMachine_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), machineState(), TTAMachine::Machine::registerFileNavigator(), MachineState::registerFileState(), and RegisterFileState::registerState().

Referenced by SimulationController::registerFileValue().

Here is the call graph for this function:

◆ finishSimulation()

void SimulatorFrontend::finishSimulation ( )

Finishes the currently running simulation.

Flushes any simulation traces etc., but does not unload nor dealloacate the loaded machine and the program. This is to allow restarting the simulation without needing to reinitialize the machine and program.

Definition at line 1538 of file SimulatorFrontend.cc.

1538  {
1539 
1540  if (simCon_ == NULL)
1541  return;
1542 
1544  if (traceDBs_.size() == 0)
1545  return;
1546 
1547  for (int core = 0; core < 1; ++core) {
1548  // flush the concurrent RF access trace data
1549  ExecutionTrace* traceDB = traceDBs_.at(core);
1550  if (rfAccessTracing_) {
1552  assert(rfAccessTracker != NULL);
1555  for (RFAccessTracker::ConcurrentRFAccessIndex::const_iterator i =
1556  accesses.begin(); i != accesses.end(); ++i) {
1557  const RFAccessTracker::ConcurrentRFAccess& access = (*i).first;
1558  const std::string& rfName = access.get<0>();
1559  const std::size_t& reads = access.get<2>();
1560  const std::size_t& writes = access.get<1>();
1561  const ClockCycleCount& count = (*i).second;
1563  rfName, reads, writes, count);
1564  }
1565  }
1566 
1567  if (saveUtilizationData_) {
1568  const UtilizationStats& stats = utilizationStatistics(core);
1569  // save the function unit operation execution counts
1572  for (int i = 0; i <= fuNav.count(); ++i) {
1573  TTAMachine::FunctionUnit* fu = NULL;
1574  if (i < fuNav.count())
1575  fu = fuNav.item(i);
1576  else
1577  fu = machine().controlUnit();
1578  assert(fu != NULL);
1579  const ClockCycleCount totalTriggersOfFU =
1580  stats.triggerCount(fu->name());
1581 
1582  if (totalTriggersOfFU == 0)
1583  continue;
1584 
1585  for (int j = 0; j < fu->operationCount(); ++j) {
1586  const TTAMachine::HWOperation* op = fu->operation(j);
1587  assert(op != NULL);
1588  const std::string operationUpper =
1590 
1591  const ClockCycleCount executions =
1592  stats.operationExecutions(fu->name(), operationUpper);
1593 
1594  if (executions == 0)
1595  continue;
1596 
1598  fu->name(), operationUpper, executions);
1599  }
1600  }
1601 
1602 
1603  // save the socket write counts
1604  const TTAMachine::Machine::SocketNavigator& socketNav =
1606  for (int i = 0; i < socketNav.count(); ++i) {
1607 
1608  TTAMachine::Socket* socket = socketNav.item(i);
1609  assert(socket != NULL);
1610  const ClockCycleCount writes =
1611  stats.socketWrites(socket->name());
1612 
1613  traceDB->addSocketWriteCount(socket->name(), writes);
1614  }
1615 
1616  // save the bus write counts
1617  const TTAMachine::Machine::BusNavigator& busNav =
1618  machine().busNavigator();
1619  for (int i = 0; i < busNav.count(); ++i) {
1620  TTAMachine::Bus* bus = busNav.item(i);
1621  assert(bus != NULL);
1622  const ClockCycleCount writes = stats.busWrites(bus->name());
1623 
1624  traceDB->addBusWriteCount(bus->name(), writes);
1625  }
1626 
1627  // save the register access stats
1630  for (int i = 0; i < rfNav.count(); ++i) {
1631  TTAMachine::RegisterFile* rf = rfNav.item(i);
1632  assert(rf != NULL);
1633 
1634  int maxRegs = 0;
1635  maxRegs = rf->numberOfRegisters();
1636  for (int reg = 0; reg < maxRegs; ++reg) {
1637  ClockCycleCount reads =
1638  stats.registerReads(rf->name(), reg);
1639  ClockCycleCount writes =
1640  stats.registerWrites(rf->name(), reg);
1641  traceDB->addRegisterAccessCount(
1642  rf->name(), reg, reads, writes);
1643  }
1644  }
1645 
1646  }
1647 
1648  if (saveProfileData_) {
1649 
1650  // save the instruction execution counts (profile data)
1651  const InstructionMemory& instructions =
1652  dynamic_cast<SimulationController*>(simCon_)->
1653  instructionMemory(core);
1654 
1655  InstructionAddress firstAddress =
1657  InstructionAddress lastAddress =
1660 
1661  for (InstructionAddress a = firstAddress; a <= lastAddress; ++a) {
1663  a, instructions.instructionAtConst(a).executionCount());
1664  }
1665  }
1666 
1668  // save the start addresses of procedures in order to provide
1669  // possibility for more readable query outputs with traces
1670  // that include procedure data in them
1671  for (int i = 0; i < currentProgram_->procedureCount(); ++i) {
1672  const Procedure& procedure = currentProgram_->procedure(i);
1673  traceDB->addProcedureAddressRange(
1674  procedure.startAddress().location(),
1675  procedure.endAddress().location() - 1, procedure.name());
1676  }
1677  }
1678 
1679  traceDB->setSimulatedCycleCount(cycleCount());
1680 
1681  if (traceDBOwned_[core]) {
1682  delete traceDBs_[core];
1683  traceDBs_[core]=NULL;
1684  }
1685  }
1686 
1692 }

References RFAccessTracker::accessDataBase(), ExecutionTrace::addBusWriteCount(), ExecutionTrace::addConcurrentRegisterFileAccessCount(), ExecutionTrace::addFunctionUnitOperationTriggerCount(), ExecutionTrace::addInstructionExecutionCount(), ExecutionTrace::addProcedureAddressRange(), ExecutionTrace::addRegisterAccessCount(), TTAProgram::Instruction::address(), ExecutionTrace::addSocketWriteCount(), assert, TTAMachine::Machine::busNavigator(), busTrackers_, UtilizationStats::busWrites(), callPathTrackers_, TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), currentProgram_, cycleCount(), SequenceTools::deleteAllItems(), TTAProgram::CodeSnippet::endAddress(), ExecutableInstruction::executionCount(), executionTrackers_, TTAMachine::Machine::functionUnitNavigator(), InstructionMemory::instructionAtConst(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAProgram::Program::lastInstruction(), TTAProgram::Address::location(), machine(), TTAMachine::HWOperation::name(), TTAProgram::Procedure::name(), TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), UtilizationStats::operationExecutions(), TTAProgram::Program::procedure(), TTAProgram::Program::procedureCount(), procedureTransferTracing_, procedureTransferTrackers_, TTAMachine::Machine::registerFileNavigator(), UtilizationStats::registerReads(), UtilizationStats::registerWrites(), rfAccessTracing_, rfAccessTracker(), rfAccessTrackers_, saveProfileData_, saveUtilizationData_, ExecutionTrace::setSimulatedCycleCount(), simCon_, TTAMachine::Machine::socketNavigator(), UtilizationStats::socketWrites(), TTAProgram::CodeSnippet::startAddress(), TTAProgram::Program::startAddress(), StringTools::stringToUpper(), traceDBOwned_, traceDBs_, UtilizationStats::triggerCount(), utilizationStatistics(), and utilizationStats_.

Referenced by ProximSimulationThread::finishSimulation(), killSimulation(), loadMachine(), and ~SimulatorFrontend().

Here is the call graph for this function:

◆ forceTraceDBFileName()

void SimulatorFrontend::forceTraceDBFileName ( const std::string &  fileName)
inline

Definition at line 178 of file SimulatorFrontend.hh.

178  {
179  forcedTraceDBFileName_ = fileName;
180  }

References forcedTraceDBFileName_.

Referenced by DesignSpaceExplorer::simulate().

◆ FUPortValue()

SimValue SimulatorFrontend::FUPortValue ( const std::string &  fuName,
const std::string &  portName 
)
virtual

Returns the current value of a FU port

Parameters
fuNamename of the function unit
portNamename of the FU port
Returns
Current value of a FU port

Definition at line 767 of file SimulatorFrontend.cc.

768  {
769  assert(currentMachine_ != NULL);
770 
771  return simCon_->FUPortValue(fuName, portName);
772 }

References assert, currentMachine_, TTASimulationController::FUPortValue(), and simCon_.

Referenced by compareState(), and InfoPortsCommand::execute().

Here is the call graph for this function:

◆ fuResourceConflictDetection()

bool SimulatorFrontend::fuResourceConflictDetection ( ) const

Returns true if FU resource conflict detection is on, false if not.

Returns
Returns current fu conflict detection setting.

Definition at line 2032 of file SimulatorFrontend.cc.

2032  {
2034 }

References fuResourceConflictDetection_.

Referenced by SimulatorSettingsDialog::onOK(), CompiledSimController::reset(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ hasSimulationEnded()

bool SimulatorFrontend::hasSimulationEnded ( ) const

◆ hasStopReason()

bool SimulatorFrontend::hasStopReason ( StopReason  reason) const
protected

Helper function which tells whether simulation has stopped because of the given reason.

Returns
True if the given reason was one of the reasons the simulation was stopped.

Definition at line 1369 of file SimulatorFrontend.cc.

1369  {
1370 
1371  if (simCon_ == NULL) {
1372  return false;
1373  }
1374 
1375  for (size_t i = 0; i < stopReasonCount(); ++i) {
1376  if (stopReason(i) == reason) {
1377  return true;
1378  }
1379  }
1380  return false;
1381 }

References simCon_, stopReason(), and stopReasonCount().

Referenced by stoppedByUser().

Here is the call graph for this function:

◆ immediateUnitRegisterValue()

SimValue SimulatorFrontend::immediateUnitRegisterValue ( const std::string &  iuName,
int  index = -1 
)
virtual

Returns the current value of a IU register

Parameters
iuNamename of the immediate unit
indexindex of the register
Returns
Current value of a IU register

Definition at line 752 of file SimulatorFrontend.cc.

753  {
754  assert(currentMachine_ != NULL);
755 
756  return simCon_->immediateUnitRegisterValue(iuName, index);
757 }

References assert, currentMachine_, TTASimulationController::immediateUnitRegisterValue(), and simCon_.

Here is the call graph for this function:

◆ initializeDataMemories()

void SimulatorFrontend::initializeDataMemories ( const TTAMachine::AddressSpace onlyOne = NULL)

Resets and writes initial data to the memory system stored in simulation controller from loaded TPEF.

Parameters
onlyOneinitialize the data memory of the given address space only. If onlyOne is NULL, tries to intialize all data memories.

Definition at line 440 of file SimulatorFrontend.cc.

441  {
442 
443  // we need tpef to get the initialization data and simcon to fetch
444  // the memory system from
445  if (currentProgram_ == NULL || simCon_ == NULL)
446  return;
447 
451 
452  const int dataSections = currentProgram_->dataMemoryCount();
453 
454  if (dataSections < 0)
455  return;
456 
457  for (int core = 0; core < 1; ++core) {
458  // data memory initialization
459  for (int i = 0; i < dataSections; ++i) {
460 
461  // initialize the data memory
462  const DataMemory& data = currentProgram_->dataMemory(i);
463  const std::string addressSpaceName =
464  data.addressSpace().name();
465 
466  try {
467  MemorySystem::MemoryPtr dataMemory =
468  simCon_->memorySystem(core).memory(addressSpaceName);
469 
470  const AddressSpace& addressSpace =
472  addressSpaceName);
473 
474  if ((onlyOne != NULL && &addressSpace != onlyOne) ||
475  (addressSpace.isShared() && core != 0)) continue;
476 
477  for (int d = 0; d < data.dataDefinitionCount(); ++d) {
478  const DataDefinition& def = data.dataDefinition(d);
479  if (!def.isInitialized()) {
480  continue;
481  }
482 
483  Address startAddress = def.startAddress();
484  // Check that the defined data is inside the address
485  // space.
486  if (def.startAddress().space().name() !=
487  addressSpaceName ||
488  startAddress.location() < addressSpace.start() ||
489  (startAddress.location() + def.size() - 1)
490  > addressSpace.end()) {
491 
492  throw IllegalProgram(
493  __FILE__, __LINE__, __func__,
494  std::string("Initialization data for ") +
495  addressSpace.name() +
496  " is out of address space bounds.");
497  }
498  for (int m = 0; m < def.size(); m++) {
499  dataMemory->write(
500  startAddress.location() + m, def.MAU(m));
501  }
502  }
503 
504  } catch (const InstanceNotFound& inf) {
505  std::string errorMsg =
508  if (inf.errorMessage() != "")
509  errorMsg += " Reason: " + inf.errorMessage();
510  delete tpef_;
511  tpef_ = NULL;
512  delete simCon_;
513  simCon_ = NULL;
514  throw IllegalProgram(
515  __FILE__, __LINE__, __func__, errorMsg);
516  }
517  }
518  }
519 }

References __func__, TTAProgram::DataMemory::addressSpace(), MemorySystem::addressSpace(), currentProgram_, TTAProgram::DataMemory::dataDefinition(), TTAProgram::DataMemory::dataDefinitionCount(), TTAProgram::Program::dataMemory(), TTAProgram::Program::dataMemoryCount(), TTAMachine::AddressSpace::end(), Exception::errorMessage(), MemorySystem::fillAllMemoriesWithZero(), TTAProgram::DataDefinition::isInitialized(), TTAMachine::AddressSpace::isShared(), TTAProgram::Address::location(), TTAProgram::DataDefinition::MAU(), MemorySystem::memory(), TTASimulationController::memorySystem(), memorySystem(), TTAMachine::Component::name(), MemorySystem::resetAllMemories(), simCon_, TTAProgram::DataDefinition::size(), TTAProgram::Address::space(), TTAMachine::AddressSpace::start(), TTAProgram::DataDefinition::startAddress(), Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), tpef_, Texts::TXT_ILLEGAL_INPUT_FILE, and zeroFillMemoriesOnReset_.

Referenced by SimpleSimulatorFrontend::initializeDataMemories(), killSimulation(), and loadProgram().

Here is the call graph for this function:

◆ initializeDisassembler()

void SimulatorFrontend::initializeDisassembler ( ) const
protected

Initializes the disassembler.

Creates a new POMDisassembler for the loaded program if it was not loaded already.

Definition at line 1152 of file SimulatorFrontend.cc.

1152  {
1153 
1154  if (disassembler_ != NULL || currentProgram_ == NULL) {
1155  // already initialized or no program to disassemble
1156  return;
1157  }
1158  disassembler_ =
1160 }

References currentMachine_, currentProgram_, POMDisassembler::disassembler(), and disassembler_.

Referenced by disassembleInstruction(), and programLocationDescription().

Here is the call graph for this function:

◆ initializeMemorySystem()

void SimulatorFrontend::initializeMemorySystem ( )
protected

Initializes the memory system according to the address spaces in the loaded machine.

Definition at line 1699 of file SimulatorFrontend.cc.

1699  {
1700 
1701  assert (currentMachine_ != NULL);
1702  const Machine& machine = *currentMachine_;
1703  MemorySystem* firstMemorySystem = NULL;
1704 
1705  for (int core = 0; core < 1; ++core) {
1706 
1707  MemorySystem* memorySystem_ = new MemorySystem(machine);
1708 
1709  // create a memory system for the loaded machine by going
1710  // through all address spaces in the machine and create a memory model
1711  // for each of them, except for the one of GCU's
1713 
1714  std::string controlUnitASName = "";
1715  if (machine.controlUnit() != NULL &&
1717  controlUnitASName = machine.controlUnit()->addressSpace()->name();
1718  }
1719 
1720  for (int i = 0; i < nav.count(); ++i) {
1721  const AddressSpace& space = *nav.item(i);
1722 
1723  if (space.name() == controlUnitASName)
1724  continue;
1725 
1726  const bool shared = space.isShared();
1727 
1729 
1730  if (shared && firstMemorySystem != NULL) {
1731  // the memory model should have been created previously
1732  // because all cores share the same memory
1733  mem = firstMemorySystem->memory(space.name());
1734  assert(mem != NULL);
1735  } else {
1736  switch (currentBackend_) {
1737  case SIM_COMPILED:
1739  new DirectAccessMemory(
1740  space.start(), space.end(), space.width(), machine.isLittleEndian()));
1741  break;
1742  case SIM_OTA:
1743  case SIM_NORMAL:
1745  new IdealSRAM(
1746  space.start(), space.end(), space.width(), machine.isLittleEndian()));
1747  break;
1748  case SIM_REMOTE:
1749  case SIM_CUSTOM:
1751  new RemoteMemory( space, machine.isLittleEndian()));
1752 
1753  break;
1754  default:
1755  throw Exception(
1756  __FILE__, __LINE__, __func__,
1757  "Internal error: memory model not specified");
1758  }
1759  // If memory tracking is enabled, memories are wrapped by
1760  // a proxy that tracks memory access.
1761  if (memoryAccessTracking_) {
1763  new MemoryProxy(*this, mem.get()));
1764  }
1765  }
1766  memorySystem_->addAddressSpace(space, mem, shared);
1767  }
1768  memorySystems_.push_back(memorySystem_);
1769  if (firstMemorySystem == NULL)
1770  firstMemorySystem = memorySystem_;
1771  }
1772 }

References __func__, MemorySystem::addAddressSpace(), TTAMachine::FunctionUnit::addressSpace(), TTAMachine::Machine::addressSpaceNavigator(), assert, TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), currentBackend_, currentMachine_, TTAMachine::AddressSpace::end(), TTAMachine::FunctionUnit::hasAddressSpace(), TTAMachine::Machine::isLittleEndian(), TTAMachine::AddressSpace::isShared(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine(), MemorySystem::memory(), memoryAccessTracking_, memorySystems_, TTAMachine::Component::name(), SIM_COMPILED, SIM_CUSTOM, SIM_NORMAL, SIM_OTA, SIM_REMOTE, TTAMachine::AddressSpace::start(), and TTAMachine::AddressSpace::width().

Referenced by loadMachine().

Here is the call graph for this function:

◆ initializeSimulation()

void SimulatorFrontend::initializeSimulation ( )
protectedvirtual

Initializes a new simulation.

Creates the SimulationController and initializes the program counter to point to the first executed instruction. Assumes the simulation is not running and the possible old simulation data is freed.

Exceptions
ExceptionThere can be several types of exceptions thrown when building the simulation machine model or the preprocessed program.

Definition at line 657 of file SimulatorFrontend.cc.

657  {
658 
659  delete simCon_;
660  simCon_ = NULL;
661  switch(currentBackend_) {
662  case SIM_REMOTE:
663  simCon_ =
664  new TCEDBGController(
665  *this, *currentMachine_, *currentProgram_);
667  break;
668  case SIM_CUSTOM:
669  simCon_ =
671  *this, *currentMachine_, *currentProgram_);
673  break;
674  case SIM_COMPILED:
675  simCon_ =
677  *this, *currentMachine_, *currentProgram_,
679  break;
680  case SIM_OTA:
681  simCon_ =
683  *this, *currentMachine_, *currentProgram_);
684  break;
685  case SIM_NORMAL:
686  default:
687  simCon_ =
689  *this, *currentMachine_, *currentProgram_,
691  }
692 
693  delete stopPointManager_;
695 }

References currentBackend_, currentMachine_, currentProgram_, detailedSimulation_, eventHandler(), fuResourceConflictDetection_, leaveCompiledDirty_, setControllerForMemories(), SIM_COMPILED, SIM_CUSTOM, SIM_NORMAL, SIM_OTA, SIM_REMOTE, simCon_, and stopPointManager_.

Referenced by loadProgram().

Here is the call graph for this function:

◆ initializeTracing()

void SimulatorFrontend::initializeTracing ( )
protected

Initializes the trace database(s).

In case no traces are enabled, this method does nothing. Making multiple calls to this method is not harmful.

Exceptions
IOExceptionIn case trace database file could not be accessed.
Note
May throw IOException.

Definition at line 1414 of file SimulatorFrontend.cc.

1414  {
1418 
1419  int coreCount = 1;
1420 
1421  traceDBs_.resize(coreCount, NULL);
1422  traceDBOwned_.resize(coreCount, true);
1423  executionTrackers_.resize(coreCount, NULL);
1424  rfAccessTrackers_.resize(coreCount, NULL);
1425  procedureTransferTrackers_.resize(coreCount, NULL);
1426  busTrackers_.resize(coreCount, NULL);
1427  for (int core = 0; core < 1; ++core) {
1428 
1429  ExecutionTrace* traceDB = traceDBs_.at(core);
1430  // initialize the data base for each core
1431  if (traceDB == NULL) {
1432  TCEString traceFileName;
1433  if (forcedTraceDBFileName_ == "") {
1434  // generate the file name
1435 
1436  TCEString coreMarker = "";
1437  if (coreCount > 1) {
1438  coreMarker << ".core";
1439  coreMarker << core;
1440  }
1441  TCEString fname = programFileName_;
1442  if (coreCount > 1) {
1443  fname << ".core";
1444  fname << core;
1445  }
1446  fname << ".trace";
1447 
1448  int runningNumber = 1;
1449  while (FileSystem::fileExists(fname)) {
1450  // append ".n" where n is a running number, in case the
1451  // file exists
1452  fname = programFileName_;
1453  if (coreCount > 1) {
1454  fname << ".core";
1455  fname << core;
1456  }
1457  fname << ".trace";
1458  fname << "." << runningNumber;
1459  ++runningNumber;
1460  }
1461  traceFileName = fname;
1462  } else {
1463  traceFileName = forcedTraceDBFileName_;
1464  }
1465 
1466  /// @note May throw IOException.
1467  traceDB = ExecutionTrace::open(traceFileName);
1468  traceDBs_[core] = traceDB;
1469  traceDBOwned_[core] = true;
1470  }
1471 
1472  ExecutionTracker* executionTracker = executionTrackers_.at(core);
1473  if (executionTracing_ && executionTracker == NULL) {
1474  executionTracker =
1475  new ExecutionTracker(*simCon_, *traceDB);
1476  executionTrackers_[core] = executionTracker;
1477  }
1478 
1479  if (rfAccessTracing_) {
1480  rfAccessTrackers_[core] =
1481  new RFAccessTracker(
1482  *this,
1483  dynamic_cast<SimulationController*>(
1484  simCon_)->instructionMemory(core));
1485  }
1488  new ProcedureTransferTracker(*this, *traceDB);
1489  }
1490 
1491  if (busTracing_) {
1492  // generate the file name
1493  TCEString busTraceFileName = programFileName_;
1494  if (coreCount > 1)
1495  busTraceFileName << ".core" << core;
1496 
1497  busTraceFileName << ".bustrace";
1498 
1499  int runningNumber = 1;
1500  while (FileSystem::fileExists(busTraceFileName)) {
1501  // append ".n" where n is a running number, in case the
1502  // file exists
1503 
1504  busTraceFileName = programFileName_;
1505  if (coreCount > 1)
1506  busTraceFileName << ".core" << core;
1507 
1508  busTraceFileName << ".bustrace";
1509  busTraceFileName << "." << runningNumber;
1510  ++runningNumber;
1511  }
1512 
1513  std::ostream* busTraceStream =
1514  new std::ofstream(busTraceFileName.c_str(), std::ios::out);
1515  if (!busTraceStream) {
1516  std::string errorMessage =
1517  "Unable to open bus trace file " + busTraceFileName +
1518  " for writing.";
1519  throw IOException(
1520  __FILE__, __LINE__, __func__, errorMessage);
1521  }
1522  busTrackers_[core] =
1523  new BusTracker(*this, busTraceStream);
1524  }
1525  }
1526  }
1528 }

References __func__, busTracing_, busTrackers_, executionTracing_, executionTrackers_, FileSystem::fileExists(), forcedTraceDBFileName_, ExecutionTrace::open(), procedureTransferTracing_, procedureTransferTrackers_, programFileName_, rfAccessTracing_, rfAccessTrackers_, saveProfileData_, saveUtilizationData_, setupCallHistoryTracking(), simCon_, traceDBOwned_, and traceDBs_.

Referenced by killSimulation(), and loadProgram().

Here is the call graph for this function:

◆ isCompiledSimulation()

bool SimulatorFrontend::isCompiledSimulation ( ) const

Returns true if the current simulation engine uses compiled simulation

Returns
true if the current simulation engine uses compiled simulation

Definition at line 1295 of file SimulatorFrontend.cc.

1295  {
1296  return currentBackend_ == SIM_COMPILED;
1297 }

References currentBackend_, and SIM_COMPILED.

Referenced by loadMachine(), loadProgram(), SimulatorCLI::SimulatorCLI(), and utilizationStatistics().

◆ isCustomDebugger()

bool SimulatorFrontend::isCustomDebugger ( ) const

Check if we are currently using a custom debugger. This returns true if we are attached to a FPGA or an ASIC with on-circuit debug hardware.

Returns
true if we are using a custom debugger target.

Definition at line 1317 of file SimulatorFrontend.cc.

1317  {
1318  return currentBackend_ == SIM_CUSTOM;
1319 }

References currentBackend_, and SIM_CUSTOM.

◆ isMachineLoaded()

bool SimulatorFrontend::isMachineLoaded ( ) const

Returns true if a machine has been loaded for the simulation

Returns
True if machine has been loaded.

Definition at line 1250 of file SimulatorFrontend.cc.

1250  {
1251  return (currentMachine_ != NULL);
1252 }

References currentMachine_.

Referenced by setupCallHistoryTracking().

◆ isProgramLoaded()

bool SimulatorFrontend::isProgramLoaded ( ) const

Returns true if the simulation has been initialized with a program successfully.

Returns
True if simulation has been initialized.

Definition at line 1240 of file SimulatorFrontend.cc.

1240  {
1241  return (simCon_ != NULL && currentProgram_ != NULL);
1242 }

References currentProgram_, and simCon_.

Referenced by DisasmExecPercentageAttrProvider::moveCellAttr().

◆ isSimulationInitialized()

bool SimulatorFrontend::isSimulationInitialized ( ) const

◆ isSimulationRunning()

bool SimulatorFrontend::isSimulationRunning ( ) const

◆ isSimulationStopped()

bool SimulatorFrontend::isSimulationStopped ( ) const

◆ isTCEDebugger()

bool SimulatorFrontend::isTCEDebugger ( ) const

Check if we are currently using a TCE built-in debugger. This returns true if we are attached to a FPGA or an ASIC with on-circuit debug hardware.

Returns
true if we are using a TCE debug target.

Definition at line 1306 of file SimulatorFrontend.cc.

1306  {
1307  return currentBackend_ == SIM_REMOTE;
1308 }

References currentBackend_, and SIM_REMOTE.

◆ killSimulation()

void SimulatorFrontend::killSimulation ( )
virtual

Kills the currently running simulation.

Allows restarting the simulation with the loaded machine and program. Flushes data collected during simulation to the trace file, if tracing is enabled, and reinitializes everything that needs to be reinitialized, such as the data memory initial values.

Reimplemented in TracedSimulatorFrontend.

Definition at line 1784 of file SimulatorFrontend.cc.

1784  {
1785  finishSimulation();
1786  simCon_->reset();
1789  lastRunCycleCount_ = 0;
1790 }

References finishSimulation(), initializeDataMemories(), initializeTracing(), lastRunCycleCount_, TTASimulationController::reset(), and simCon_.

Referenced by KillCommand::execute(), TracedSimulatorFrontend::killSimulation(), and DesignSpaceExplorer::simulate().

Here is the call graph for this function:

◆ lastExecInstruction()

const ExecutableInstruction & SimulatorFrontend::lastExecInstruction ( ) const

Returns a reference to the last executed instruction.

Returns
Last instruction executed.

Definition at line 2194 of file SimulatorFrontend.cc.

2194  {
2195  assert(simCon_ != NULL);
2196  const InstructionMemory& memory = dynamic_cast<SimulationController*>(
2197  simCon_)->instructionMemory();
2199 }

References assert, InstructionMemory::instructionAtConst(), lastExecutedInstruction(), and simCon_.

Referenced by ProximMachineStateWindow::addMoves().

Here is the call graph for this function:

◆ lastExecutedInstruction()

InstructionAddress SimulatorFrontend::lastExecutedInstruction ( int  coreId = -1) const
virtual

Returns the address of the last executed instruction.

Parameters
coreIdLook at the given processor core. If -1, the currently selected core will be used.
Returns
Address of the last executed instruction.

Definition at line 1182 of file SimulatorFrontend.cc.

1182  {
1183  assert(simCon_ != NULL);
1184  return simCon_->lastExecutedInstruction(coreId);
1185 }

References assert, TTASimulationController::lastExecutedInstruction(), and simCon_.

Referenced by ProximMachineStateWindow::addMoves(), ProcedureTransferTracker::handleEvent(), RFAccessTracker::handleEvent(), RuntimeErrorReporter::handleEvent(), and lastExecInstruction().

Here is the call graph for this function:

◆ lastRunCycleCount()

CycleCount SimulatorFrontend::lastRunCycleCount ( ) const

Returns the count of cycles simulated in the last simulation run.

For example, if run was executed and then interrupted by the user or a breakpoint, returns how long the run was in simulation cycles.

Returns
The cycle count.

Definition at line 2276 of file SimulatorFrontend.cc.

2276  {
2277  return lastRunCycleCount_;
2278 }

References lastRunCycleCount_.

Referenced by SimControlLanguageCommand::printSimulationTime().

◆ lastRunTime()

double SimulatorFrontend::lastRunTime ( ) const

Returns the runtime of the last simulation session in seconds.

For example, if run was executed and then interrupted by the user or a breakpoint, returns how long the run was in wall clock time.

Returns
Simulation wall clock time in seconds.

Definition at line 2289 of file SimulatorFrontend.cc.

2289  {
2290  return lastRunTime_;
2291 }

References lastRunTime_.

Referenced by SimControlLanguageCommand::printSimulationTime().

◆ lastTraceDB()

ExecutionTrace * SimulatorFrontend::lastTraceDB ( int  core = -1)

Returns the last produced execution trace database.

The ownership of the TraceDB is transferred to the caller. That is, it should delete it after use.

Returns
The traceDB instance.

Definition at line 2243 of file SimulatorFrontend.cc.

2243  {
2244  if (core == -1)
2245  core = selectedCore();
2246 
2247  ExecutionTrace* last = traceDBs_[core];
2248  traceDBOwned_[core] = false;
2249  return last;
2250 }

References selectedCore(), traceDBOwned_, and traceDBs_.

Referenced by DesignSpaceExplorer::simulate().

Here is the call graph for this function:

◆ loadMachine() [1/2]

void SimulatorFrontend::loadMachine ( const std::string &  fileName)
virtual

Loads a new machine to be simulated from an ADF file.

The loaded machine will be owned by SimulatorFrontend and will be deleted by it when not needed anymore.

Parameters
fileNameThe name of the ADF file to be loaded.
Exceptions
FileNotFoundIf the file cannot be found.
SimulationStillRunningIf an old simulation is still running.
IllegalMachineIf the ADF was erroneus.

Reimplemented in TracedSimulatorFrontend.

Definition at line 534 of file SimulatorFrontend.cc.

534  {
536 
537  if (!FileSystem::fileExists(fileName)) {
538  throw FileNotFound(
539  __FILE__, __LINE__, __func__,
540  (textGen.text(Texts::TXT_FILE_X_NOT_FOUND) % fileName).str());
541  }
542 
543  if (!FileSystem::fileIsReadable(fileName)) {
544  throw IOException(__FILE__, __LINE__, __func__, "File not readable.");
545  }
546 
547  ADFSerializer serializer;
548  serializer.setSourceFile(fileName);
549 
550  const Machine* oldMachine = currentMachine_;
551  try {
552  currentMachine_ = serializer.readMachine();
553  } catch (const Exception& e) {
554  IllegalMachine ime(
555  __FILE__, __LINE__, __func__,
556  textGen.text(Texts::TXT_ILLEGAL_ADF_FILE).str());
557  ime.setCause(e);
558  throw ime;
559  }
561  delete oldMachine;
562  oldMachine = NULL;
563  }
565 
568  delete currentProgram_;
569  currentProgram_ = NULL;
570  }
571  delete simCon_;
572  simCon_ = NULL;
573 
574  // compiled sim does not handle long guard latencies correctly.
575  // remove when fixed.
576  if (isCompiledSimulation() &&
578  currentMachine_->is64bit())) {
579  setCompiledSimulation(false);
580  // TODO: warn about this, when the warning can be ignored
581  // by tests.
582  }
585 }

References __func__, TTAMachine::Machine::controlUnit(), currentMachine_, currentProgram_, SequenceTools::deleteAllItems(), FileSystem::fileExists(), FileSystem::fileIsReadable(), finishSimulation(), TTAMachine::ControlUnit::globalGuardLatency(), initializeMemorySystem(), TTAMachine::Machine::is64bit(), isCompiledSimulation(), machineOwnedByFrontend_, memorySystems_, programOwnedByFrontend_, ADFSerializer::readMachine(), Exception::setCause(), setCompiledSimulation(), XMLSerializer::setSourceFile(), simCon_, Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), Texts::TXT_FILE_X_NOT_FOUND, and Texts::TXT_ILLEGAL_ADF_FILE.

Referenced by MachCommand::execute(), TracedSimulatorFrontend::loadMachine(), loadProcessorConfiguration(), SimpleSimulatorFrontend::SimpleSimulatorFrontend(), DesignSpaceExplorer::simulate(), and tandemSimulate().

Here is the call graph for this function:

◆ loadMachine() [2/2]

void SimulatorFrontend::loadMachine ( const TTAMachine::Machine machine)

Loads a new machine to be simulated.

The loaded machine is not owned by SimulatorFrontend and thus won't be deleted by it when not needed anymore.

Parameters
programThe machine to be loaded.

Definition at line 227 of file SimulatorFrontend.cc.

227  {
228  if (currentMachine_ != NULL && machineOwnedByFrontend_) {
229  delete currentMachine_;
230  currentMachine_ = NULL;
231  }
233  machineOwnedByFrontend_ = false;
234 
237  delete currentProgram_;
238  currentProgram_ = NULL;
239  }
240  delete simCon_;
241  simCon_ = NULL;
242 
243  // compiled sim does not handle long guard latencies nor 64 bits correctly
244  // remove when fixed.
245  if (isCompiledSimulation() &&
247  machine.is64bit())) {
248  setCompiledSimulation(false);
249  // TODO: warn about this, when the warning can be ignored
250  // by tests.
251  }
254 }

References TTAMachine::Machine::controlUnit(), currentMachine_, currentProgram_, SequenceTools::deleteAllItems(), finishSimulation(), TTAMachine::ControlUnit::globalGuardLatency(), initializeMemorySystem(), TTAMachine::Machine::is64bit(), isCompiledSimulation(), machine(), machineOwnedByFrontend_, memorySystems_, programOwnedByFrontend_, setCompiledSimulation(), and simCon_.

Here is the call graph for this function:

◆ loadProcessorConfiguration()

void SimulatorFrontend::loadProcessorConfiguration ( const std::string &  fileName)

Loads a new machine to be simulated from a processor configuration file.

The loaded machine will be owned by SimulatorFrontend and thus be deleted by it when not needed anymore.

Parameters
fileNameThe name of the PCF to be loaded.
Exceptions
FileNotFoundIf the file cannot be found.
SimulationStillRunningIf an old simulation is still running.
IllegalMachineIf the ADF was erroneus.

Definition at line 600 of file SimulatorFrontend.cc.

600  {
602 
603  if (!FileSystem::fileExists(fileName)) {
604  throw FileNotFound(
605  __FILE__, __LINE__, __func__,
606  textGen.text(Texts::TXT_FILE_NOT_FOUND).str());
607  }
608 
609  if (!FileSystem::fileIsReadable(fileName)) {
610  throw IOException(__FILE__, __LINE__, __func__, "File not readable.");
611  }
612 
613  std::ifstream inputFile(fileName.c_str());
614  ProcessorConfigurationFile pcf(inputFile);
615  pcf.setPCFDirectory(FileSystem::directoryOfPath(fileName));
616 
617  std::string adfName = "";
618  try {
619  adfName = pcf.architectureName();
620  } catch (const KeyNotFound&) {
621  throw FileNotFound(
622  __FILE__, __LINE__, __func__,
623  textGen.text(Texts::TXT_NO_ADF_DEFINED_IN_PCF).str());
624  }
625 
626  loadMachine(adfName);
627 }

References __func__, ProcessorConfigurationFile::architectureName(), FileSystem::directoryOfPath(), FileSystem::fileExists(), FileSystem::fileIsReadable(), loadMachine(), ProcessorConfigurationFile::setPCFDirectory(), Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), Texts::TXT_FILE_NOT_FOUND, and Texts::TXT_NO_ADF_DEFINED_IN_PCF.

Referenced by ConfCommand::execute().

Here is the call graph for this function:

◆ loadProgram() [1/2]

void SimulatorFrontend::loadProgram ( const std::string &  fileName)
virtual

Loads a new program to be simulated from a TPEF file.

The loaded program will be owned by SimulatorFrontend and thus be deleted by it when not needed anymore.

Parameters
fileNameThe name of the TPEF file to be loaded.
Exceptions
FileNotFoundIf the file cannot be found.
SimulationStillRunningIf an old simulation is still running.
IllegalProgramIf the TPEF was erroneus or the program invalid.
ExceptionAny exception thrown while building the simulation models are passed on.
Todo:

Implement after Program builder is done.

Throw when machine is not loaded.

Implement checking for already running simulation.

Reimplemented in TracedSimulatorFrontend.

Definition at line 299 of file SimulatorFrontend.cc.

299  {
300 
301  if (currentMachine_ == NULL)
302  throw Exception(
303  __FILE__, __LINE__, __func__,
304  "Cannot load a program without loading a machine first.");
305 
307 
308  if (!FileSystem::fileExists(fileName)) {
309  throw FileNotFound(
310  __FILE__, __LINE__, __func__,
311  textGen.text(Texts::TXT_FILE_NOT_FOUND).str());
312  }
313 
314  if (!FileSystem::fileIsReadable(fileName)) {
315  throw IOException(__FILE__, __LINE__, __func__, "File not readable.");
316  }
317 
318  BinaryStream binaryStream(fileName);
319 
320  const Program* oldProgram = currentProgram_;
321 
322  try {
323  // read to TPEF Handler Module
324  tpef_ = BinaryReader::readBinary(binaryStream);
325 
326  assert(tpef_ != NULL);
327  assert(currentMachine_ != NULL);
328 
329  // convert the loaded TPEF to POM
331  TTAProgram::Program* program = factory.build();
332  program->finalize();
334  } catch (const Exception& e) {
335  delete tpef_;
336  tpef_ = NULL;
337  delete simCon_;
338  simCon_ = NULL;
339  std::string errorMsg = textGen.text(
341 
342  if (e.errorMessage() != "")
343  errorMsg += " " + e.errorMessage();
344 
345  IllegalProgram illegp(__FILE__, __LINE__, __func__, errorMsg);
346  illegp.setCause(e);
347  throw illegp;
348  }
349 
350  // Validate the program against the current machine using POMValidator.
351  // TODO: this should be refactored -- the loadProgram(Program) is not
352  // checking these?
353  POMValidator validator(*currentProgram_);
354  std::set<POMValidator::ErrorCode> checks;
355  checks.insert(POMValidator::CONNECTION_MISSING);
358 
359  if (isCompiledSimulation()) {
361  }
362 
363 #if (!defined(HAVE_CXX11) && !defined(HAVE_CXX0X))
364  std::auto_ptr<POMValidatorResults> results(validator.validate(checks));
365 #else
366  std::unique_ptr<POMValidatorResults> results(validator.validate(checks));
367 #endif
368 
369  if (results->errorCount() > 0) {
370  std::string errorMsg = textGen.text(
372 
373  for (int i = 0; i < results->errorCount(); i++) {
374  errorMsg += "\n" + results->error(i).second;
375  }
376 
377  if (isCompiledSimulation()) {
378  // Attempt without compiled simulator
379  setCompiledSimulation(false);
381  results.reset(validator.validate(checks));
382  }
383 
384  if (results->errorCount() > 0) {
385  delete tpef_;
386  tpef_ = NULL;
387  delete simCon_;
388  simCon_ = NULL;
389 
390  for (int i = 0; i < results->errorCount(); i++) {
391  errorMsg += "\n" + results->error(i).second;
392  }
393 
394  throw IllegalProgram(__FILE__, __LINE__, __func__, errorMsg);
395  } else {
396  outputStream()
397  << errorMsg << std::endl
398  << "Warning! Reverting to interpretive simulation engine."
399  << std::endl;
400  }
401  }
402 
404  delete oldProgram;
405  oldProgram = NULL;
406  }
407 
408  delete disassembler_;
409  disassembler_ = NULL;
410 
412 
415 
416  // Dump simulation traces in the same directory as loaded program file
417  // or user-defined directory
418  std::string traceDir = Environment::simTraceDirPath();
419  if (traceDir == "") {
420  programFileName_ = fileName;
421  } else {
424  FileSystem::fileOfPath(fileName);
425  }
426 
427  // tracing can't be enabled before loading program so try to initialize
428  // the tracing after program is loaded
430 }

References __func__, assert, TTAProgram::TPEFProgramFactory::build(), POMValidator::COMPILED_SIMULATION_NOT_POSSIBLE, POMValidator::CONNECTION_MISSING, currentMachine_, currentProgram_, FileSystem::DIRECTORY_SEPARATOR, disassembler_, POMValidatorResults::error(), POMValidatorResults::errorCount(), Exception::errorMessage(), FileSystem::fileExists(), FileSystem::fileIsReadable(), FileSystem::fileOfPath(), TTAProgram::Program::finalize(), initializeDataMemories(), initializeSimulation(), initializeTracing(), isCompiledSimulation(), POMValidator::LONG_IMMEDIATE_NOT_SUPPORTED, outputStream(), program(), programFileName_, programOwnedByFrontend_, Exception::setCause(), setCompiledSimulation(), simCon_, Environment::simTraceDirPath(), POMValidator::SIMULATION_NOT_POSSIBLE, Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), tpef_, Texts::TXT_FILE_NOT_FOUND, Texts::TXT_UNABLE_TO_LOAD_PROGRAM, and POMValidator::validate().

Referenced by ProgCommand::execute(), TracedSimulatorFrontend::loadProgram(), SimpleSimulatorFrontend::loadProgram(), SimpleSimulatorFrontend::SimpleSimulatorFrontend(), DesignSpaceExplorer::simulate(), and tandemSimulate().

Here is the call graph for this function:

◆ loadProgram() [2/2]

void SimulatorFrontend::loadProgram ( const TTAProgram::Program program)

Loads a new program to be simulated.

The loaded program is not owned by SimulatorFrontend and thus won't be deleted by it when not needed anymore. Simulation is initialized using the previously loaded machine. This function assumes that machine is loaded before calling it. Program is aborted otherwise.

Parameters
programThe program to be loaded.
Exceptions
IOExceptionIf tracing is enabled and could not be initialized.
ExceptionAny exception thrown while building the simulation models are passed on.
Todo:

Throw when machine is not loaded.

Implement checking for already running simulation.

Definition at line 198 of file SimulatorFrontend.cc.

198  {
199 
200  if (currentMachine_ == NULL)
201  throw Exception(
202  __FILE__, __LINE__, __func__,
203  "Cannot load a program without loading a machine first.");
204 
206  delete currentProgram_;
207  currentProgram_ = NULL;
208  }
209 
211  programOwnedByFrontend_ = false;
212 
216 }

References __func__, currentMachine_, currentProgram_, initializeDataMemories(), initializeSimulation(), initializeTracing(), program(), and programOwnedByFrontend_.

Here is the call graph for this function:

◆ machine()

const Machine & SimulatorFrontend::machine ( ) const

◆ machineState()

MachineState & SimulatorFrontend::machineState ( int  core = -1)

Returns a reference to the state model of the currently loaded machine.

Note
: This should be called only for interpretive simulation which uses the SimulationController engine. Asserts if another engine (compiled) is used.
Returns
State model of the simulated machine.

Definition at line 2138 of file SimulatorFrontend.cc.

2138  {
2139  SimulationController* simCon =
2140  dynamic_cast<SimulationController*>(simCon_);
2141  assert(simCon != NULL && "Wrong TTASimulationController implementation.");
2142  return simCon->machineState(core);
2143 }

References assert, SimulationController::machineState(), and simCon_.

Referenced by ProximBusDetailsCmd::Do(), ProximFUDetailsCmd::Do(), ProximFUPortDetailsCmd::Do(), ProximRFDetailsCmd::Do(), ProximIUDetailsCmd::Do(), InfoSegmentsCommand::execute(), findBooleanRegister(), findPort(), findRegister(), BusTracker::handleEvent(), ProximRegisterWindow::loadImmediateUnit(), ProximRegisterWindow::loadRegisterFile(), SimpleSimulatorFrontend::setOperationSimulator(), and ProximPortWindow::update().

Here is the call graph for this function:

◆ memoryAccessTracking()

bool SimulatorFrontend::memoryAccessTracking ( ) const

Returns true if memory access tracking is enabled.

Returns
Returns current memory access tracking setting.

Definition at line 2057 of file SimulatorFrontend.cc.

2057  {
2058  return memoryAccessTracking_;
2059 }

References memoryAccessTracking_.

◆ memorySystem()

MemorySystem & SimulatorFrontend::memorySystem ( int  coreId = -1)

◆ next()

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

Advance simulation by a given amout of steps and skip procedure calls.

Parameters
countThe number of steps the simulation is advanced.
Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.
Todo:
Throw exception if simulation is not initialized.

Reimplemented in TracedSimulatorFrontend.

Definition at line 1052 of file SimulatorFrontend.cc.

1052  {
1053  assert(simCon_ != NULL);
1054 
1055  startTimer();
1056  boost::thread timeout(boost::bind(timeoutThread,
1057  simulationTimeout_, this));
1058  simCon_->next(count);
1059  stopTimer();
1060 
1061  // invalidate utilization statistics (they are not fresh anymore)
1063 }

References assert, SequenceTools::deleteAllItems(), TTASimulationController::next(), simCon_, simulationTimeout_, startTimer(), stopTimer(), timeoutThread, and utilizationStats_.

Referenced by NextiCommand::execute(), and TracedSimulatorFrontend::next().

Here is the call graph for this function:

◆ nextInstructionPrinting()

bool SimulatorFrontend::nextInstructionPrinting ( ) const

Returns true if the next simulated instruction will be printed to the simulator console at simulation stop.

Returns
True if the instruction should be printed.

Definition at line 2080 of file SimulatorFrontend.cc.

2080  {
2081  return printNextInstruction_;
2082 }

References printNextInstruction_.

Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ outputStream()

std::ostream & SimulatorFrontend::outputStream ( )

Returns the output stream

Returns
the output stream

Definition at line 1987 of file SimulatorFrontend.cc.

1987  {
1988  assert(outputStream_ != 0);
1989  return *outputStream_;
1990 }

References assert, and outputStream_.

Referenced by loadProgram().

◆ prepareToStop()

void SimulatorFrontend::prepareToStop ( StopReason  reason)

Signals the simulator engine to stop simulation after the current simulated clock cycle.

Does nothing if simulation is not initialized or simulation is not running.

Parameters
reasonThe reason for stopping.

Definition at line 1331 of file SimulatorFrontend.cc.

1331  {
1332  if (simCon_ == NULL || !isSimulationRunning()) {
1333  return;
1334  }
1335  simCon_->prepareToStop(reason);
1336 }

References isSimulationRunning(), TTASimulationController::prepareToStop(), and simCon_.

Referenced by SigINTHandler::execute(), SigFPEHandler::execute(), SigSegvHandler::execute(), ProximSimulationThread::finishSimulation(), ProximRuntimeErrorHandler::handleEvent(), RuntimeErrorReporter::handleEvent(), ProximSimulationThread::killSimulation(), ProximStopDialog::onClose(), ProximStopDialog::onStop(), ProximSimulationThread::requestStop(), SimpleSimulatorFrontend::stop(), and timeoutThread().

Here is the call graph for this function:

◆ procedureTransferTracing()

bool SimulatorFrontend::procedureTransferTracing ( ) const

Returns true in case procedure transfer tracing is enabled.

Returns
True in case procedure transfer tracing is enabled.

Definition at line 1827 of file SimulatorFrontend.cc.

1827  {
1829 }

References procedureTransferTracing_.

Referenced by SimulatorSettingsDialog::onOK(), CompiledSimController::reset(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ profileDataSaving()

bool SimulatorFrontend::profileDataSaving ( ) const

Returns true in case profile data saving is enabled.

Returns
True in case profile data saving is enabled.

Definition at line 1837 of file SimulatorFrontend.cc.

1837  {
1838  return saveProfileData_;
1839 }

References saveProfileData_.

Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ program()

const Program & SimulatorFrontend::program ( ) const

◆ programCounter()

InstructionAddress SimulatorFrontend::programCounter ( ) const

Returns the program counter value.

Returns
Program counter value.
Todo:
Throw exception if simulation is not initialized

Definition at line 1169 of file SimulatorFrontend.cc.

1169  {
1170  assert(simCon_ != NULL);
1171  return simCon_->programCounter();
1172 }

References assert, TTASimulationController::programCounter(), and simCon_.

Referenced by compareState(), currentProcedure(), InfoProgramCommand::execute(), RuntimeErrorReporter::handleEvent(), Breakpoint::isTriggered(), SimControlLanguageCommand::parseInstructionAddressExpression(), and programLocationDescription().

Here is the call graph for this function:

◆ programErrorReport()

std::string SimulatorFrontend::programErrorReport ( RuntimeErrorSeverity  severity,
std::size_t  index 
)

Returns a program error report with given severity and index.

Parameters
severitySeverity.
indexIndex.
Returns
The error report text.

Definition at line 2321 of file SimulatorFrontend.cc.

2322  {
2323 
2324  size_t count = 0;
2325  for (ProgramErrorDescriptionList::iterator i =
2326  programErrorReports_.begin(); i != programErrorReports_.end();
2327  ++i) {
2328  if ((*i).first == severity) {
2329  if (count == index)
2330  return (*i).second;
2331  ++count;
2332  }
2333  }
2334  return "";
2335 }

References programErrorReports_.

Referenced by ProximRuntimeErrorHandler::handleEvent(), and RuntimeErrorReporter::handleEvent().

◆ programErrorReportCount()

std::size_t SimulatorFrontend::programErrorReportCount ( RuntimeErrorSeverity  severity)

Returns the count of program error reports with given severity.

Parameters
severityThe error report severity interested in.
Returns
The count of error reports.

Definition at line 2344 of file SimulatorFrontend.cc.

2345  {
2346  size_t count = 0;
2347  for (ProgramErrorDescriptionList::iterator i =
2348  programErrorReports_.begin(); i != programErrorReports_.end();
2349  ++i) {
2350  if ((*i).first == severity)
2351  ++count;
2352  }
2353  return count;
2354 }

References programErrorReports_.

Referenced by ProximRuntimeErrorHandler::handleEvent(), and RuntimeErrorReporter::handleEvent().

◆ programLocationDescription()

std::string SimulatorFrontend::programLocationDescription ( ) const

Returns a string describing the current location of simulation in the simulated program.

If simulation has ended, returns an empty string.

Returns
A description as defined in Simulator specs.

Definition at line 1108 of file SimulatorFrontend.cc.

1108  {
1109 
1110  if (hasSimulationEnded()) {
1111  return "";
1112  }
1113 
1114  InstructionAddress instructionAddress = programCounter();
1115 
1116  const InstructionAddress programLastAddress =
1118 
1119  if (instructionAddress >= programLastAddress) {
1120  return "";
1121  }
1122 
1123  const Instruction& theInstruction =
1124  currentProgram_->instructionAt(instructionAddress);
1125  const Procedure& currentProc =
1126  dynamic_cast<const Procedure&>(theInstruction.parent());
1127 
1128  InstructionAddress distanceFromStart =
1129  instructionAddress - currentProc.startAddress().location();
1130 
1132 
1133  std::stringstream tempStream;
1134 
1135  tempStream << std::setw(7) << std::right << instructionAddress << " ";
1136  tempStream
1137  << std::setw(30) << std::right <<
1138  std::string("<") + currentProc.name() + "+" +
1139  Conversion::toString(distanceFromStart) + ">" << ": "
1140  << disassembler_->disassembleInstruction(theInstruction);
1141 
1142  return tempStream.str();
1143 }

References currentProgram_, POMDisassembler::disassembleInstruction(), disassembler_, TTAProgram::CodeSnippet::endAddress(), hasSimulationEnded(), initializeDisassembler(), TTAProgram::Program::instructionAt(), TTAProgram::Program::lastProcedure(), TTAProgram::Address::location(), TTAProgram::Procedure::name(), TTAProgram::Instruction::parent(), programCounter(), TTAProgram::CodeSnippet::startAddress(), and Conversion::toString().

Referenced by SimControlLanguageCommand::printNextInstruction().

Here is the call graph for this function:

◆ registerFileValue()

std::string SimulatorFrontend::registerFileValue ( const std::string &  rfName,
int  registerIndex = -1 
)
virtual

Returns a string containing the value(s) of the register file

Parameters
rfNamename of the register file to search for
registerIndexindex of the register. if -1, all registers are listed
Returns
A string containing the value(s) of the register file
Exceptions
InstanceNotFoundIf the register cannot be found.

Definition at line 738 of file SimulatorFrontend.cc.

739  {
740 
741  return simCon_->registerFileValue(rfName, registerIndex);
742 }

References TTASimulationController::registerFileValue(), and simCon_.

Referenced by compareState().

Here is the call graph for this function:

◆ reportSimulatedProgramError()

void SimulatorFrontend::reportSimulatedProgramError ( RuntimeErrorSeverity  severity,
const std::string &  description 
)

This method is used to report a runtime error detected in the simulated program.

An SE_RUNTIME_ERROR event is announced after storing the report.

Parameters
eventHandlerSimulation event handler for the error
severitySeverity classification of the runtime error.
descriptionTextual description of the error.

Definition at line 2304 of file SimulatorFrontend.cc.

2305  {
2306  ProgramErrorDescription report;
2307  report.first = severity;
2308  report.second = description;
2309  programErrorReports_.push_back(report);
2311 }

References eventHandler(), Informer::handleEvent(), programErrorReports_, and SimulationEventHandler::SE_RUNTIME_ERROR.

Referenced by SigFPEHandler::execute(), SigSegvHandler::execute(), OTASimulationController::simulateCycle(), and SimulationController::simulateCycle().

Here is the call graph for this function:

◆ rfAccessTracing()

bool SimulatorFrontend::rfAccessTracing ( ) const

Returns true in case register file access tracing is enabled.

Returns
True in case RF access tracing is enabled.

Definition at line 1818 of file SimulatorFrontend.cc.

1818  {
1819  return rfAccessTracing_;
1820 }

References rfAccessTracing_.

Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ rfAccessTracker()

const RFAccessTracker & SimulatorFrontend::rfAccessTracker ( ) const

Returns the register file access tracker.

Returns
The register file access tracker.
Exceptions
InstanceNotFoundIf RF access tracking is not enabled.

Definition at line 1869 of file SimulatorFrontend.cc.

1869  {
1870  if (rfAccessTrackers_.size() == 0) {
1871  throw InstanceNotFound(
1872  __FILE__, __LINE__, __func__, "RF access tracing is disabled.");
1873  }
1874  return *rfAccessTrackers_.at(0);
1875 }

References __func__, and rfAccessTrackers_.

Referenced by InfoProcCommand::execute(), and finishSimulation().

◆ run()

void SimulatorFrontend::run ( )
virtual

Run simulation until it's stopped for some reason.

Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.
Todo:
Throw exception if simulation is not initialized.

Reimplemented in TracedSimulatorFrontend.

Definition at line 997 of file SimulatorFrontend.cc.

997  {
998  startTimer();
999  boost::thread timeout(
1000  boost::bind(timeoutThread, simulationTimeout_, this));
1001  simCon_->run();
1002  stopTimer();
1004 }

References SequenceTools::deleteAllItems(), TTASimulationController::run(), simCon_, simulationTimeout_, startTimer(), stopTimer(), timeoutThread, and utilizationStats_.

Referenced by ResumeCommand::execute(), RunCommand::execute(), TracedSimulatorFrontend::run(), SimpleSimulatorFrontend::run(), and DesignSpaceExplorer::simulate().

Here is the call graph for this function:

◆ runUntil()

void SimulatorFrontend::runUntil ( UIntWord  address)
virtual

Run simulation until given address.

Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.
Todo:
Throw exception if simulation is not initialized.

Reimplemented in TracedSimulatorFrontend.

Definition at line 1014 of file SimulatorFrontend.cc.

1014  {
1015  startTimer();
1016  boost::thread timeout(boost::bind(timeoutThread,
1017  simulationTimeout_, this));
1018  simCon_->runUntil(address);
1019  stopTimer();
1020  // invalidate utilization statistics (they are not fresh anymore)
1022 }

References SequenceTools::deleteAllItems(), TTASimulationController::runUntil(), simCon_, simulationTimeout_, startTimer(), stopTimer(), timeoutThread, and utilizationStats_.

Referenced by UntilCommand::execute(), and TracedSimulatorFrontend::runUntil().

Here is the call graph for this function:

◆ selectCore()

void SimulatorFrontend::selectCore ( int  core)
inline

Definition at line 260 of file SimulatorFrontend.hh.

260  {
261  if (core != 0) {
262  abortWithError("WiP.");
263  }
264  }

References abortWithError.

Referenced by SimulationController::simulateCycle(), and SimulationController::SimulationController().

◆ selectedCore()

int SimulatorFrontend::selectedCore ( ) const
inline

◆ setBusTracing()

void SimulatorFrontend::setBusTracing ( bool  value)

Sets the bus tracing on or off.

Parameters
valueIs bus tracing enabled or not.

Definition at line 1910 of file SimulatorFrontend.cc.

1910  {
1911  busTracing_ = value;
1912 }

References busTracing_.

Referenced by SetBusTrace::execute().

◆ setCallHistoryLength()

void SimulatorFrontend::setCallHistoryLength ( std::size_t  length)

Sets the length of the call history stored in memory to be used for the simulator's debugging commands that need it.

Setting this to 0 disables the call history tracking thus speeding up simulation. It's disabled by default.

Definition at line 2372 of file SimulatorFrontend.cc.

2372  {
2373  callHistoryLength_ = length;
2375 }

References callHistoryLength_, and setupCallHistoryTracking().

Referenced by SetCallHistoryLength::execute().

Here is the call graph for this function:

◆ setCompiledSimulation()

void SimulatorFrontend::setCompiledSimulation ( bool  value)

Sets compiled simulation on or off

Parameters
valueIs compiled simulation enabled or not.

Definition at line 1883 of file SimulatorFrontend.cc.

1883  {
1884  // This legacy function assumes we use a simulator engine, not a
1885  // remote target.
1886  if (currentBackend_ == SIM_REMOTE) return;
1887  if (currentBackend_ == SIM_CUSTOM) return;
1888  if (value)
1890  else
1892 }

References currentBackend_, SIM_COMPILED, SIM_CUSTOM, SIM_NORMAL, and SIM_REMOTE.

Referenced by loadMachine(), loadProgram(), and SimulatorFrontend().

◆ setCompiledSimulationLeaveDirty()

void SimulatorFrontend::setCompiledSimulationLeaveDirty ( bool  dirty)
inline

Definition at line 157 of file SimulatorFrontend.hh.

157  {
158  leaveCompiledDirty_ = dirty;
159  }

References leaveCompiledDirty_.

Referenced by tandemSimulate().

◆ setControllerForMemories()

void SimulatorFrontend::setControllerForMemories ( RemoteController con)
protected

Definition at line 634 of file SimulatorFrontend.cc.

634  {
635 
636  int num_mems = memorySystem(0).memoryCount();
637  for (int i = 0; i < num_mems; i++) {
639  boost::shared_ptr<RemoteMemory> rmem =
640  boost::static_pointer_cast<RemoteMemory>(memptr);
641  assert(rmem != NULL && "not a RemoteMemory!");
642  rmem->setController(con);
643  }
644 }

References assert, MemorySystem::memory(), MemorySystem::memoryCount(), and memorySystem().

Referenced by initializeSimulation().

Here is the call graph for this function:

◆ setDetailedSimulation()

void SimulatorFrontend::setDetailedSimulation ( bool  val)
inline

Definition at line 238 of file SimulatorFrontend.hh.

239  { detailedSimulation_ = val; }

References detailedSimulation_.

Referenced by SimpleSimulatorFrontend::SimpleSimulatorFrontend().

◆ setExecutionTracing()

void SimulatorFrontend::setExecutionTracing ( bool  value)

Sets the execution tracing on or off.

Parameters
valueIs execution tracing enabled or not.

Definition at line 1900 of file SimulatorFrontend.cc.

1900  {
1901  executionTracing_ = value;
1902 }

References executionTracing_.

Referenced by SetExecutionTrace::execute(), and DesignSpaceExplorer::simulate().

◆ setFUResourceConflictDetection()

void SimulatorFrontend::setFUResourceConflictDetection ( bool  value)

Sets the FU resource conflict detection on or off.

NOTE: this affects future simulations only. That is, if a simulation is already initialized (program loaded), the old setting is used for that simulation.

Parameters
valueShould the resource conflict detection be used.

Definition at line 2022 of file SimulatorFrontend.cc.

2022  {
2024 }

References fuResourceConflictDetection_.

Referenced by CompiledSimSetFUConflictDetection::execute(), SetFUConflictDetection::execute(), and SimulatorFrontend().

◆ setMemoryAccessTracking()

void SimulatorFrontend::setMemoryAccessTracking ( bool  value)

Sets the memory access tracking on or off.

NOTE: this affects future simulations only. That is, if a simulation is already initialized (program loaded), the old setting is used for that simulation.

Parameters
valueShould the memory access tracking be used.

Definition at line 2047 of file SimulatorFrontend.cc.

2047  {
2048  memoryAccessTracking_ = value;
2049 }

References memoryAccessTracking_.

Referenced by SetMemoryAccessTracking::execute().

◆ setNextInstructionPrinting()

void SimulatorFrontend::setNextInstructionPrinting ( bool  value)

Sets the printing of the next simulated instruction to the console.

The instruction is printed when stopping simulation.

Parameters
valueTrue if the instruction should be printed.

Definition at line 2069 of file SimulatorFrontend.cc.

2069  {
2070  printNextInstruction_ = value;
2071 }

References printNextInstruction_.

Referenced by SetNextInstructionPrinting::execute().

◆ setOutputStream()

void SimulatorFrontend::setOutputStream ( std::ostream &  stream)

Sets the default output stream

Parameters
streamthe output stream

Definition at line 1998 of file SimulatorFrontend.cc.

1998  {
1999  outputStream_ = &stream;
2000 }

References outputStream_.

◆ setProcedureTransferTracing()

void SimulatorFrontend::setProcedureTransferTracing ( bool  value)

Sets the procedure transfer tracing on or off.

Parameters
valueIs procedure transfer tracing on or off.

Definition at line 1930 of file SimulatorFrontend.cc.

1930  {
1931  procedureTransferTracing_ = value;
1932 }

References procedureTransferTracing_.

Referenced by SetProcedureTransferTracing::execute().

◆ setProfileDataSaving()

void SimulatorFrontend::setProfileDataSaving ( bool  value)

Sets the profile saving on or off.

Parameters
valueIs profile saving on or off.

Definition at line 1940 of file SimulatorFrontend.cc.

1940  {
1941  saveProfileData_ = value;
1942 }

References saveProfileData_.

Referenced by SetProfileSaving::execute().

◆ setRFAccessTracing()

void SimulatorFrontend::setRFAccessTracing ( bool  value)

Sets the register file access tracing on or off.

Parameters
valueIs register file access tracing enabled or not.

Definition at line 1920 of file SimulatorFrontend.cc.

1920  {
1921  rfAccessTracing_ = value;
1922 }

References rfAccessTracing_.

Referenced by SetRFTracking::execute(), and DesignSpaceExplorer::simulate().

◆ setSimulationTimeStatistics()

void SimulatorFrontend::setSimulationTimeStatistics ( bool  value)

Sets the printing of simulation time statistics

Parameters
valueTrue if the statistics should be printed out

Definition at line 2088 of file SimulatorFrontend.cc.

2088  {
2090 }

References printSimulationTimeStatistics_.

Referenced by SetSimulationTimeStatistics::execute().

◆ setStaticCompilation()

void SimulatorFrontend::setStaticCompilation ( bool  value)

Sets the compiled simulator to use static or dynamic compilation.

Has no effect when running interpretive simulation.

Parameters
valuenew value to be set

Definition at line 1977 of file SimulatorFrontend.cc.

1977  {
1978  staticCompilation_ = value;
1979 }

References staticCompilation_.

Referenced by SetStaticCompilation::execute(), and tandemSimulate().

◆ setTimeout()

void SimulatorFrontend::setTimeout ( unsigned int  value)

Sets the simulation timeout in seconds. Use zero for no timeout.

Parameters
valueSimulation timeout in seconds.

Definition at line 1965 of file SimulatorFrontend.cc.

1965  {
1966  simulationTimeout_ = value;
1967 }

References simulationTimeout_.

Referenced by SetSimulationTimeout::execute(), and DesignSpaceExplorer::simulate().

◆ setupCallHistoryTracking()

void SimulatorFrontend::setupCallHistoryTracking ( )
protected

Definition at line 2378 of file SimulatorFrontend.cc.

2378  {
2379  if (callHistoryLength_ == 0 || !isMachineLoaded()) {
2381  return;
2382  } else {
2383  for (int core = 0; core < 1;
2384  ++core) {
2385  CallPathTracker* tracker =
2386  new CallPathTracker(*this, core, callHistoryLength_);
2387  callPathTrackers_.push_back(tracker);
2388  }
2389  }
2390 }

References callHistoryLength_, callPathTrackers_, SequenceTools::deleteAllItems(), and isMachineLoaded().

Referenced by initializeTracing(), and setCallHistoryLength().

Here is the call graph for this function:

◆ setUtilizationDataSaving()

void SimulatorFrontend::setUtilizationDataSaving ( bool  value)

Sets the utilization data saving on or off.

Parameters
valueIs utilization data saving on or off.

Definition at line 2008 of file SimulatorFrontend.cc.

2008  {
2009  saveUtilizationData_ = value;
2010 }

References saveUtilizationData_.

Referenced by SetUtilizationSaving::execute(), and DesignSpaceExplorer::simulate().

◆ setZeroFillMemoriesOnReset()

void SimulatorFrontend::setZeroFillMemoriesOnReset ( bool  val)
inline

◆ simulationTimeStatistics()

bool SimulatorFrontend::simulationTimeStatistics ( ) const

Returns true if the time statistics are to be printed after a command

Returns
True, if the time statistics are to be printed after a command

Definition at line 2097 of file SimulatorFrontend.cc.

2097  {
2099 }

References printSimulationTimeStatistics_.

Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ startTimer()

void SimulatorFrontend::startTimer ( )
protected

Starts the wall-clock timer.

Definition at line 928 of file SimulatorFrontend.cc.

928  {
930  startTime_ = time(NULL);
931 }

References cycleCount(), startCycleCount_, and startTime_.

Referenced by next(), run(), and runUntil().

Here is the call graph for this function:

◆ state()

StateData & SimulatorFrontend::state ( std::string  searchString)

Tries to locate a readable machine state part using a search string.

See stateValue() for further comment.

Parameters
searchStringThe string to use in search, e.g., (alu.p3 or add.3).
Returns
The StateData object.
Exceptions
InstanceNotFoundIn case state couldn't be found using the search string.
Todo:
Parallel fu port access (syntax?)

Definition at line 894 of file SimulatorFrontend.cc.

894  {
895  if (currentMachine_ == NULL)
896  throw InstanceNotFound(
897  __FILE__, __LINE__, __func__, "State not found.");
898 
899  boost::smatch parsed;
900 
901  if (StringTools::ciEqual(searchString, "bool") ||
902  StringTools::ciEqual(searchString, "boolean")) {
903  return findBooleanRegister();
904  } else
905  if (StringTools::ciEqual(searchString, "ra") ||
906  StringTools::ciEqual(searchString, "return-address")) {
907  return findPort(
910  } else
911  if (regex_match(
912  searchString, parsed,
914  /// @todo Parallel fu port access (syntax?)
915  return findPort(parsed[1], parsed[2]);
916  }
917 
918  throw InstanceNotFound(
919  __FILE__, __LINE__, __func__,
920  std::string("No state found with the search string '") +
921  std::string(searchString) + "'.");
922 }

References __func__, StringTools::ciEqual(), TTAMachine::Machine::controlUnit(), currentMachine_, findBooleanRegister(), findPort(), SimulatorToolbox::fuPortRegex(), TTAMachine::Port::name(), TTAMachine::Component::name(), and TTAMachine::ControlUnit::returnAddressPort().

Referenced by InfoRegistersCommand::execute(), and stateValue().

Here is the call graph for this function:

◆ stateValue()

const SimValue & SimulatorFrontend::stateValue ( std::string  searchString)

Tries to locate a readable machine state part using a search string.

For a syntax of valid search strings, consult the TCE TTA assembler syntax description. All valid sources and destinations except immediate sources are valid search strings.

Parameters
searchStringThe string to use in search, e.g., (alu.p3).
Returns
Current value of the state (read-only).
Exceptions
InstanceNotFoundIn case state couldn't be found using the search string.

Definition at line 878 of file SimulatorFrontend.cc.

878  {
879  return state(searchString).value();
880 }

References state(), and ReadableState::value().

Here is the call graph for this function:

◆ staticCompilation()

bool SimulatorFrontend::staticCompilation ( ) const

Returns true if the compiled simulation uses static compilation

Returns
true if the compiled simulation uses static compilation

Definition at line 1857 of file SimulatorFrontend.cc.

1857  {
1858  return staticCompilation_;
1859 }

References staticCompilation_.

Referenced by CompiledSimController::reset().

◆ step()

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

Advance simulation by a given amout of cycles.

Note
Does not create a timeout thread. Does not make sense here as the step() always finishes.
Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.
Todo:
Throw exception if simulation is not initialized.

Reimplemented in TracedSimulatorFrontend.

Definition at line 1034 of file SimulatorFrontend.cc.

1034  {
1035  assert(simCon_ != NULL);
1036 
1037  simCon_->step(count);
1038  // invalidate utilization statistics (they are not fresh anymore)
1040 }

References assert, SequenceTools::deleteAllItems(), simCon_, TTASimulationController::step(), and utilizationStats_.

Referenced by StepiCommand::execute(), TracedSimulatorFrontend::step(), SimpleSimulatorFrontend::step(), and tandemSimulate().

Here is the call graph for this function:

◆ stoppedByUser()

bool SimulatorFrontend::stoppedByUser ( ) const

Returns true if simulation is stopped because of user set reason, i.e., breakpoint, watchpoint, memory write watchpoint, explicit (ctrl-c) stop, etc.

Also returns true if a runtime error was the reason for stopping, to avoid infinite loops.

Parameters
trueIf simulation stopped because of user set stop point.

Definition at line 1394 of file SimulatorFrontend.cc.

1394  {
1395 
1396  if (simCon_ == NULL) {
1397  return false;
1398  }
1399 
1400  return
1403 }

References hasStopReason(), simCon_, SRE_BREAKPOINT, SRE_RUNTIME_ERROR, and SRE_USER_REQUESTED.

Here is the call graph for this function:

◆ stopPointManager()

StopPointManager & SimulatorFrontend::stopPointManager ( )

◆ stopReason()

StopReason SimulatorFrontend::stopReason ( unsigned int  index) const

Returns the stop reason with the given index.

Parameters
indexThe wanted index.
Returns
The stop reason at the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Definition at line 1356 of file SimulatorFrontend.cc.

1356  {
1357  assert(simCon_ != NULL);
1358  return simCon_->stopReason(index);
1359 }

References assert, simCon_, and TTASimulationController::stopReason().

Referenced by SimpleSimulatorFrontend::hadRuntimeError(), hasStopReason(), SimControlLanguageCommand::printStopReasons(), and tandemSimulate().

Here is the call graph for this function:

◆ stopReasonCount()

unsigned int SimulatorFrontend::stopReasonCount ( ) const

Returns the count of stop reasons.

Returns
The count of stop reasons.

Definition at line 1344 of file SimulatorFrontend.cc.

1344  {
1345  return (simCon_ != NULL && simCon_->stopReasonCount());
1346 }

References simCon_, and TTASimulationController::stopReasonCount().

Referenced by SimpleSimulatorFrontend::hadRuntimeError(), hasStopReason(), SimControlLanguageCommand::printStopReasons(), and tandemSimulate().

Here is the call graph for this function:

◆ stopTimer()

void SimulatorFrontend::stopTimer ( )
protected

Saves the value of the wall-clock timer initialized with startTimer() to lastRunTime_ and the count of simulated cycles after startTimer() to lastRunCycleCount_.

Definition at line 938 of file SimulatorFrontend.cc.

938  {
939  std::time_t now = time(NULL);
940  lastRunTime_ = now - startTime_;
941  CycleCount cycles = cycleCount();
943 }

References cycleCount(), lastRunCycleCount_, lastRunTime_, startCycleCount_, and startTime_.

Referenced by next(), run(), and runUntil().

Here is the call graph for this function:

◆ utilizationDataSaving()

bool SimulatorFrontend::utilizationDataSaving ( ) const

Returns true in case utilization data saving is enabled.

Returns
True in case utilization data saving is enabled.

Definition at line 1847 of file SimulatorFrontend.cc.

1847  {
1848  return saveUtilizationData_;
1849 }

References saveUtilizationData_.

Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().

◆ utilizationStatistics()

const UtilizationStats & SimulatorFrontend::utilizationStatistics ( int  core = -1)

Returns the current utilization statistics of the processor.

Recalculates the statistics in case they are old, that is, simulation has been continued or restarted since it was calculated. Should not be called in case simulation is not initialized!

Todo:
: unimplemented for remote debuggers

Definition at line 2155 of file SimulatorFrontend.cc.

2155  {
2156  if (core == -1)
2157  core = selectedCore();
2158 
2159  utilizationStats_.resize(1);
2160 
2161  UtilizationStats* utilizationStats = utilizationStats_.at(core);
2162 
2163  if (utilizationStats == NULL) {
2164  // stats calculation differs slightly for compiled & interpretive sims.
2165  if (!isCompiledSimulation()) {
2166  utilizationStats = new UtilizationStats();
2167  SimulationStatistics stats(
2168  *currentProgram_,
2169  dynamic_cast<SimulationController*>(
2170  simCon_)->instructionMemory(core));
2171  stats.addStatistics(*utilizationStats);
2172  stats.calculate();
2173  } else {
2174  CompiledSimUtilizationStats* compiledSimUtilizationStats =
2176  CompiledSimController& compiledSimCon =
2177  dynamic_cast<CompiledSimController&>(*simCon_);
2178  compiledSimUtilizationStats->calculate(program(),
2179  *compiledSimCon.compiledSimulation());
2180  utilizationStats = compiledSimUtilizationStats;
2181  }
2182  utilizationStats_[core] = utilizationStats;
2183  }
2184  return *utilizationStats;
2185 }

References SimulationStatistics::addStatistics(), CompiledSimUtilizationStats::calculate(), SimulationStatistics::calculate(), CompiledSimController::compiledSimulation(), currentProgram_, isCompiledSimulation(), program(), selectedCore(), simCon_, and utilizationStats_.

Referenced by ProximBusDetailsCmd::Do(), ProximFUDetailsCmd::Do(), ProximSocketDetailsCmd::Do(), ProximIUDetailsCmd::Do(), ProximRFDetailsCmd::Do(), InfoProcCommand::execute(), InfoStatsCommand::execute(), finishSimulation(), and ProximMachineStateWindow::setUtilizationHighlights().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ timeoutThread

void timeoutThread ( unsigned int  timeout,
SimulatorFrontend simFE 
)
friend

A thread function for handling simulation timeout

Parameters
timeouttimeout in seconds

Definition at line 951 of file SimulatorFrontend.cc.

951  {
952  if (timeout == 0) {
953  return;
954  }
955 
956  TTASimulationController* simCon = simFE->simCon_;
957  boost::xtime xt;
958  boost::xtime xtPoll;
959 #if BOOST_VERSION < 105000
960  boost::xtime_get(&xt, boost::TIME_UTC);
961 #else
962  /* TIME_UTC was replaced by TIME_UTC_ in boost 1.50, to avoid
963  * clashing with a similarly named C11 macro. */
964  boost::xtime_get(&xt, boost::TIME_UTC_);
965 #endif
966  unsigned int pollTime = 5; // poll time in seconds
967  xtPoll = xt;
968  xt.sec += timeout;
969 
970  xtPoll.sec += pollTime;
971  while (xt.sec > xtPoll.sec) {
972  boost::thread::sleep(xtPoll);
973  xtPoll.sec += pollTime;
974  if (simCon != simFE->simCon_) {
975  return;
976  }
977  }
978  boost::thread::sleep(xt);
979 
980  if (simCon != simFE->simCon_) {
981  return;
982  }
983 
984  if (!simFE->hasSimulationEnded()) {
986  }
987 }

Referenced by next(), run(), and runUntil().

Member Data Documentation

◆ busTracing_

bool SimulatorFrontend::busTracing_
protected

Is bus tracing, i.e., storing the values of buses in each clock cycle enabled.

Definition at line 316 of file SimulatorFrontend.hh.

Referenced by busTracing(), initializeTracing(), and setBusTracing().

◆ busTrackers_

std::vector<BusTracker*> SimulatorFrontend::busTrackers_
protected

The tracker for saving bus trace.

Definition at line 336 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), and initializeTracing().

◆ callHistoryLength_

std::size_t SimulatorFrontend::callHistoryLength_
protected

The length of call history to store in memory for the commands that need it.

Definition at line 391 of file SimulatorFrontend.hh.

Referenced by callHistoryLength(), setCallHistoryLength(), and setupCallHistoryTracking().

◆ callPathTrackers_

std::vector<CallPathTracker*> SimulatorFrontend::callPathTrackers_
protected

The call path trackers for each core, in case tracking is enabled.

Definition at line 393 of file SimulatorFrontend.hh.

Referenced by callPathTracker(), finishSimulation(), and setupCallHistoryTracking().

◆ currentBackend_

SimulationType SimulatorFrontend::currentBackend_
protected

Type of "backend" this Frontend has.

Definition at line 307 of file SimulatorFrontend.hh.

Referenced by initializeMemorySystem(), initializeSimulation(), isCompiledSimulation(), isCustomDebugger(), isTCEDebugger(), and setCompiledSimulation().

◆ currentMachine_

const TTAMachine::Machine* SimulatorFrontend::currentMachine_
protected

◆ currentProgram_

const TTAProgram::Program* SimulatorFrontend::currentProgram_
protected

◆ detailedSimulation_

bool SimulatorFrontend::detailedSimulation_
protected

Set to true in case should build a detailed model which simulates FU stages, possibly with an external system-level model.

Definition at line 403 of file SimulatorFrontend.hh.

Referenced by initializeSimulation(), and setDetailedSimulation().

◆ disassembler_

POMDisassembler* SimulatorFrontend::disassembler_
mutableprotected

The disassembler used to print out instructions. This is initialized on demand.

Definition at line 310 of file SimulatorFrontend.hh.

Referenced by disassembleInstruction(), initializeDisassembler(), loadProgram(), programLocationDescription(), and ~SimulatorFrontend().

◆ eventHandler_

SimulationEventHandler* SimulatorFrontend::eventHandler_
protected

Per simulation instance of SimulationEventHandler.

Definition at line 371 of file SimulatorFrontend.hh.

Referenced by eventHandler(), and ~SimulatorFrontend().

◆ executionTracing_

bool SimulatorFrontend::executionTracing_
protected

Is execution tracing, i.e., storing the executed instruction addresses to the trace database, enabled.

Definition at line 313 of file SimulatorFrontend.hh.

Referenced by executionTracing(), initializeTracing(), and setExecutionTracing().

◆ executionTrackers_

std::vector<ExecutionTracker*> SimulatorFrontend::executionTrackers_
protected

The simple execution tracker for storing trace of executed instructions.

Definition at line 333 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), and initializeTracing().

◆ forcedTraceDBFileName_

std::string SimulatorFrontend::forcedTraceDBFileName_
protected

If set, forces the SQLite filename of trace DB to this name.

Definition at line 395 of file SimulatorFrontend.hh.

Referenced by forceTraceDBFileName(), and initializeTracing().

◆ fuResourceConflictDetection_

bool SimulatorFrontend::fuResourceConflictDetection_
protected

If this is enabled before initialization, FU resource conflicts are detected (slows down simulation).

Definition at line 354 of file SimulatorFrontend.hh.

Referenced by fuResourceConflictDetection(), initializeSimulation(), and setFUResourceConflictDetection().

◆ lastRunCycleCount_

ClockCycleCount SimulatorFrontend::lastRunCycleCount_
protected

The cycle count of the last non-interrupted simulation phase.

Definition at line 373 of file SimulatorFrontend.hh.

Referenced by killSimulation(), lastRunCycleCount(), and stopTimer().

◆ lastRunTime_

double SimulatorFrontend::lastRunTime_
protected

The wall clock time of the last non-interrupted simulation phase in seconds.

Definition at line 376 of file SimulatorFrontend.hh.

Referenced by lastRunTime(), and stopTimer().

◆ leaveCompiledDirty_

bool SimulatorFrontend::leaveCompiledDirty_
protected

True in case the compilation simulation should not cleanup at destruction the engine source files.

Definition at line 388 of file SimulatorFrontend.hh.

Referenced by initializeSimulation(), and setCompiledSimulationLeaveDirty().

◆ machineOwnedByFrontend_

bool SimulatorFrontend::machineOwnedByFrontend_
protected

Is the machine owned by SimulatorFrontend or by the client?

Definition at line 298 of file SimulatorFrontend.hh.

Referenced by loadMachine(), and ~SimulatorFrontend().

◆ memoryAccessTracking_

bool SimulatorFrontend::memoryAccessTracking_
protected

If this is enabled before initialization, memory access tracking is enabled. (slows down simulation)

Definition at line 369 of file SimulatorFrontend.hh.

Referenced by initializeMemorySystem(), memoryAccessTracking(), and setMemoryAccessTracking().

◆ memorySystems_

std::vector<MemorySystem*> SimulatorFrontend::memorySystems_
protected

The simulation models of the memories in the currently loaded machine for each core.

Definition at line 398 of file SimulatorFrontend.hh.

Referenced by initializeMemorySystem(), loadMachine(), memorySystem(), and ~SimulatorFrontend().

◆ outputStream_

std::ostream* SimulatorFrontend::outputStream_
protected

Default output stream.

Definition at line 365 of file SimulatorFrontend.hh.

Referenced by outputStream(), and setOutputStream().

◆ printNextInstruction_

bool SimulatorFrontend::printNextInstruction_
protected

If true, the next simulated instructions is printed to stdout when simulation stops.

Definition at line 357 of file SimulatorFrontend.hh.

Referenced by nextInstructionPrinting(), and setNextInstructionPrinting().

◆ printSimulationTimeStatistics_

bool SimulatorFrontend::printSimulationTimeStatistics_
protected

True if the simulation time statistics should be printed out.

Definition at line 359 of file SimulatorFrontend.hh.

Referenced by setSimulationTimeStatistics(), and simulationTimeStatistics().

◆ procedureTransferTracing_

bool SimulatorFrontend::procedureTransferTracing_
protected

Is procedure transfer access tracking enabled.

Definition at line 320 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), procedureTransferTracing(), and setProcedureTransferTracing().

◆ procedureTransferTrackers_

std::vector<ProcedureTransferTracker*> SimulatorFrontend::procedureTransferTrackers_
protected

The procedure transfer tracker.

Definition at line 342 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), and initializeTracing().

◆ programErrorReports_

ProgramErrorDescriptionList SimulatorFrontend::programErrorReports_
protected

◆ programFileName_

std::string SimulatorFrontend::programFileName_
protected

The source file of the program to be simulated. Used to generate the file name of the trace data base.

Definition at line 303 of file SimulatorFrontend.hh.

Referenced by initializeTracing(), loadProgram(), and ~SimulatorFrontend().

◆ programOwnedByFrontend_

bool SimulatorFrontend::programOwnedByFrontend_
protected

Is the program owned by SimulatorFrontend or by the client?

Definition at line 305 of file SimulatorFrontend.hh.

Referenced by loadMachine(), loadProgram(), and ~SimulatorFrontend().

◆ rfAccessTracing_

bool SimulatorFrontend::rfAccessTracing_
protected

Is register file (concurrent) access tracking enabled.

Definition at line 318 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), rfAccessTracing(), and setRFAccessTracing().

◆ rfAccessTrackers_

std::vector<RFAccessTracker*> SimulatorFrontend::rfAccessTrackers_
protected

The register file access tracker.

Definition at line 339 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), and rfAccessTracker().

◆ saveProfileData_

bool SimulatorFrontend::saveProfileData_
protected

Is saving of profile data to TraceDB enabled.

Definition at line 322 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), profileDataSaving(), and setProfileDataSaving().

◆ saveUtilizationData_

bool SimulatorFrontend::saveUtilizationData_
protected

Is saving of utilization data to TraceDB enabled.

Definition at line 324 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), setUtilizationDataSaving(), and utilizationDataSaving().

◆ simCon_

TTASimulationController* SimulatorFrontend::simCon_
protected

◆ simulationTimeout_

unsigned int SimulatorFrontend::simulationTimeout_
protected

Simulation timeout in seconds.

Definition at line 383 of file SimulatorFrontend.hh.

Referenced by next(), run(), runUntil(), and setTimeout().

◆ startCycleCount_

CycleCount SimulatorFrontend::startCycleCount_
protected

The cycle count when the latest simulation was started. Used to compute simulation speed.

Definition at line 381 of file SimulatorFrontend.hh.

Referenced by startTimer(), and stopTimer().

◆ startTime_

std::time_t SimulatorFrontend::startTime_
protected

The time of the last simulation start. Used to compute simulation speed.

Definition at line 378 of file SimulatorFrontend.hh.

Referenced by startTimer(), and stopTimer().

◆ staticCompilation_

bool SimulatorFrontend::staticCompilation_
protected

True if the compiled simulation should use static compilation.

Definition at line 361 of file SimulatorFrontend.hh.

Referenced by setStaticCompilation(), and staticCompilation().

◆ stopPointManager_

StopPointManager* SimulatorFrontend::stopPointManager_
protected

The breakpoint manager to be used to bookkeep breakpoints.

Definition at line 345 of file SimulatorFrontend.hh.

Referenced by initializeSimulation(), stopPointManager(), and ~SimulatorFrontend().

◆ tpef_

TPEF::Binary* SimulatorFrontend::tpef_
protected

The source TPEF file.

Definition at line 351 of file SimulatorFrontend.hh.

Referenced by initializeDataMemories(), loadProgram(), and ~SimulatorFrontend().

◆ traceDBOwned_

std::vector<bool> SimulatorFrontend::traceDBOwned_
protected

Whether traceDB at index is owned by simulator (or taken away by client using lastTraceDB())

Definition at line 329 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), and lastTraceDB().

◆ traceDBs_

std::vector<ExecutionTrace*> SimulatorFrontend::traceDBs_
protected

The database to use for execution trace data.

Definition at line 326 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), initializeTracing(), and lastTraceDB().

◆ traceFileNameSetByUser_

bool SimulatorFrontend::traceFileNameSetByUser_
protected

Flag that indicates is the trace file name set by user.

Definition at line 363 of file SimulatorFrontend.hh.

◆ utilizationStats_

std::vector<UtilizationStats*> SimulatorFrontend::utilizationStats_
protected

Processor utilization statistics.

Definition at line 348 of file SimulatorFrontend.hh.

Referenced by finishSimulation(), next(), run(), runUntil(), step(), and utilizationStatistics().

◆ zeroFillMemoriesOnReset_

bool SimulatorFrontend::zeroFillMemoriesOnReset_
protected

Set to true in case the memories should be set to zero at reset.

Definition at line 400 of file SimulatorFrontend.hh.

Referenced by initializeDataMemories(), and setZeroFillMemoriesOnReset().


The documentation for this class was generated from the following files:
TTASimulationController::memorySystem
virtual MemorySystem & memorySystem(int coreId=-1)
Definition: TTASimulationController.cc:171
SimulatorFrontend::lastRunTime_
double lastRunTime_
The wall clock time of the last non-interrupted simulation phase in seconds.
Definition: SimulatorFrontend.hh:376
SimulatorFrontend::saveProfileData_
bool saveProfileData_
Is saving of profile data to TraceDB enabled.
Definition: SimulatorFrontend.hh:322
SimValue::intValue
int intValue() const
Definition: SimValue.cc:895
SimulatorFrontend::printNextInstruction_
bool printNextInstruction_
If true, the next simulated instructions is printed to stdout when simulation stops.
Definition: SimulatorFrontend.hh:357
TTASimulationController::registerFileValue
virtual std::string registerFileValue(const std::string &rfName, int registerIndex=-1)=0
SimulatorFrontend::traceDBOwned_
std::vector< bool > traceDBOwned_
Whether traceDB at index is owned by simulator (or taken away by client using lastTraceDB())
Definition: SimulatorFrontend.hh:329
MemorySystem::resetAllMemories
void resetAllMemories()
SimulatorToolbox::fuPortRegex
static boost::regex fuPortRegex()
Definition: SimulatorToolbox.cc:85
TTASimulationController::lastExecutedInstruction
virtual InstructionAddress lastExecutedInstruction(int coreId=-1) const
Definition: TTASimulationController.cc:147
MemorySystem::addAddressSpace
void addAddressSpace(const TTAMachine::AddressSpace &as, MemoryPtr mem, bool shared=true)
Definition: MemorySystem.cc:90
InstructionMemory::instructionAtConst
const ExecutableInstruction & instructionAtConst(InstructionAddress address) const
SimulatorFrontend::setControllerForMemories
void setControllerForMemories(RemoteController *con)
Definition: SimulatorFrontend.cc:634
TTAProgram::Program
Definition: Program.hh:63
ProcedureTransferTracker
Definition: ProcedureTransferTracker.hh:51
SimulatorFrontend::utilizationStats_
std::vector< UtilizationStats * > utilizationStats_
Processor utilization statistics.
Definition: SimulatorFrontend.hh:348
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
ExecutionTrace::addBusWriteCount
void addBusWriteCount(BusID socket, ClockCycleCount count)
Definition: ExecutionTrace.cc:688
FileNotFound
Definition: Exception.hh:224
SimulatorFrontend::SIM_REMOTE
@ SIM_REMOTE
Remote debugger, not a simulator at all.
Definition: SimulatorFrontend.hh:104
SimulatorFrontend::procedureTransferTracing_
bool procedureTransferTracing_
Is procedure transfer access tracking enabled.
Definition: SimulatorFrontend.hh:320
SimulatorFrontend::simCon_
TTASimulationController * simCon_
If simulation is initialized, this contains a pointer to the simulation controller.
Definition: SimulatorFrontend.hh:296
TTAProgram::DataDefinition
Definition: DataDefinition.hh:52
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
NumberFormatException
Definition: Exception.hh:421
SimulatorFrontend::program
const TTAProgram::Program & program() const
Definition: SimulatorFrontend.cc:276
POMValidator::CONNECTION_MISSING
@ CONNECTION_MISSING
Connection required for a move is missing.
Definition: POMValidator.hh:55
UtilizationStats::triggerCount
ClockCycleCount triggerCount(const std::string &fuName) const
Definition: UtilizationStats.cc:220
SimulatorFrontend::SIM_COMPILED
@ SIM_COMPILED
Compiled, faster simulation.
Definition: SimulatorFrontend.hh:103
TTASimulationController::STA_STOPPED
@ STA_STOPPED
Simulation stopped for some reason.
Definition: TTASimulationController.hh:76
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
OTASimulationController
Definition: OTASimulationController.hh:40
SimulatorFrontend::initializeMemorySystem
void initializeMemorySystem()
Definition: SimulatorFrontend.cc:1699
TTAProgram::Address
Definition: Address.hh:51
TTAProgram::Program::procedureCount
int procedureCount() const
Definition: Program.cc:610
TTAProgram::DataDefinition::startAddress
virtual Address startAddress() const
Definition: DataDefinition.cc:129
TTAMachine::FunctionUnit::hasAddressSpace
virtual bool hasAddressSpace() const
Definition: FunctionUnit.cc:608
TTAProgram::DataDefinition::size
virtual int size() const
Definition: DataDefinition.cc:211
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
SRE_USER_REQUESTED
@ SRE_USER_REQUESTED
User requested the simulation to stop explicitly, e.g., by pressing ctrl-c in the CLI.
Definition: SimulatorConstants.hh:66
TTAProgram::Program::startAddress
Address startAddress() const
Definition: Program.cc:286
POMValidator::SIMULATION_NOT_POSSIBLE
@ SIMULATION_NOT_POSSIBLE
Program contains operations with unknown behaviour.
Definition: POMValidator.hh:59
ExecutableInstruction::executionCount
ClockCycleCount executionCount() const
Definition: ExecutableInstruction.cc:85
ProcessorConfigurationFile
Definition: ProcessorConfigurationFile.hh:46
SimulatorFrontend::currentBackend_
SimulationType currentBackend_
Type of "backend" this Frontend has.
Definition: SimulatorFrontend.hh:307
RFAccessTracker::ConcurrentRFAccessIndex
std::map< ConcurrentRFAccess, ClockCycleCount > ConcurrentRFAccessIndex
concurrent accesses and their counts
Definition: RFAccessTracker.hh:61
SimulatorFrontend::busTracing_
bool busTracing_
Is bus tracing, i.e., storing the values of buses in each clock cycle enabled.
Definition: SimulatorFrontend.hh:316
SimulatorFrontend::forcedTraceDBFileName_
std::string forcedTraceDBFileName_
If set, forces the SQLite filename of trace DB to this name.
Definition: SimulatorFrontend.hh:395
SRE_AFTER_TIMEOUT
@ SRE_AFTER_TIMEOUT
Stopped after simulation timeout instruction.
Definition: SimulatorConstants.hh:63
RFAccessTracker::ConcurrentRFAccess
boost::tuple< std::string, std::size_t, std::size_t > ConcurrentRFAccess
type to be used as a key for storing concurrent access info
Definition: RFAccessTracker.hh:58
SimulatorFrontend::timeoutThread
friend void timeoutThread(unsigned int timeout, SimulatorFrontend *simFE)
Definition: SimulatorFrontend.cc:951
MachineState::portState
PortState & portState(const std::string &portName, const std::string &fuName)
Definition: MachineState.cc:175
SimulatorFrontend::machine
const TTAMachine::Machine & machine() const
Definition: SimulatorFrontend.cc:263
POMValidator::LONG_IMMEDIATE_NOT_SUPPORTED
@ LONG_IMMEDIATE_NOT_SUPPORTED
Instruction template missing for a long immediate.
Definition: POMValidator.hh:57
TTAProgram::Instruction
Definition: Instruction.hh:57
SimulatorFrontend::zeroFillMemoriesOnReset_
bool zeroFillMemoriesOnReset_
Set to true in case the memories should be set to zero at reset.
Definition: SimulatorFrontend.hh:400
OutOfRange
Definition: Exception.hh:320
MemorySystem::fillAllMemoriesWithZero
void fillAllMemoriesWithZero()
TTASimulationController::runUntil
virtual void runUntil(UIntWord address)=0
SimulationEventHandler
Definition: SimulationEventHandler.hh:41
SimulatorFrontend::traceDBs_
std::vector< ExecutionTrace * > traceDBs_
The database to use for execution trace data.
Definition: SimulatorFrontend.hh:326
UtilizationStats::socketWrites
ClockCycleCount socketWrites(const std::string &socketName) const
Definition: UtilizationStats.cc:206
TTAMachine::Bus
Definition: Bus.hh:53
TPEF::BinaryStream
Definition: BinaryStream.hh:59
SimulatorFrontend::outputStream
std::ostream & outputStream()
Definition: SimulatorFrontend.cc:1987
SimulatorFrontend::finishSimulation
void finishSimulation()
Definition: SimulatorFrontend.cc:1538
TTAProgram::DataMemory::addressSpace
const TTAMachine::AddressSpace & addressSpace() const
Definition: DataMemory.cc:182
TTAMachine::Machine::is64bit
bool is64bit() const
Definition: Machine.hh:260
ExecutionTrace::open
void open()
Definition: ExecutionTrace.cc:169
TTAProgram::Address::space
const TTAMachine::AddressSpace & space() const
TTAProgram::DataMemory::dataDefinitionCount
int dataDefinitionCount() const
Definition: DataMemory.cc:129
POMDisassembler::disassembler
static POMDisassembler * disassembler(const TTAMachine::Machine &mach, const TTAProgram::Program &program)
Definition: POMDisassembler.cc:1022
DirectAccessMemory
Definition: DirectAccessMemory.hh:55
RemoteController
Definition: RemoteController.hh:48
TTASimulationController::step
virtual void step(double count=1)=0
SimulatorFrontend::procedureTransferTrackers_
std::vector< ProcedureTransferTracker * > procedureTransferTrackers_
The procedure transfer tracker.
Definition: SimulatorFrontend.hh:342
NullPortState::instance
static NullPortState & instance()
Definition: PortState.cc:96
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
ExecutionTrace::addRegisterAccessCount
void addRegisterAccessCount(RegisterFileID registerFile, RegisterID registerIndex, ClockCycleCount reads, ClockCycleCount writes)
Definition: ExecutionTrace.cc:475
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
TTAProgram::CodeSnippet::startAddress
virtual Address startAddress() const
Definition: CodeSnippet.cc:780
TTASimulationController::automaticFinishImpossible
virtual bool automaticFinishImpossible() const
Definition: TTASimulationController.cc:197
TTASimulationController::prepareToStop
virtual void prepareToStop(StopReason reason)
Definition: TTASimulationController.cc:90
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimulatorFrontend::initializeDataMemories
void initializeDataMemories(const TTAMachine::AddressSpace *onlyOne=NULL)
Definition: SimulatorFrontend.cc:440
SimulatorFrontend::printSimulationTimeStatistics_
bool printSimulationTimeStatistics_
True if the simulation time statistics should be printed out.
Definition: SimulatorFrontend.hh:359
SimulatorFrontend::isMachineLoaded
bool isMachineLoaded() const
Definition: SimulatorFrontend.cc:1250
Texts::TXT_UNABLE_TO_LOAD_PROGRAM
@ TXT_UNABLE_TO_LOAD_PROGRAM
Definition: SimulatorTextGenerator.hh:195
SimulatorFrontend::startTimer
void startTimer()
Definition: SimulatorFrontend.cc:928
InstructionMemory
Definition: InstructionMemory.hh:54
TTASimulationController::stopReasonCount
virtual unsigned int stopReasonCount() const
Definition: TTASimulationController.cc:101
CompiledSimUtilizationStats
Definition: CompiledSimUtilizationStats.hh:47
FileSystem::fileOfPath
static std::string fileOfPath(const std::string pathName)
Definition: FileSystem.cc:101
Conversion::toString
static std::string toString(const T &source)
SimulatorFrontend::stopPointManager_
StopPointManager * stopPointManager_
The breakpoint manager to be used to bookkeep breakpoints.
Definition: SimulatorFrontend.hh:345
RFAccessTracker
Definition: RFAccessTracker.hh:52
SimulatorFrontend::stopReasonCount
unsigned int stopReasonCount() const
Definition: SimulatorFrontend.cc:1344
ExecutionTrace::addFunctionUnitOperationTriggerCount
void addFunctionUnitOperationTriggerCount(FunctionUnitID functionUnit, OperationID operation, OperationTriggerCount count)
Definition: ExecutionTrace.cc:546
SimulatorFrontend::findBooleanRegister
StateData & findBooleanRegister()
Definition: SimulatorFrontend.cc:709
CompiledSimUtilizationStats::calculate
virtual void calculate(const TTAProgram::Program &program, const CompiledSimulation &compiledSim)
Definition: CompiledSimUtilizationStats.cc:57
SimulatorFrontend::ProgramErrorDescription
std::pair< RuntimeErrorSeverity, std::string > ProgramErrorDescription
A type for storing a program error description.
Definition: SimulatorFrontend.hh:288
SimValue
Definition: SimValue.hh:96
SimulatorFrontend::selectedCore
int selectedCore() const
Definition: SimulatorFrontend.hh:257
TTAMachine::BaseRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
TTAMachine::Machine::isLittleEndian
bool isLittleEndian() const
Definition: Machine.hh:258
MemorySystem::MemoryPtr
boost::shared_ptr< Memory > MemoryPtr
Definition: MemorySystem.hh:57
SimulatorFrontend::currentProgram_
const TTAProgram::Program * currentProgram_
Program to be simulated.
Definition: SimulatorFrontend.hh:300
SimulatorFrontend::SimulationType
SimulationType
Which type of simulation this SimulatorFrontend controls or connects to.
Definition: SimulatorFrontend.hh:101
TTASimulationController::STA_RUNNING
@ STA_RUNNING
A run command (run, stepi, until...) given.
Definition: TTASimulationController.hh:75
CallPathTracker
Definition: CallPathTracker.hh:51
TTAMachine::AddressSpace::isShared
virtual bool isShared() const
Definition: AddressSpace.hh:72
SimulatorFrontend::initializeDisassembler
void initializeDisassembler() const
Definition: SimulatorFrontend.cc:1152
StringTools::stringToUpper
static std::string stringToUpper(const std::string &source)
Definition: StringTools.cc:143
TTAProgram::TPEFProgramFactory
Definition: TPEFProgramFactory.hh:87
assert
#define assert(condition)
Definition: Application.hh:86
MemorySystem::memoryCount
unsigned int memoryCount() const
Definition: MemorySystem.cc:226
SimulatorFrontend::programCounter
InstructionAddress programCounter() const
Definition: SimulatorFrontend.cc:1169
SimulatorFrontend::loadMachine
virtual void loadMachine(const std::string &fileName)
Definition: SimulatorFrontend.cc:534
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TCEDBGController
Definition: TCEDBGController.hh:37
TTAProgram::Program::instructionAt
Instruction & instructionAt(InstructionAddress address) const
Definition: Program.cc:374
SimulatorFrontend::outputStream_
std::ostream * outputStream_
Default output stream.
Definition: SimulatorFrontend.hh:365
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
SimulatorFrontend::simulationTimeout_
unsigned int simulationTimeout_
Simulation timeout in seconds.
Definition: SimulatorFrontend.hh:383
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
SimulatorFrontend::callHistoryLength_
std::size_t callHistoryLength_
The length of call history to store in memory for the commands that need it.
Definition: SimulatorFrontend.hh:391
SimulatorTextGenerator
Definition: SimulatorTextGenerator.hh:41
TTASimulationController
Definition: TTASimulationController.hh:69
POMValidator::COMPILED_SIMULATION_NOT_POSSIBLE
@ COMPILED_SIMULATION_NOT_POSSIBLE
Compiled simulation is not possible.
Definition: POMValidator.hh:61
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
SimulatorFrontend::fuResourceConflictDetection_
bool fuResourceConflictDetection_
If this is enabled before initialization, FU resource conflicts are detected (slows down simulation).
Definition: SimulatorFrontend.hh:354
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
SimulatorFrontend::tpef_
TPEF::Binary * tpef_
The source TPEF file.
Definition: SimulatorFrontend.hh:351
SimulatorFrontend::programOwnedByFrontend_
bool programOwnedByFrontend_
Is the program owned by SimulatorFrontend or by the client?
Definition: SimulatorFrontend.hh:305
MemoryProxy
Definition: MemoryProxy.hh:53
TTASimulationController::STA_INITIALIZED
@ STA_INITIALIZED
Simulation initialized and ready to run.
Definition: TTASimulationController.hh:74
TTASimulationController::state
virtual SimulationStatus state() const
Definition: TTASimulationController.cc:137
TTASimulationController::STA_FINISHED
@ STA_FINISHED
Simulation ended after executing the last instruction.
Definition: TTASimulationController.hh:77
SimulatorFrontend::initializeTracing
void initializeTracing()
Definition: SimulatorFrontend.cc:1414
SimulatorFrontend::lastRunCycleCount_
ClockCycleCount lastRunCycleCount_
The cycle count of the last non-interrupted simulation phase.
Definition: SimulatorFrontend.hh:373
SimulatorFrontend::utilizationStatistics
const UtilizationStats & utilizationStatistics(int core=-1)
Definition: SimulatorFrontend.cc:2155
StopPointManager
Definition: StopPointManager.hh:50
ExecutionTrace
Definition: ExecutionTrace.hh:56
TTAMachine::Machine::Navigator::hasItem
bool hasItem(const std::string &name) const
ADFSerializer
Definition: ADFSerializer.hh:49
TTAProgram::Program::dataMemory
DataMemory & dataMemory(int index) const
Definition: Program.cc:967
TTAProgram::DataDefinition::isInitialized
virtual bool isInitialized() const
Definition: DataDefinition.cc:144
IllegalProgram
Definition: Exception.hh:895
TTASimulationController::run
virtual void run()=0
__func__
#define __func__
Definition: Application.hh:67
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
TTAProgram::Instruction::parent
CodeSnippet & parent() const
Definition: Instruction.cc:109
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
UtilizationStats::busWrites
ClockCycleCount busWrites(const std::string &busName) const
Definition: UtilizationStats.cc:192
TTAMachine::Socket
Definition: Socket.hh:53
ExecutionTracker
Definition: ExecutionTracker.hh:46
SimulatorFrontend::busTrackers_
std::vector< BusTracker * > busTrackers_
The tracker for saving bus trace.
Definition: SimulatorFrontend.hh:336
SimulatorFrontend::SIM_OTA
@ SIM_OTA
Simulation with operation-triggered implicit data transports.
Definition: SimulatorFrontend.hh:106
UtilizationStats::operationExecutions
ClockCycleCount operationExecutions(const std::string &operationName) const
Definition: UtilizationStats.cc:234
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
TTASimulationController::programCounter
virtual InstructionAddress programCounter() const =0
SimulatorFrontend::callPathTrackers_
std::vector< CallPathTracker * > callPathTrackers_
The call path trackers for each core, in case tracking is enabled.
Definition: SimulatorFrontend.hh:393
SimulatorFrontend::traceFileNameSetByUser_
bool traceFileNameSetByUser_
Flag that indicates is the trace file name set by user.
Definition: SimulatorFrontend.hh:363
TTAProgram::Address::location
InstructionAddress location() const
SRE_RUNTIME_ERROR
@ SRE_RUNTIME_ERROR
A fatal runtime error occured in the simulated program.
Definition: SimulatorConstants.hh:68
StringTools::ciEqual
static bool ciEqual(const std::string &a, const std::string &b)
Definition: StringTools.cc:240
SimulatorFrontend::RES_MINOR
@ RES_MINOR
Minor runtime error, no abort necessary.
Definition: SimulatorFrontend.hh:94
SimulatorFrontend::RES_FATAL
@ RES_FATAL
Fatal runtime error, there is a serious error in the simulated program, thus it makes no sense to go ...
Definition: SimulatorFrontend.hh:95
Texts::TXT_ILLEGAL_ADF_FILE
@ TXT_ILLEGAL_ADF_FILE
Definition: SimulatorTextGenerator.hh:52
Texts::TXT_ILLEGAL_INPUT_FILE
@ TXT_ILLEGAL_INPUT_FILE
Definition: TextGenerator.hh:60
SimulationStatistics
Definition: SimulationStatistics.hh:48
SRE_BREAKPOINT
@ SRE_BREAKPOINT
Stopped because of at least one breakpoint.
Definition: SimulatorConstants.hh:65
Exception
Definition: Exception.hh:54
SimulationEventHandler::SE_RUNTIME_ERROR
@ SE_RUNTIME_ERROR
Sent when a runtime error is detected in the simulated program.
Definition: SimulationEventHandler.hh:52
SimulatorFrontend::isCompiledSimulation
bool isCompiledSimulation() const
Definition: SimulatorFrontend.cc:1295
SimulatorFrontend::lastExecutedInstruction
virtual InstructionAddress lastExecutedInstruction(int coreId=-1) const
Definition: SimulatorFrontend.cc:1182
SimulatorFrontend::hasStopReason
bool hasStopReason(StopReason reason) const
Definition: SimulatorFrontend.cc:1369
PortState
Definition: PortState.hh:51
TTAMachine::Machine::addressSpaceNavigator
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition: Machine.cc:392
MemorySystem
Definition: MemorySystem.hh:55
TTAMachine::Machine::socketNavigator
virtual SocketNavigator socketNavigator() const
Definition: Machine.cc:368
SimulatorFrontend::FUPortValue
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)
Definition: SimulatorFrontend.cc:767
TTAMachine::Port::isOutput
virtual bool isOutput() const
Definition: Port.cc:308
SimulatorFrontend::leaveCompiledDirty_
bool leaveCompiledDirty_
True in case the compilation simulation should not cleanup at destruction the engine source files.
Definition: SimulatorFrontend.hh:388
TTASimulationController::stopReason
virtual StopReason stopReason(unsigned int index) const
Definition: TTASimulationController.cc:113
SimulatorFrontend::findPort
StateData & findPort(const std::string &fuName, const std::string &portName)
Definition: SimulatorFrontend.cc:819
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
SimulatorFrontend::programErrorReports_
ProgramErrorDescriptionList programErrorReports_
Runtime error reports.
Definition: SimulatorFrontend.hh:385
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAProgram::Program::dataMemoryCount
int dataMemoryCount() const
Definition: Program.cc:942
SimulatorFrontend::startTime_
std::time_t startTime_
The time of the last simulation start. Used to compute simulation speed.
Definition: SimulatorFrontend.hh:378
SimulatorFrontend::setupCallHistoryTracking
void setupCallHistoryTracking()
Definition: SimulatorFrontend.cc:2378
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
SimulatorFrontend::SIM_CUSTOM
@ SIM_CUSTOM
User-implemented remote HW debugger.
Definition: SimulatorFrontend.hh:105
SimulatorFrontend::state
StateData & state(std::string searchString)
Definition: SimulatorFrontend.cc:894
SimulatorFrontend::isSimulationRunning
bool isSimulationRunning() const
Definition: SimulatorFrontend.cc:1260
RemoteMemory
Definition: RemoteMemory.hh:50
ExecutionTrace::addConcurrentRegisterFileAccessCount
void addConcurrentRegisterFileAccessCount(RegisterFileID registerFile, RegisterAccessCount reads, RegisterAccessCount writes, ClockCycleCount count)
Definition: ExecutionTrace.cc:440
SimulatorFrontend::clearProgramErrorReports
void clearProgramErrorReports()
Definition: SimulatorFrontend.cc:2360
TTAMachine::AddressSpace::width
virtual int width() const
Definition: AddressSpace.cc:155
TTASimulationController::immediateUnitRegisterValue
virtual SimValue immediateUnitRegisterValue(const std::string &iuName, int index=-1)=0
SimulatorFrontend::stopTimer
void stopTimer()
Definition: SimulatorFrontend.cc:938
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
SimulatorFrontend::currentMachine_
const TTAMachine::Machine * currentMachine_
Machine to run simulation with.
Definition: SimulatorFrontend.hh:293
POMDisassembler::disassemble
static std::string disassemble(const TTAProgram::Move &move)
Definition: POMDisassembler.cc:629
SimulatorFrontend::cycleCount
ClockCycleCount cycleCount() const
Definition: SimulatorFrontend.cc:1194
SimulatorFrontend::disassembler_
POMDisassembler * disassembler_
The disassembler used to print out instructions. This is initialized on demand.
Definition: SimulatorFrontend.hh:310
CompiledSimController::compiledSimulation
virtual boost::shared_ptr< CompiledSimulation > compiledSimulation()
Definition: CompiledSimController.cc:359
POMValidator
Definition: POMValidator.hh:49
IllegalMachine
Definition: Exception.hh:878
ExecutionTrace::addProcedureAddressRange
void addProcedureAddressRange(InstructionAddress firstAddress, InstructionAddress lastAddress, const std::string &procedureName)
Definition: ExecutionTrace.cc:335
RFAccessTracker::accessDataBase
const ConcurrentRFAccessIndex & accessDataBase() const
Definition: RFAccessTracker.cc:220
Environment::simTraceDirPath
static std::string simTraceDirPath()
Definition: Environment.cc:1149
SimulatorFrontend::memorySystem
MemorySystem & memorySystem(int coreId=-1)
Definition: SimulatorFrontend.cc:2121
SimulatorFrontend::eventHandler
SimulationEventHandler & eventHandler()
Definition: SimulatorFrontend.cc:2260
RegisterFileState::registerState
virtual RegisterState & registerState(int index)
Definition: RegisterFileState.cc:81
SimulatorFrontend::executionTracing_
bool executionTracing_
Is execution tracing, i.e., storing the executed instruction addresses to the trace database,...
Definition: SimulatorFrontend.hh:313
SimulatorFrontend::rfAccessTrackers_
std::vector< RFAccessTracker * > rfAccessTrackers_
The register file access tracker.
Definition: SimulatorFrontend.hh:339
TTASimulationController::clockCount
virtual ClockCycleCount clockCount() const
Definition: TTASimulationController.cc:161
CycleCount
long long CycleCount
Type for storing simulation cycle counts.
Definition: BaseType.hh:187
SimulatorFrontend::machineState
MachineState & machineState(int core=-1)
Definition: SimulatorFrontend.cc:2138
FileSystem::fileExists
static bool fileExists(const std::string fileName)
UtilizationStats::registerWrites
ClockCycleCount registerWrites(const std::string &rfName, int registerIndex) const
Definition: UtilizationStats.cc:314
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TCEString
Definition: TCEString.hh:53
SimulatorFrontend::rfAccessTracker
const RFAccessTracker & rfAccessTracker() const
Definition: SimulatorFrontend.cc:1869
TTASimulationController::reset
virtual void reset()=0
SimulatorFrontend::memoryAccessTracking_
bool memoryAccessTracking_
If this is enabled before initialization, memory access tracking is enabled. (slows down simulation)
Definition: SimulatorFrontend.hh:369
SimulatorFrontend::machineOwnedByFrontend_
bool machineOwnedByFrontend_
Is the machine owned by SimulatorFrontend or by the client?
Definition: SimulatorFrontend.hh:298
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
SimulatorTextGenerator::generateCompiledSimTexts
virtual void generateCompiledSimTexts()
Definition: SimulatorTextGenerator.cc:590
ExecutionTrace::addInstructionExecutionCount
void addInstructionExecutionCount(InstructionAddress address, ClockCycleCount count)
Definition: ExecutionTrace.cc:304
SimulatorFrontend::initializeSimulation
virtual void initializeSimulation()
Definition: SimulatorFrontend.cc:657
MemorySystem::memory
MemoryPtr memory(const TTAMachine::AddressSpace &as)
Definition: MemorySystem.cc:170
TTAProgram::DataMemory::dataDefinition
DataDefinition & dataDefinition(Address address) const
Definition: DataMemory.cc:79
TTASimulationController::next
virtual void next(int count=1)=0
RegisterFileState
Definition: RegisterFileState.hh:49
TTASimulationController::FUPortValue
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)=0
SimulatorFrontend::startCycleCount_
CycleCount startCycleCount_
The cycle count when the latest simulation was started. Used to compute simulation speed.
Definition: SimulatorFrontend.hh:381
SimulatorFrontend::detailedSimulation_
bool detailedSimulation_
Set to true in case should build a detailed model which simulates FU stages, possibly with an externa...
Definition: SimulatorFrontend.hh:403
DisassemblyFUPort
Definition: DisassemblyFUPort.hh:41
TTAProgram::Procedure::name
TCEString name() const
Definition: Procedure.hh:66
SimulatorFrontend::stopReason
StopReason stopReason(unsigned int index) const
Definition: SimulatorFrontend.cc:1356
Texts::TXT_FILE_NOT_FOUND
@ TXT_FILE_NOT_FOUND
Definition: TextGenerator.hh:57
ReadableState::value
virtual const SimValue & value() const =0
SimulatorFrontend::staticCompilation_
bool staticCompilation_
True if the compiled simulation should use static compilation.
Definition: SimulatorFrontend.hh:361
ADFSerializer::readMachine
TTAMachine::Machine * readMachine()
Definition: ADFSerializer.cc:275
BusTracker
Definition: BusTracker.hh:53
TTAProgram::CodeSnippet::endAddress
virtual Address endAddress() const
Definition: CodeSnippet.cc:788
SimulationController
Definition: SimulationController.hh:46
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
SimulatorFrontend::saveUtilizationData_
bool saveUtilizationData_
Is saving of utilization data to TraceDB enabled.
Definition: SimulatorFrontend.hh:324
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
KeyNotFound
Definition: Exception.hh:285
SimulatorFrontend::executionTrackers_
std::vector< ExecutionTracker * > executionTrackers_
The simple execution tracker for storing trace of executed instructions.
Definition: SimulatorFrontend.hh:333
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
UtilizationStats::registerReads
ClockCycleCount registerReads(const std::string &rfName, int registerIndex) const
Definition: UtilizationStats.cc:270
SimulatorFrontend::registerFileValue
virtual std::string registerFileValue(const std::string &rfName, int registerIndex=-1)
Definition: SimulatorFrontend.cc:738
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
Conversion::toInt
static int toInt(const T &source)
IdealSRAM
Definition: IdealSRAM.hh:55
CustomDBGController
Definition: CustomDBGController.hh:35
SimulatorFrontend::hasSimulationEnded
bool hasSimulationEnded() const
Definition: SimulatorFrontend.cc:1283
IOException
Definition: Exception.hh:130
TTAProgram::Program::lastInstruction
Instruction & lastInstruction() const
Definition: Program.cc:463
TTAProgram::Program::lastProcedure
Procedure & lastProcedure() const
Definition: Program.cc:230
CompiledSimController
Definition: CompiledSimController.hh:52
SimulatorFrontend::setFUResourceConflictDetection
void setFUResourceConflictDetection(bool value)
Definition: SimulatorFrontend.cc:2022
SimulatorFrontend::eventHandler_
SimulationEventHandler * eventHandler_
Per simulation instance of SimulationEventHandler.
Definition: SimulatorFrontend.hh:371
Informer::handleEvent
void handleEvent(int event)
SimulationController::machineState
virtual MachineState & machineState(int core=-1)
Definition: SimulationController.cc:145
POMDisassembler::disassembleInstruction
virtual TCEString disassembleInstruction(const TTAProgram::Instruction &instruction, int addr=-1)
"Template methods" that can be overridden in the derived assemblers.
Definition: POMDisassembler.cc:675
SimulatorFrontend::memorySystems_
std::vector< MemorySystem * > memorySystems_
The simulation models of the memories in the currently loaded machine for each core.
Definition: SimulatorFrontend.hh:398
TTAProgram::DataMemory
Definition: DataMemory.hh:56
TTAMachine::ControlUnit::globalGuardLatency
int globalGuardLatency() const
TTAMachine::ControlUnit::returnAddressPort
SpecialRegisterPort * returnAddressPort() const
Definition: ControlUnit.cc:307
TTAMachine::BaseRegisterFile::size
virtual int size() const
FileSystem::fileIsReadable
static bool fileIsReadable(const std::string fileName)
TTAMachine::BaseRegisterFile::width
virtual int width() const
Texts::TXT_NO_ADF_DEFINED_IN_PCF
@ TXT_NO_ADF_DEFINED_IN_PCF
Definition: SimulatorTextGenerator.hh:51
Texts::TXT_FILE_X_NOT_FOUND
@ TXT_FILE_X_NOT_FOUND
Definition: TextGenerator.hh:58
MemorySystem::addressSpace
const TTAMachine::AddressSpace & addressSpace(unsigned int i)
Definition: MemorySystem.cc:261
TTAMachine::AddressSpace::start
virtual ULongWord start() const
Definition: AddressSpace.cc:166
TTAProgram::Program::procedure
Procedure & procedure(int index) const
Definition: Program.cc:622
TTAProgram::Procedure
Definition: Procedure.hh:55
ExecutionTrace::setSimulatedCycleCount
void setSimulatedCycleCount(ClockCycleCount count)
Definition: ExecutionTrace.cc:741
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::AddressSpace::end
virtual ULongWord end() const
Definition: AddressSpace.cc:177
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
SimulatorFrontend::programFileName_
std::string programFileName_
The source file of the program to be simulated. Used to generate the file name of the trace data base...
Definition: SimulatorFrontend.hh:303
UtilizationStats
Definition: UtilizationStats.hh:50
TTAProgram::Instruction::address
Address address() const
Definition: Instruction.cc:327
SimulatorFrontend::RuntimeErrorSeverity
RuntimeErrorSeverity
The severities of runtime errors.
Definition: SimulatorFrontend.hh:93
SimulatorFrontend::setCompiledSimulation
void setCompiledSimulation(bool value)
Definition: SimulatorFrontend.cc:1883
InstanceNotFound
Definition: Exception.hh:304
ExecutionTrace::addSocketWriteCount
void addSocketWriteCount(SocketID socket, ClockCycleCount)
Definition: ExecutionTrace.cc:631
TTAMachine::Machine
Definition: Machine.hh:73
SimulatorFrontend::rfAccessTracing_
bool rfAccessTracing_
Is register file (concurrent) access tracking enabled.
Definition: SimulatorFrontend.hh:318
SimulatorFrontend::prepareToStop
void prepareToStop(StopReason reason)
Definition: SimulatorFrontend.cc:1331
TTAProgram::Program::finalize
void finalize()
Definition: Program.cc:1343
MachineState::registerFileState
RegisterFileState & registerFileState(const std::string &name)
Definition: MachineState.cc:213
TTAProgram::DataDefinition::MAU
virtual MinimumAddressableUnit MAU(int index) const
Definition: DataDefinition.cc:155
SimulatorFrontend::SIM_NORMAL
@ SIM_NORMAL
Default, interpreted simulation (debugging engine).
Definition: SimulatorFrontend.hh:102