91 bool fuResourceConflictDetection,
92 bool detailedSimulation) :
94 tmpExecutedInstructions_(1) {
96 if (fuResourceConflictDetection)
99 for (
int i = 0; i < 1; ++i) {
104 if (fuResourceConflictDetection) {
121 for (
int i = 0; i < 1; ++i) {
165 unsigned finishedCoreCount = 0;
166 bool finished =
false;
167 for (
int core = 0; core < 1; ++core) {
223 if (finishedCoreCount == 1)
233 for (std::size_t i = 0; i < conflictDetectorVectorSize; ++i) {
277 if (counter == count) {
302 bool inCalledProcedure =
false;
303 const Procedure& procedureWhereStartedStepping =
322 (&procedureWhereStartedStepping != ¤tProcedure);
328 if (counter == count && !inCalledProcedure) {
402 std::set<InstructionAddress> exitPoints_ =
405 for (std::set<InstructionAddress>::iterator it = exitPoints_.begin();
406 it != exitPoints_.end(); ++it) {
428 for (
int core = 0; core < 1; ++core) {
458 const std::string& rfName,
int registerIndex) {
460 std::string stringValue(
"");
462 if (registerIndex >= 0) {
470 bool firstReg =
true;
474 const std::string registerName =
478 stringValue += registerName +
" " + value.
hexValue();
496 const std::string& iuName,
int index) {
499 registerValue(index);
511 const std::string& fuName,
const std::string& portName) {
526 for (
int core = 0; core < 1; ++core) {
532 for (
int i = 0; i < nav.
count(); ++i) {
#define assert(condition)
UInt32 InstructionAddress
TTAMachine::Machine * machine
the architecture definition of the estimated processor
std::map< std::string, FUResourceConflictDetector * > FUConflictDetectorIndex
find Finds info of the inner loops in the program
@ SRE_AFTER_UNTIL
Stopped after running to the wanted.
@ SRE_AFTER_STEPPING
Stopped after stepping the given count.
@ SRE_RUNTIME_ERROR
A fatal runtime error occured in the simulated program.
static std::string toString(const T &source)
std::string errorMessage() const
virtual void advanceClock()
virtual OperationContext & context()
virtual void advanceClock()
InstructionAddress & programCounter()
MachineState * build(const TTAMachine::Machine &machine, MemorySystem &memSys)
void advanceClockOfAllLongImmediateUnitStates()
FUState & fuState(const std::string &name)
void endClockOfAllFUStates()
void advanceClockOfAllFUStates()
void advanceClockOfAllGuardStates()
void setFinished(bool finished=true)
void advanceClockOfSharedMemories()
void advanceClockOfLocalMemories()
void setCycleCountVariable(CycleCount &cycleCount)
virtual const SimValue & value() const =0
InstructionMemory * build(const TTAProgram::Program &prog, MachineState &state)
TCEString hexValue(bool noHexIdentifier=false) const
std::vector< FUResourceConflictDetector * > conflictDetectorVector_
Resource conflict detectors in a more quickly traversed container.
void findExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine)
MachineStateContainer machineStates_
The machine state models for the simulated cores.
InstructionMemory & selectedInstructionMemory()
virtual void runUntil(UIntWord address)
virtual SimValue immediateUnitRegisterValue(const std::string &iuName, int index=-1)
std::vector< InstructionAddress > tmpExecutedInstructions_
Temporary place for lastExecuted Instruction.
virtual ~SimulationController()
virtual void next(int count=1)
virtual void step(double count=1)
virtual const InstructionMemory & instructionMemory(int core=-1) const
MachineState & selectedMachineState()
virtual std::string registerFileValue(const std::string &rfName, int registerIndex=-1)
virtual InstructionAddress programCounter() const
std::vector< InstructionMemory * > instructionMemories_
The instruction memory models of cores.
virtual bool simulateCycle()
virtual MachineState & machineState(int core=-1)
void buildFUResourceConflictDetectors(const TTAMachine::Machine &machine)
SimulationController(SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program, bool fuResourceConflictDetection=true, bool detailedSimulation=false)
MultiCoreFUConflictDetectorIndex fuConflictDetectors_
The FU resource conflict detectors used to detect conflicts during simulation.
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)
@ SE_NEW_INSTRUCTION
Generated before executing a new instructon.
@ SE_CYCLE_END
Generated before advancing the simulator clock at the end of a simulation cycle.
@ SE_SIMULATION_STOPPED
Generated after simulation has stopped, temporarily or permantently, and control is being returned to...
SimulationEventHandler & eventHandler()
void reportSimulatedProgramError(RuntimeErrorSeverity severity, const std::string &description)
@ RES_FATAL
Fatal runtime error, there is a serious error in the simulated program, thus it makes no sense to go ...
void selectCore(int core)
StateData & findRegister(const std::string &rfName, int registerIndex)
MemorySystem & memorySystem(int coreId=-1)
virtual int numberOfRegisters() const
virtual TCEString name() const
ComponentType * item(int index) const
virtual RegisterFileNavigator registerFileNavigator() const
virtual FunctionUnitNavigator functionUnitNavigator() const
CodeSnippet & parent() const
Instruction & instructionAt(InstructionAddress address) const
InstructionAddress initialPC_
The address of the first executed instruction.
StopReasonContainer stopReasons_
The set of reasons the simulation was stopped.
const TTAMachine::Machine & sourceMachine_
The simulated Machine Object Model.
std::vector< InstructionAddress > lastExecutedInstruction_
The address of the last executed instruction.
bool stopRequested_
Flag indicating that simulation should stop.
virtual void prepareToStop(StopReason reason)
@ STA_FINISHED
Simulation ended after executing the last instruction.
@ STA_INITIALIZING
Simulation is being initialized.
@ STA_RUNNING
A run command (run, stepi, until...) given.
@ STA_STOPPED
Simulation stopped for some reason.
@ STA_INITIALIZED
Simulation initialized and ready to run.
virtual SimulatorFrontend & frontend()
virtual std::set< InstructionAddress > findProgramExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine) const
InstructionAddress firstIllegalInstructionIndex_
The index of the first illegal instruction in the instruction sequence.
const TTAProgram::Program & program_
Program object model of the simulated program.
SimulationStatus state_
The current state of the simulation.
ClockCycleCount clockCount_
How many clock cycles have been simulated.
SimulatorFrontend & frontend_
Reference to the simulator frontend.
virtual MemorySystem & memorySystem(int coreId=-1)