OpenASIP
2.0
|
#include <SimulatorFrontend.hh>
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... | |
Protected Types | |
typedef std::pair< RuntimeErrorSeverity, std::string > | ProgramErrorDescription |
A type for storing a program error description. More... | |
typedef std::vector< ProgramErrorDescription > | ProgramErrorDescriptionList |
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::Machine * | currentMachine_ |
Machine to run simulation with. More... | |
TTASimulationController * | simCon_ |
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::Program * | currentProgram_ |
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... | |
POMDisassembler * | disassembler_ |
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... | |
StopPointManager * | stopPointManager_ |
The breakpoint manager to be used to bookkeep breakpoints. More... | |
std::vector< UtilizationStats * > | utilizationStats_ |
Processor utilization statistics. More... | |
TPEF::Binary * | tpef_ |
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... | |
SimulationEventHandler * | eventHandler_ |
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) |
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.
|
protected |
A type for storing a program error description.
Definition at line 288 of file SimulatorFrontend.hh.
|
protected |
Container for simulated program error descriptions.
Definition at line 290 of file SimulatorFrontend.hh.
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.
Which type of simulation this SimulatorFrontend controls or connects to.
Definition at line 101 of file SimulatorFrontend.hh.
SimulatorFrontend::SimulatorFrontend | ( | SimulationType | backendType = SIM_NORMAL | ) |
Constructor.
Definition at line 120 of file SimulatorFrontend.cc.
References SimulatorTextGenerator::generateCompiledSimTexts(), setCompiledSimulation(), setFUResourceConflictDetection(), SIM_COMPILED, and SimulatorToolbox::textGenerator().
|
virtual |
Destructor.
Definition at line 149 of file SimulatorFrontend.cc.
References clearProgramErrorReports(), currentMachine_, currentProgram_, SequenceTools::deleteAllItems(), disassembler_, eventHandler_, finishSimulation(), machineOwnedByFrontend_, memorySystems_, programFileName_, programOwnedByFrontend_, simCon_, stopPointManager_, and tpef_.
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.
Definition at line 2230 of file SimulatorFrontend.cc.
References TTASimulationController::automaticFinishImpossible(), and simCon_.
Referenced by ProgCommand::execute().
bool SimulatorFrontend::busTracing | ( | ) | const |
Returns true in case bus tracing is enabled.
Definition at line 1808 of file SimulatorFrontend.cc.
References busTracing_.
Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().
|
inline |
Definition at line 267 of file SimulatorFrontend.hh.
References callHistoryLength_.
Referenced by BackTraceCommand::execute().
const CallPathTracker & SimulatorFrontend::callPathTracker | ( | int | core = -1 | ) | const |
Definition at line 2393 of file SimulatorFrontend.cc.
References assert, callPathTrackers_, and selectedCore().
Referenced by BackTraceCommand::execute().
void SimulatorFrontend::clearProgramErrorReports | ( | ) |
Clears the runtime error report list.
Definition at line 2360 of file SimulatorFrontend.cc.
References programErrorReports_.
Referenced by ProximRuntimeErrorHandler::handleEvent(), RuntimeErrorReporter::handleEvent(), and ~SimulatorFrontend().
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.
other | A frontend to the other engine to compare this one to. |
differences | An optional output stream where to output information of the possible differences. |
Definition at line 2415 of file SimulatorFrontend.cc.
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().
const Procedure & SimulatorFrontend::currentProcedure | ( | ) | const |
Returns the current procedure.
The current procedure is expected to be the nearest procedure behind the program counter.
Definition at line 1210 of file SimulatorFrontend.cc.
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().
ClockCycleCount SimulatorFrontend::cycleCount | ( | ) | const |
Returns the current count of simulated cycles.
Definition at line 1194 of file SimulatorFrontend.cc.
References assert, TTASimulationController::clockCount(), and simCon_.
Referenced by compareState(), SimpleSimulatorFrontend::cycleCount(), ProximBusDetailsCmd::Do(), ProximSocketDetailsCmd::Do(), InfoProcCommand::execute(), finishSimulation(), ProcedureTransferTracker::handleEvent(), BusTracker::handleEvent(), RuntimeErrorReporter::handleEvent(), Watch::isTriggered(), DisasmExecPercentageAttrProvider::moveCellAttr(), ProximStopDialog::onUpdate(), ProximMachineStateWindow::setUtilizationHighlights(), DesignSpaceExplorer::simulate(), startTimer(), stopTimer(), tandemSimulate(), and ProximMainFrame::updateSimulationStatus().
std::string SimulatorFrontend::disassembleInstruction | ( | UIntWord | instructionAddress | ) | const |
Returns the disassembly of instruction at given address.
instructionAddress | Address (index) of the instruction wanted to disassemble. |
Definition at line 1073 of file SimulatorFrontend.cc.
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().
SimulationEventHandler & SimulatorFrontend::eventHandler | ( | ) |
Returns the instance of SimulationEventHandler.
Definition at line 2260 of file SimulatorFrontend.cc.
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().
const ExecutableInstruction & SimulatorFrontend::executableInstructionAt | ( | InstructionAddress | address | ) | const |
Returns reference to the instruction at given address.
Definition at line 2208 of file SimulatorFrontend.cc.
References assert, InstructionMemory::instructionAtConst(), and simCon_.
Referenced by DisasmExecPercentageAttrProvider::moveCellAttr(), DisasmTopCountAttrProvider::moveCellAttr(), DesignSpaceExplorer::simulate(), and DisasmTopCountAttrProvider::updateTopCountTable().
bool SimulatorFrontend::executionTracing | ( | ) | const |
Returns true in case execution tracing is enabled.
Definition at line 1798 of file SimulatorFrontend.cc.
References executionTracing_.
Referenced by SimulatorSettingsDialog::onOK(), CompiledSimController::reset(), and SimulatorSettingsDialog::TransferDataToWindow().
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.
InstanceNotFound | If bool register cannot be found. |
Definition at line 709 of file SimulatorFrontend.cc.
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().
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}.
fuName | The name of the operation or the function unit. |
portName | The name of the operand or the port. |
InstanceNotFound | If the register cannot be found. |
Definition at line 819 of file SimulatorFrontend.cc.
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().
StateData & SimulatorFrontend::findRegister | ( | const std::string & | rfName, |
int | registerIndex | ||
) |
Finds the state connected to a register.
rfName | The name of the register file. |
registerIndex | Index of the register in the register file. |
InstanceNotFound | If the register cannot be found. |
Definition at line 785 of file SimulatorFrontend.cc.
References __func__, assert, currentMachine_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), machineState(), TTAMachine::Machine::registerFileNavigator(), MachineState::registerFileState(), and RegisterFileState::registerState().
Referenced by SimulationController::registerFileValue().
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.
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().
|
inline |
Definition at line 178 of file SimulatorFrontend.hh.
References forcedTraceDBFileName_.
Referenced by DesignSpaceExplorer::simulate().
|
virtual |
Returns the current value of a FU port
fuName | name of the function unit |
portName | name of the FU port |
Definition at line 767 of file SimulatorFrontend.cc.
References assert, currentMachine_, TTASimulationController::FUPortValue(), and simCon_.
Referenced by compareState(), and InfoPortsCommand::execute().
bool SimulatorFrontend::fuResourceConflictDetection | ( | ) | const |
Returns true if FU resource conflict detection is on, false if not.
Definition at line 2032 of file SimulatorFrontend.cc.
References fuResourceConflictDetection_.
Referenced by SimulatorSettingsDialog::onOK(), CompiledSimController::reset(), and SimulatorSettingsDialog::TransferDataToWindow().
bool SimulatorFrontend::hasSimulationEnded | ( | ) | const |
Returns true if the simulation has ended, that is, the last instruction have been executed.
Definition at line 1283 of file SimulatorFrontend.cc.
References simCon_, TTASimulationController::STA_FINISHED, and TTASimulationController::state().
Referenced by ProximKillCmd::isEnabled(), SimpleSimulatorFrontend::isFinished(), programLocationDescription(), ProximBreakpointWindow::ProximBreakpointWindow(), ProximPortWindow::ProximPortWindow(), ProximRegisterWindow::ProximRegisterWindow(), ProximBreakpointWindow::refreshStopPoints(), SimpleSimulatorFrontend::step(), tandemSimulate(), timeoutThread(), and ProximMainFrame::updateSimulationStatus().
|
protected |
Helper function which tells whether simulation has stopped because of the given reason.
Definition at line 1369 of file SimulatorFrontend.cc.
References simCon_, stopReason(), and stopReasonCount().
Referenced by stoppedByUser().
|
virtual |
Returns the current value of a IU register
iuName | name of the immediate unit |
index | index of the register |
Definition at line 752 of file SimulatorFrontend.cc.
References assert, currentMachine_, TTASimulationController::immediateUnitRegisterValue(), and simCon_.
void SimulatorFrontend::initializeDataMemories | ( | const TTAMachine::AddressSpace * | onlyOne = NULL | ) |
Resets and writes initial data to the memory system stored in simulation controller from loaded TPEF.
onlyOne | initialize 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.
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().
|
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.
References currentMachine_, currentProgram_, POMDisassembler::disassembler(), and disassembler_.
Referenced by disassembleInstruction(), and programLocationDescription().
|
protected |
Initializes the memory system according to the address spaces in the loaded machine.
Definition at line 1699 of file SimulatorFrontend.cc.
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().
|
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.
Exception | There 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.
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().
|
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.
IOException | In case trace database file could not be accessed. |
Definition at line 1414 of file SimulatorFrontend.cc.
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().
bool SimulatorFrontend::isCompiledSimulation | ( | ) | const |
Returns true if the current simulation engine uses compiled simulation
Definition at line 1295 of file SimulatorFrontend.cc.
References currentBackend_, and SIM_COMPILED.
Referenced by loadMachine(), loadProgram(), SimulatorCLI::SimulatorCLI(), and utilizationStatistics().
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.
Definition at line 1317 of file SimulatorFrontend.cc.
References currentBackend_, and SIM_CUSTOM.
bool SimulatorFrontend::isMachineLoaded | ( | ) | const |
Returns true if a machine has been loaded for the simulation
Definition at line 1250 of file SimulatorFrontend.cc.
References currentMachine_.
Referenced by setupCallHistoryTracking().
bool SimulatorFrontend::isProgramLoaded | ( | ) | const |
Returns true if the simulation has been initialized with a program successfully.
Definition at line 1240 of file SimulatorFrontend.cc.
References currentProgram_, and simCon_.
Referenced by DisasmExecPercentageAttrProvider::moveCellAttr().
bool SimulatorFrontend::isSimulationInitialized | ( | ) | const |
Returns true if the simulation initialized and ready to run.
Definition at line 1228 of file SimulatorFrontend.cc.
References simCon_, TTASimulationController::STA_INITIALIZED, and TTASimulationController::state().
Referenced by ProximFindCmd::Do(), ProximRunCmd::isEnabled(), ProximStepICmd::isEnabled(), ProximNextICmd::isEnabled(), SimpleSimulatorFrontend::isInitialized(), ProximBreakpointWindow::onAddBreakpoint(), ProximBreakpointWindow::onAddWatch(), ProximBreakpointWindow::ProximBreakpointWindow(), ProximPortWindow::ProximPortWindow(), ProximRegisterWindow::ProximRegisterWindow(), ProximBreakpointWindow::refreshStopPoints(), tandemSimulate(), and ProximMainFrame::updateSimulationStatus().
bool SimulatorFrontend::isSimulationRunning | ( | ) | const |
Returns true if the simulation is running.
Definition at line 1260 of file SimulatorFrontend.cc.
References simCon_, TTASimulationController::STA_RUNNING, and TTASimulationController::state().
Referenced by ProximFindCmd::Do(), ProximQuitCmd::Do(), ProximSimulationThread::finishSimulation(), ProximSimulationThread::isBusy(), ProximKillCmd::isEnabled(), SimpleSimulatorFrontend::isRunning(), ProximSimulationThread::killSimulation(), ProximBreakpointWindow::onAddBreakpoint(), ProximBreakpointWindow::onAddWatch(), ProximStopDialog::onUpdate(), prepareToStop(), ProximBreakpointWindow::ProximBreakpointWindow(), ProximBreakpointWindow::refreshStopPoints(), TracedSimulatorFrontend::step(), and ProximMainFrame::updateSimulationStatus().
bool SimulatorFrontend::isSimulationStopped | ( | ) | const |
Returns true if the simulation is stopped.
Definition at line 1271 of file SimulatorFrontend.cc.
References simCon_, TTASimulationController::STA_STOPPED, and TTASimulationController::state().
Referenced by ProximFindCmd::Do(), ProximQuitCmd::Do(), ProximKillCmd::isEnabled(), ProximStepICmd::isEnabled(), ProximNextICmd::isEnabled(), ProximResumeCmd::isEnabled(), SimpleSimulatorFrontend::isStopped(), ProximBreakpointWindow::onAddBreakpoint(), ProximBreakpointWindow::onAddWatch(), ProximBreakpointWindow::ProximBreakpointWindow(), ProximPortWindow::ProximPortWindow(), ProximRegisterWindow::ProximRegisterWindow(), ProximBreakpointWindow::refreshStopPoints(), ProximSimulationThread::requestStop(), and ProximMainFrame::updateSimulationStatus().
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.
Definition at line 1306 of file SimulatorFrontend.cc.
References currentBackend_, and SIM_REMOTE.
|
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.
References finishSimulation(), initializeDataMemories(), initializeTracing(), lastRunCycleCount_, TTASimulationController::reset(), and simCon_.
Referenced by KillCommand::execute(), TracedSimulatorFrontend::killSimulation(), and DesignSpaceExplorer::simulate().
const ExecutableInstruction & SimulatorFrontend::lastExecInstruction | ( | ) | const |
Returns a reference to the last executed instruction.
Definition at line 2194 of file SimulatorFrontend.cc.
References assert, InstructionMemory::instructionAtConst(), lastExecutedInstruction(), and simCon_.
Referenced by ProximMachineStateWindow::addMoves().
|
virtual |
Returns the address of the last executed instruction.
coreId | Look at the given processor core. If -1, the currently selected core will be used. |
Definition at line 1182 of file SimulatorFrontend.cc.
References assert, TTASimulationController::lastExecutedInstruction(), and simCon_.
Referenced by ProximMachineStateWindow::addMoves(), ProcedureTransferTracker::handleEvent(), RFAccessTracker::handleEvent(), RuntimeErrorReporter::handleEvent(), and lastExecInstruction().
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.
Definition at line 2276 of file SimulatorFrontend.cc.
References lastRunCycleCount_.
Referenced by SimControlLanguageCommand::printSimulationTime().
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.
Definition at line 2289 of file SimulatorFrontend.cc.
References lastRunTime_.
Referenced by SimControlLanguageCommand::printSimulationTime().
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.
Definition at line 2243 of file SimulatorFrontend.cc.
References selectedCore(), traceDBOwned_, and traceDBs_.
Referenced by DesignSpaceExplorer::simulate().
|
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.
fileName | The name of the ADF file to be loaded. |
FileNotFound | If the file cannot be found. |
SimulationStillRunning | If an old simulation is still running. |
IllegalMachine | If the ADF was erroneus. |
Reimplemented in TracedSimulatorFrontend.
Definition at line 534 of file SimulatorFrontend.cc.
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().
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.
program | The machine to be loaded. |
Definition at line 227 of file SimulatorFrontend.cc.
References TTAMachine::Machine::controlUnit(), currentMachine_, currentProgram_, SequenceTools::deleteAllItems(), finishSimulation(), TTAMachine::ControlUnit::globalGuardLatency(), initializeMemorySystem(), TTAMachine::Machine::is64bit(), isCompiledSimulation(), machine(), machineOwnedByFrontend_, memorySystems_, programOwnedByFrontend_, setCompiledSimulation(), and simCon_.
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.
fileName | The name of the PCF to be loaded. |
FileNotFound | If the file cannot be found. |
SimulationStillRunning | If an old simulation is still running. |
IllegalMachine | If the ADF was erroneus. |
Definition at line 600 of file SimulatorFrontend.cc.
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().
|
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.
fileName | The name of the TPEF file to be loaded. |
FileNotFound | If the file cannot be found. |
SimulationStillRunning | If an old simulation is still running. |
IllegalProgram | If the TPEF was erroneus or the program invalid. |
Exception | Any exception thrown while building the simulation models are passed on. |
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.
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().
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.
program | The program to be loaded. |
IOException | If tracing is enabled and could not be initialized. |
Exception | Any exception thrown while building the simulation models are passed on. |
Throw when machine is not loaded.
Implement checking for already running simulation.
Definition at line 198 of file SimulatorFrontend.cc.
References __func__, currentMachine_, currentProgram_, initializeDataMemories(), initializeSimulation(), initializeTracing(), program(), and programOwnedByFrontend_.
const Machine & SimulatorFrontend::machine | ( | ) | const |
Returns a read-only reference to the currently loaded machine.
Definition at line 263 of file SimulatorFrontend.cc.
References currentMachine_.
Referenced by compareState(), InfoImmediatesCommand::execute(), InfoRegFilesCommand::execute(), InfoIunitsCommand::execute(), InfoBussesCommand::execute(), InfoPortsCommand::execute(), InfoSegmentsCommand::execute(), InfoFunitsCommand::execute(), InfoProcCommand::execute(), InfoStatsCommand::execute(), finishSimulation(), ProcedureTransferTracker::handleEvent(), BusTracker::handleEvent(), initializeMemorySystem(), TracedSimulatorFrontend::loadMachine(), loadMachine(), ProximToolbox::machine(), SimpleSimulatorFrontend::machine(), ProximMachineStateWindow::onProgramLoaded(), ProximPortWindow::reinitialize(), ProximRegisterWindow::reinitialize(), ProximPortWindow::update(), and ProximRegisterWindow::update().
MachineState & SimulatorFrontend::machineState | ( | int | core = -1 | ) |
Returns a reference to the state model of the currently loaded machine.
Definition at line 2138 of file SimulatorFrontend.cc.
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().
bool SimulatorFrontend::memoryAccessTracking | ( | ) | const |
Returns true if memory access tracking is enabled.
Definition at line 2057 of file SimulatorFrontend.cc.
References memoryAccessTracking_.
MemorySystem & SimulatorFrontend::memorySystem | ( | int | coreId = -1 | ) |
Returns the memory system of the currently loaded machine.
Asserts if no simulation is initialized.
Definition at line 2121 of file SimulatorFrontend.cc.
References memorySystems_, and selectedCore().
Referenced by OTASimulationController::advanceMachineCycle(), MemDumpCommand::execute(), initializeDataMemories(), ProximMemoryWindow::loadMemory(), ProximMemoryWindow::loadProgramMemory(), SimpleSimulatorFrontend::memorySystem(), TTASimulationController::memorySystem(), ProximMemoryWindow::onASChoice(), ProximMemoryWindow::onSimulationStop(), setControllerForMemories(), SimControlLanguageCommand::setMemoryPointer(), SimulationController::simulateCycle(), and SimulationController::SimulationController().
|
virtual |
Advance simulation by a given amout of steps and skip procedure calls.
count | The number of steps the simulation is advanced. |
SimulationExecutionError | If a runtime error occurs in the simulated program. |
Reimplemented in TracedSimulatorFrontend.
Definition at line 1052 of file SimulatorFrontend.cc.
References assert, SequenceTools::deleteAllItems(), TTASimulationController::next(), simCon_, simulationTimeout_, startTimer(), stopTimer(), timeoutThread, and utilizationStats_.
Referenced by NextiCommand::execute(), and TracedSimulatorFrontend::next().
bool SimulatorFrontend::nextInstructionPrinting | ( | ) | const |
Returns true if the next simulated instruction will be printed to the simulator console at simulation stop.
Definition at line 2080 of file SimulatorFrontend.cc.
References printNextInstruction_.
Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().
std::ostream & SimulatorFrontend::outputStream | ( | ) |
Returns the output stream
Definition at line 1987 of file SimulatorFrontend.cc.
References assert, and outputStream_.
Referenced by loadProgram().
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.
reason | The reason for stopping. |
Definition at line 1331 of file SimulatorFrontend.cc.
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().
bool SimulatorFrontend::procedureTransferTracing | ( | ) | const |
Returns true in case procedure transfer tracing is enabled.
Definition at line 1827 of file SimulatorFrontend.cc.
References procedureTransferTracing_.
Referenced by SimulatorSettingsDialog::onOK(), CompiledSimController::reset(), and SimulatorSettingsDialog::TransferDataToWindow().
bool SimulatorFrontend::profileDataSaving | ( | ) | const |
Returns true in case profile data saving is enabled.
Definition at line 1837 of file SimulatorFrontend.cc.
References saveProfileData_.
Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().
const Program & SimulatorFrontend::program | ( | ) | const |
Returns a read-only reference to the currently loaded program.
Definition at line 276 of file SimulatorFrontend.cc.
References currentProgram_.
Referenced by ProximMachineStateWindow::addMoves(), compareState(), BackTraceCommand::execute(), DisassembleCommand::execute(), SymbolAddressCommand::execute(), ProcedureTransferTracker::handleEvent(), RFAccessTracker::handleEvent(), TracedSimulatorFrontend::loadProgram(), loadProgram(), DisasmExecPercentageAttrProvider::moveCellAttr(), SimControlLanguageCommand::parseDataAddressExpression(), SimControlLanguageCommand::parseInstructionAddressExpression(), ProximToolbox::program(), SimpleSimulatorFrontend::program(), DisasmTopCountAttrProvider::updateTopCountTable(), and utilizationStatistics().
InstructionAddress SimulatorFrontend::programCounter | ( | ) | const |
Returns the program counter value.
Definition at line 1169 of file SimulatorFrontend.cc.
References assert, TTASimulationController::programCounter(), and simCon_.
Referenced by compareState(), currentProcedure(), InfoProgramCommand::execute(), RuntimeErrorReporter::handleEvent(), Breakpoint::isTriggered(), SimControlLanguageCommand::parseInstructionAddressExpression(), and programLocationDescription().
std::string SimulatorFrontend::programErrorReport | ( | RuntimeErrorSeverity | severity, |
std::size_t | index | ||
) |
Returns a program error report with given severity and index.
severity | Severity. |
index | Index. |
Definition at line 2321 of file SimulatorFrontend.cc.
References programErrorReports_.
Referenced by ProximRuntimeErrorHandler::handleEvent(), and RuntimeErrorReporter::handleEvent().
std::size_t SimulatorFrontend::programErrorReportCount | ( | RuntimeErrorSeverity | severity | ) |
Returns the count of program error reports with given severity.
severity | The error report severity interested in. |
Definition at line 2344 of file SimulatorFrontend.cc.
References programErrorReports_.
Referenced by ProximRuntimeErrorHandler::handleEvent(), and RuntimeErrorReporter::handleEvent().
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.
Definition at line 1108 of file SimulatorFrontend.cc.
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().
|
virtual |
Returns a string containing the value(s) of the register file
rfName | name of the register file to search for |
registerIndex | index of the register. if -1, all registers are listed |
InstanceNotFound | If the register cannot be found. |
Definition at line 738 of file SimulatorFrontend.cc.
References TTASimulationController::registerFileValue(), and simCon_.
Referenced by compareState().
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.
eventHandler | Simulation event handler for the error |
severity | Severity classification of the runtime error. |
description | Textual description of the error. |
Definition at line 2304 of file SimulatorFrontend.cc.
References eventHandler(), Informer::handleEvent(), programErrorReports_, and SimulationEventHandler::SE_RUNTIME_ERROR.
Referenced by SigFPEHandler::execute(), SigSegvHandler::execute(), OTASimulationController::simulateCycle(), and SimulationController::simulateCycle().
bool SimulatorFrontend::rfAccessTracing | ( | ) | const |
Returns true in case register file access tracing is enabled.
Definition at line 1818 of file SimulatorFrontend.cc.
References rfAccessTracing_.
Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().
const RFAccessTracker & SimulatorFrontend::rfAccessTracker | ( | ) | const |
Returns the register file access tracker.
InstanceNotFound | If RF access tracking is not enabled. |
Definition at line 1869 of file SimulatorFrontend.cc.
References __func__, and rfAccessTrackers_.
Referenced by InfoProcCommand::execute(), and finishSimulation().
|
virtual |
Run simulation until it's stopped for some reason.
SimulationExecutionError | If a runtime error occurs in the simulated program. |
Reimplemented in TracedSimulatorFrontend.
Definition at line 997 of file SimulatorFrontend.cc.
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().
|
virtual |
Run simulation until given address.
SimulationExecutionError | If a runtime error occurs in the simulated program. |
Reimplemented in TracedSimulatorFrontend.
Definition at line 1014 of file SimulatorFrontend.cc.
References SequenceTools::deleteAllItems(), TTASimulationController::runUntil(), simCon_, simulationTimeout_, startTimer(), stopTimer(), timeoutThread, and utilizationStats_.
Referenced by UntilCommand::execute(), and TracedSimulatorFrontend::runUntil().
|
inline |
Definition at line 260 of file SimulatorFrontend.hh.
References abortWithError.
Referenced by SimulationController::simulateCycle(), and SimulationController::SimulationController().
|
inline |
Definition at line 257 of file SimulatorFrontend.hh.
Referenced by callPathTracker(), SimulationController::instructionMemory(), TTASimulationController::lastExecutedInstruction(), lastTraceDB(), SimulationController::machineState(), memorySystem(), SimulationController::programCounter(), SimulationController::selectedInstructionMemory(), SimulationController::selectedMachineState(), and utilizationStatistics().
void SimulatorFrontend::setBusTracing | ( | bool | value | ) |
Sets the bus tracing on or off.
value | Is bus tracing enabled or not. |
Definition at line 1910 of file SimulatorFrontend.cc.
References busTracing_.
Referenced by SetBusTrace::execute().
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.
References callHistoryLength_, and setupCallHistoryTracking().
Referenced by SetCallHistoryLength::execute().
void SimulatorFrontend::setCompiledSimulation | ( | bool | value | ) |
Sets compiled simulation on or off
value | Is compiled simulation enabled or not. |
Definition at line 1883 of file SimulatorFrontend.cc.
References currentBackend_, SIM_COMPILED, SIM_CUSTOM, SIM_NORMAL, and SIM_REMOTE.
Referenced by loadMachine(), loadProgram(), and SimulatorFrontend().
|
inline |
Definition at line 157 of file SimulatorFrontend.hh.
References leaveCompiledDirty_.
Referenced by tandemSimulate().
|
protected |
Definition at line 634 of file SimulatorFrontend.cc.
References assert, MemorySystem::memory(), MemorySystem::memoryCount(), and memorySystem().
Referenced by initializeSimulation().
|
inline |
Definition at line 238 of file SimulatorFrontend.hh.
References detailedSimulation_.
Referenced by SimpleSimulatorFrontend::SimpleSimulatorFrontend().
void SimulatorFrontend::setExecutionTracing | ( | bool | value | ) |
Sets the execution tracing on or off.
value | Is execution tracing enabled or not. |
Definition at line 1900 of file SimulatorFrontend.cc.
References executionTracing_.
Referenced by SetExecutionTrace::execute(), and DesignSpaceExplorer::simulate().
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.
value | Should the resource conflict detection be used. |
Definition at line 2022 of file SimulatorFrontend.cc.
References fuResourceConflictDetection_.
Referenced by CompiledSimSetFUConflictDetection::execute(), SetFUConflictDetection::execute(), and SimulatorFrontend().
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.
value | Should the memory access tracking be used. |
Definition at line 2047 of file SimulatorFrontend.cc.
References memoryAccessTracking_.
Referenced by SetMemoryAccessTracking::execute().
void SimulatorFrontend::setNextInstructionPrinting | ( | bool | value | ) |
Sets the printing of the next simulated instruction to the console.
The instruction is printed when stopping simulation.
value | True if the instruction should be printed. |
Definition at line 2069 of file SimulatorFrontend.cc.
References printNextInstruction_.
Referenced by SetNextInstructionPrinting::execute().
void SimulatorFrontend::setOutputStream | ( | std::ostream & | stream | ) |
Sets the default output stream
stream | the output stream |
Definition at line 1998 of file SimulatorFrontend.cc.
References outputStream_.
void SimulatorFrontend::setProcedureTransferTracing | ( | bool | value | ) |
Sets the procedure transfer tracing on or off.
value | Is procedure transfer tracing on or off. |
Definition at line 1930 of file SimulatorFrontend.cc.
References procedureTransferTracing_.
Referenced by SetProcedureTransferTracing::execute().
void SimulatorFrontend::setProfileDataSaving | ( | bool | value | ) |
Sets the profile saving on or off.
value | Is profile saving on or off. |
Definition at line 1940 of file SimulatorFrontend.cc.
References saveProfileData_.
Referenced by SetProfileSaving::execute().
void SimulatorFrontend::setRFAccessTracing | ( | bool | value | ) |
Sets the register file access tracing on or off.
value | Is register file access tracing enabled or not. |
Definition at line 1920 of file SimulatorFrontend.cc.
References rfAccessTracing_.
Referenced by SetRFTracking::execute(), and DesignSpaceExplorer::simulate().
void SimulatorFrontend::setSimulationTimeStatistics | ( | bool | value | ) |
Sets the printing of simulation time statistics
value | True if the statistics should be printed out |
Definition at line 2088 of file SimulatorFrontend.cc.
References printSimulationTimeStatistics_.
Referenced by SetSimulationTimeStatistics::execute().
void SimulatorFrontend::setStaticCompilation | ( | bool | value | ) |
Sets the compiled simulator to use static or dynamic compilation.
Has no effect when running interpretive simulation.
value | new value to be set |
Definition at line 1977 of file SimulatorFrontend.cc.
References staticCompilation_.
Referenced by SetStaticCompilation::execute(), and tandemSimulate().
void SimulatorFrontend::setTimeout | ( | unsigned int | value | ) |
Sets the simulation timeout in seconds. Use zero for no timeout.
value | Simulation timeout in seconds. |
Definition at line 1965 of file SimulatorFrontend.cc.
References simulationTimeout_.
Referenced by SetSimulationTimeout::execute(), and DesignSpaceExplorer::simulate().
|
protected |
Definition at line 2378 of file SimulatorFrontend.cc.
References callHistoryLength_, callPathTrackers_, SequenceTools::deleteAllItems(), and isMachineLoaded().
Referenced by initializeTracing(), and setCallHistoryLength().
void SimulatorFrontend::setUtilizationDataSaving | ( | bool | value | ) |
Sets the utilization data saving on or off.
value | Is utilization data saving on or off. |
Definition at line 2008 of file SimulatorFrontend.cc.
References saveUtilizationData_.
Referenced by SetUtilizationSaving::execute(), and DesignSpaceExplorer::simulate().
|
inline |
Definition at line 235 of file SimulatorFrontend.hh.
References zeroFillMemoriesOnReset_.
Referenced by SimpleSimulatorFrontend::SimpleSimulatorFrontend().
bool SimulatorFrontend::simulationTimeStatistics | ( | ) | const |
Returns true if the time statistics are to be printed after a command
Definition at line 2097 of file SimulatorFrontend.cc.
References printSimulationTimeStatistics_.
Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().
|
protected |
Starts the wall-clock timer.
Definition at line 928 of file SimulatorFrontend.cc.
References cycleCount(), startCycleCount_, and startTime_.
Referenced by next(), run(), and runUntil().
StateData & SimulatorFrontend::state | ( | std::string | searchString | ) |
Tries to locate a readable machine state part using a search string.
See stateValue() for further comment.
searchString | The string to use in search, e.g., (alu.p3 or add.3). |
InstanceNotFound | In case state couldn't be found using the search string. |
Definition at line 894 of file SimulatorFrontend.cc.
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().
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.
searchString | The string to use in search, e.g., (alu.p3). |
InstanceNotFound | In case state couldn't be found using the search string. |
Definition at line 878 of file SimulatorFrontend.cc.
References state(), and ReadableState::value().
bool SimulatorFrontend::staticCompilation | ( | ) | const |
Returns true if the compiled simulation uses static compilation
Definition at line 1857 of file SimulatorFrontend.cc.
References staticCompilation_.
Referenced by CompiledSimController::reset().
|
virtual |
Advance simulation by a given amout of cycles.
SimulationExecutionError | If a runtime error occurs in the simulated program. |
Reimplemented in TracedSimulatorFrontend.
Definition at line 1034 of file SimulatorFrontend.cc.
References assert, SequenceTools::deleteAllItems(), simCon_, TTASimulationController::step(), and utilizationStats_.
Referenced by StepiCommand::execute(), TracedSimulatorFrontend::step(), SimpleSimulatorFrontend::step(), and tandemSimulate().
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.
true | If simulation stopped because of user set stop point. |
Definition at line 1394 of file SimulatorFrontend.cc.
References hasStopReason(), simCon_, SRE_BREAKPOINT, SRE_RUNTIME_ERROR, and SRE_USER_REQUESTED.
StopPointManager & SimulatorFrontend::stopPointManager | ( | ) |
Returns the StopPointManager.
Asserts if no StopPointManager is initiated.
Definition at line 2108 of file SimulatorFrontend.cc.
References assert, and stopPointManager_.
Referenced by BPCommand::execute(), WatchCommand::execute(), ConditionCommand::execute(), DisableBPCommand::execute(), EnableBPCommand::execute(), DeleteBPCommand::execute(), IgnoreCommand::execute(), TBPCommand::execute(), InfoBreakpointsCommand::execute(), ProximDisassemblyWindow::loadProgram(), ProximDisassemblyWindow::onRightClick(), SimControlLanguageCommand::printBreakpointInfo(), SimControlLanguageCommand::printStopReasons(), ProximBreakpointWindow::refreshStopPoints(), and SimControlLanguageCommand::verifyBreakpointHandles().
StopReason SimulatorFrontend::stopReason | ( | unsigned int | index | ) | const |
Returns the stop reason with the given index.
index | The wanted index. |
OutOfRange | If the given index is out of range. |
Definition at line 1356 of file SimulatorFrontend.cc.
References assert, simCon_, and TTASimulationController::stopReason().
Referenced by SimpleSimulatorFrontend::hadRuntimeError(), hasStopReason(), SimControlLanguageCommand::printStopReasons(), and tandemSimulate().
unsigned int SimulatorFrontend::stopReasonCount | ( | ) | const |
Returns the count of stop reasons.
Definition at line 1344 of file SimulatorFrontend.cc.
References simCon_, and TTASimulationController::stopReasonCount().
Referenced by SimpleSimulatorFrontend::hadRuntimeError(), hasStopReason(), SimControlLanguageCommand::printStopReasons(), and tandemSimulate().
|
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.
References cycleCount(), lastRunCycleCount_, lastRunTime_, startCycleCount_, and startTime_.
Referenced by next(), run(), and runUntil().
bool SimulatorFrontend::utilizationDataSaving | ( | ) | const |
Returns true in case utilization data saving is enabled.
Definition at line 1847 of file SimulatorFrontend.cc.
References saveUtilizationData_.
Referenced by SimulatorSettingsDialog::onOK(), and SimulatorSettingsDialog::TransferDataToWindow().
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!
Definition at line 2155 of file SimulatorFrontend.cc.
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().
|
friend |
A thread function for handling simulation timeout
timeout | timeout in seconds |
Definition at line 951 of file SimulatorFrontend.cc.
Referenced by next(), run(), and runUntil().
|
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().
|
protected |
The tracker for saving bus trace.
Definition at line 336 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), and initializeTracing().
|
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().
|
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().
|
protected |
Type of "backend" this Frontend has.
Definition at line 307 of file SimulatorFrontend.hh.
Referenced by initializeMemorySystem(), initializeSimulation(), isCompiledSimulation(), isCustomDebugger(), isTCEDebugger(), and setCompiledSimulation().
|
protected |
Machine to run simulation with.
Definition at line 293 of file SimulatorFrontend.hh.
Referenced by findBooleanRegister(), findPort(), findRegister(), FUPortValue(), immediateUnitRegisterValue(), initializeDisassembler(), initializeMemorySystem(), initializeSimulation(), isMachineLoaded(), loadMachine(), loadProgram(), machine(), state(), and ~SimulatorFrontend().
|
protected |
Program to be simulated.
Definition at line 300 of file SimulatorFrontend.hh.
Referenced by currentProcedure(), disassembleInstruction(), finishSimulation(), initializeDataMemories(), initializeDisassembler(), initializeSimulation(), isProgramLoaded(), loadMachine(), loadProgram(), program(), programLocationDescription(), utilizationStatistics(), and ~SimulatorFrontend().
|
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().
|
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().
|
protected |
Per simulation instance of SimulationEventHandler.
Definition at line 371 of file SimulatorFrontend.hh.
Referenced by eventHandler(), and ~SimulatorFrontend().
|
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().
|
protected |
The simple execution tracker for storing trace of executed instructions.
Definition at line 333 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), and initializeTracing().
|
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().
|
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().
|
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().
|
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().
|
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().
|
protected |
Is the machine owned by SimulatorFrontend or by the client?
Definition at line 298 of file SimulatorFrontend.hh.
Referenced by loadMachine(), and ~SimulatorFrontend().
|
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().
|
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().
|
protected |
Default output stream.
Definition at line 365 of file SimulatorFrontend.hh.
Referenced by outputStream(), and setOutputStream().
|
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().
|
protected |
True if the simulation time statistics should be printed out.
Definition at line 359 of file SimulatorFrontend.hh.
Referenced by setSimulationTimeStatistics(), and simulationTimeStatistics().
|
protected |
Is procedure transfer access tracking enabled.
Definition at line 320 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), initializeTracing(), procedureTransferTracing(), and setProcedureTransferTracing().
|
protected |
The procedure transfer tracker.
Definition at line 342 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), and initializeTracing().
|
protected |
Runtime error reports.
Definition at line 385 of file SimulatorFrontend.hh.
Referenced by clearProgramErrorReports(), programErrorReport(), programErrorReportCount(), and reportSimulatedProgramError().
|
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().
|
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().
|
protected |
Is register file (concurrent) access tracking enabled.
Definition at line 318 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), initializeTracing(), rfAccessTracing(), and setRFAccessTracing().
|
protected |
The register file access tracker.
Definition at line 339 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), initializeTracing(), and rfAccessTracker().
|
protected |
Is saving of profile data to TraceDB enabled.
Definition at line 322 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), initializeTracing(), profileDataSaving(), and setProfileDataSaving().
|
protected |
Is saving of utilization data to TraceDB enabled.
Definition at line 324 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), initializeTracing(), setUtilizationDataSaving(), and utilizationDataSaving().
|
protected |
If simulation is initialized, this contains a pointer to the simulation controller.
Definition at line 296 of file SimulatorFrontend.hh.
Referenced by automaticFinishImpossible(), currentProcedure(), cycleCount(), executableInstructionAt(), finishSimulation(), FUPortValue(), hasSimulationEnded(), hasStopReason(), immediateUnitRegisterValue(), initializeDataMemories(), initializeSimulation(), initializeTracing(), isProgramLoaded(), isSimulationInitialized(), isSimulationRunning(), isSimulationStopped(), killSimulation(), lastExecInstruction(), lastExecutedInstruction(), loadMachine(), loadProgram(), machineState(), next(), prepareToStop(), programCounter(), registerFileValue(), run(), runUntil(), step(), stoppedByUser(), stopReason(), stopReasonCount(), timeoutThread(), utilizationStatistics(), and ~SimulatorFrontend().
|
protected |
Simulation timeout in seconds.
Definition at line 383 of file SimulatorFrontend.hh.
Referenced by next(), run(), runUntil(), and setTimeout().
|
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().
|
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().
|
protected |
True if the compiled simulation should use static compilation.
Definition at line 361 of file SimulatorFrontend.hh.
Referenced by setStaticCompilation(), and staticCompilation().
|
protected |
The breakpoint manager to be used to bookkeep breakpoints.
Definition at line 345 of file SimulatorFrontend.hh.
Referenced by initializeSimulation(), stopPointManager(), and ~SimulatorFrontend().
|
protected |
The source TPEF file.
Definition at line 351 of file SimulatorFrontend.hh.
Referenced by initializeDataMemories(), loadProgram(), and ~SimulatorFrontend().
|
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().
|
protected |
The database to use for execution trace data.
Definition at line 326 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), initializeTracing(), and lastTraceDB().
|
protected |
Flag that indicates is the trace file name set by user.
Definition at line 363 of file SimulatorFrontend.hh.
|
protected |
Processor utilization statistics.
Definition at line 348 of file SimulatorFrontend.hh.
Referenced by finishSimulation(), next(), run(), runUntil(), step(), and utilizationStatistics().
|
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().