OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
SimulationController Class Reference

#include <SimulationController.hh>

Inheritance diagram for SimulationController:
Inheritance graph
Collaboration diagram for SimulationController:
Collaboration graph

Public Member Functions

 SimulationController (SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program, bool fuResourceConflictDetection=true, bool detailedSimulation=false)
 
virtual ~SimulationController ()
 
virtual void step (double count=1)
 
virtual void next (int count=1)
 
virtual void run ()
 
virtual void runUntil (UIntWord address)
 
virtual void reset ()
 
virtual InstructionAddress programCounter () const
 
virtual MachineStatemachineState (int core=-1)
 
virtual const InstructionMemoryinstructionMemory (int core=-1) 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)
 
- Public Member Functions inherited from TTASimulationController
 TTASimulationController (SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program)
 
virtual ~TTASimulationController ()
 
virtual void prepareToStop (StopReason reason)
 
virtual unsigned int stopReasonCount () const
 
virtual StopReason stopReason (unsigned int index) const
 
virtual SimulationStatus state () const
 
virtual InstructionAddress lastExecutedInstruction (int coreId=-1) const
 
virtual ClockCycleCount clockCount () const
 
virtual MemorySystemmemorySystem (int coreId=-1)
 
virtual SimulatorFrontendfrontend ()
 
virtual bool automaticFinishImpossible () const
 
virtual std::set< InstructionAddressfindProgramExitPoints (const TTAProgram::Program &program, const TTAMachine::Machine &machine) const
 

Protected Types

typedef std::vector< MachineState * > MachineStateContainer
 
- Protected Types inherited from TTASimulationController
typedef std::set< StopReasonStopReasonContainer
 The container type for reasons why simulation stop was requested.
 

Protected Member Functions

virtual bool simulateCycle ()
 
- Protected Member Functions inherited from TTASimulationController
 TTASimulationController (const TTASimulationController &)
 Copying not allowed.
 
TTASimulationControlleroperator= (const TTASimulationController &)
 Assignment not allowed.
 

Protected Attributes

MachineStateContainer machineStates_
 The machine state models for the simulated cores.
 
std::vector< InstructionMemory * > instructionMemories_
 The instruction memory models of cores.
 
- Protected Attributes inherited from TTASimulationController
SimulatorFrontendfrontend_
 Reference to the simulator frontend.
 
const TTAMachine::MachinesourceMachine_
 The simulated Machine Object Model.
 
const TTAProgram::Programprogram_
 Program object model of the simulated program.
 
bool stopRequested_
 Flag indicating that simulation should stop.
 
StopReasonContainer stopReasons_
 The set of reasons the simulation was stopped.
 
SimulationStatus state_
 The current state of the simulation.
 
ClockCycleCount clockCount_
 How many clock cycles have been simulated.
 
std::vector< InstructionAddresslastExecutedInstruction_
 The address of the last executed instruction.
 
InstructionAddress initialPC_
 The address of the first executed instruction.
 
bool automaticFinishImpossible_
 If this is true, simulation cannot be finished automatically.
 
InstructionAddress firstIllegalInstructionIndex_
 The index of the first illegal instruction in the instruction sequence.
 

Private Member Functions

 SimulationController (const SimulationController &)
 Copying not allowed.
 
SimulationControlleroperator= (const SimulationController &)
 Assignment not allowed.
 
void buildFUResourceConflictDetectors (const TTAMachine::Machine &machine)
 
void findExitPoints (const TTAProgram::Program &program, const TTAMachine::Machine &machine)
 
MachineStateselectedMachineState ()
 
InstructionMemoryselectedInstructionMemory ()
 

Private Attributes

MultiCoreFUConflictDetectorIndex fuConflictDetectors_
 The FU resource conflict detectors used to detect conflicts during simulation.
 
std::vector< FUResourceConflictDetector * > conflictDetectorVector_
 Resource conflict detectors in a more quickly traversed container.
 
std::vector< InstructionAddresstmpExecutedInstructions_
 Temporary place for lastExecuted Instruction.
 

Additional Inherited Members

- Public Types inherited from TTASimulationController
enum  SimulationStatus {
  STA_INITIALIZING , STA_INITIALIZED , STA_RUNNING , STA_STOPPED ,
  STA_FINISHED
}
 The states of simulation. More...
 

Detailed Description

Controls the simulation running in stand-alone mode.

Supports also homogeneous multicore simulation when ADF's core-count > 1.

Owns and is the main client of the machine state model.

Definition at line 46 of file SimulationController.hh.

Member Typedef Documentation

◆ MachineStateContainer

Definition at line 87 of file SimulationController.hh.

Constructor & Destructor Documentation

◆ SimulationController() [1/2]

SimulationController::SimulationController ( SimulatorFrontend frontend,
const TTAMachine::Machine machine,
const TTAProgram::Program program,
bool  fuResourceConflictDetection = true,
bool  detailedSimulation = false 
)

Constructor.

Parameters
machineMachine to be simulated.
memSysMemory system.
fuResourceConflictDetectionShould the model detect FU resource conflicts.
Exceptions
ExceptionExceptions while building the simulation models are thrown forward.

Definition at line 87 of file SimulationController.cc.

92 :
95
96 if (fuResourceConflictDetection)
98
99 for (int i = 0; i < 1; ++i) {
101 MachineStateBuilder builder(detailedSimulation);
103
104 if (fuResourceConflictDetection) {
105 machineState = builder.build(
107 } else {
108 machineState = builder.build(machine, frontend.memorySystem(i));
109 }
110 // set the real time clock source to be the simulation
111 // cycle counter
112 for (int i = 0; i < machineState->FUStateCount(); ++i) {
113 FUState& fuState = machineState->fuState(i);
115 }
116 machineStates_.push_back(machineState);
117 }
119
120 SimProgramBuilder programBuilder;
121 for (int i = 0; i < 1; ++i) {
123 programBuilder.build(program, *machineStates_[i]);
125 }
126
128 reset();
129}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
find Finds info of the inner loops in the program
virtual OperationContext & context()
Definition FUState.cc:376
FUState & fuState(const std::string &name)
int FUStateCount() const
void setCycleCountVariable(CycleCount &cycleCount)
InstructionMemory * build(const TTAProgram::Program &prog, MachineState &state)
void findExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine)
MachineStateContainer machineStates_
The machine state models for the simulated cores.
std::vector< InstructionAddress > tmpExecutedInstructions_
Temporary place for lastExecuted Instruction.
virtual const InstructionMemory & instructionMemory(int core=-1) const
std::vector< InstructionMemory * > instructionMemories_
The instruction memory models of cores.
virtual MachineState & machineState(int core=-1)
void buildFUResourceConflictDetectors(const TTAMachine::Machine &machine)
MultiCoreFUConflictDetectorIndex fuConflictDetectors_
The FU resource conflict detectors used to detect conflicts during simulation.
void selectCore(int core)
MemorySystem & memorySystem(int coreId=-1)
virtual SimulatorFrontend & frontend()
ClockCycleCount clockCount_
How many clock cycles have been simulated.
SimulatorFrontend & frontend_
Reference to the simulator frontend.

References MachineStateBuilder::build(), SimProgramBuilder::build(), buildFUResourceConflictDetectors(), TTASimulationController::clockCount_, FUState::context(), findExitPoints(), TTASimulationController::frontend(), TTASimulationController::frontend_, fuConflictDetectors_, MachineState::fuState(), MachineState::FUStateCount(), instructionMemories_, instructionMemory(), machine, machineState(), machineStates_, SimulatorFrontend::memorySystem(), program, reset(), SimulatorFrontend::selectCore(), and OperationContext::setCycleCountVariable().

Here is the call graph for this function:

◆ ~SimulationController()

SimulationController::~SimulationController ( )
virtual

Destructor.

Definition at line 134 of file SimulationController.cc.

134 {
135
139}
static void deleteAllItems(SequenceType &aSequence)
std::vector< FUResourceConflictDetector * > conflictDetectorVector_
Resource conflict detectors in a more quickly traversed container.

References conflictDetectorVector_, SequenceTools::deleteAllItems(), instructionMemories_, and machineStates_.

Here is the call graph for this function:

◆ SimulationController() [2/2]

SimulationController::SimulationController ( const SimulationController )
private

Copying not allowed.

Member Function Documentation

◆ buildFUResourceConflictDetectors()

void SimulationController::buildFUResourceConflictDetectors ( const TTAMachine::Machine machine)
private

Builds the FU resource conflict detectors for each FU in the machine.

Uses the "lazy FSA" detection model.

Definition at line 522 of file SimulationController.cc.

523 {
524
525
526 for (int core = 0; core < 1; ++core) {
529
531
532 for (int i = 0; i < nav.count(); ++i) {
533 const TTAMachine::FunctionUnit& fu = *nav.item(i);
534 FUResourceConflictDetector* detector =
536 fuConflictDetectors_[core][fu.name()] = detector;
537 conflictDetectorVector_.push_back(detector);
538 }
539 }
540}
std::map< std::string, FUResourceConflictDetector * > FUConflictDetectorIndex
virtual TCEString name() const
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380

References conflictDetectorVector_, TTAMachine::Machine::Navigator< ComponentType >::count(), fuConflictDetectors_, TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, and TTAMachine::Component::name().

Referenced by SimulationController().

Here is the call graph for this function:

◆ findExitPoints()

void SimulationController::findExitPoints ( const TTAProgram::Program program,
const TTAMachine::Machine machine 
)
private

Definition at line 398 of file SimulationController.cc.

400 {
401
402 std::set<InstructionAddress> exitPoints_ =
404
405 for (std::set<InstructionAddress>::iterator it = exitPoints_.begin();
406 it != exitPoints_.end(); ++it) {
407 for (std::size_t i = 0; i < instructionMemories_.size(); ++i) {
408 instructionMemories_[i]->instructionAt(*it).setExitPoint(true);
409 }
410 }
411}
virtual std::set< InstructionAddress > findProgramExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine) const

References TTASimulationController::findProgramExitPoints(), instructionMemories_, machine, and program.

Referenced by SimulationController().

Here is the call graph for this function:

◆ FUPortValue()

SimValue SimulationController::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

Implements TTASimulationController.

Definition at line 510 of file SimulationController.cc.

511 {
512
513 return (selectedMachineState().portState(portName, fuName)).value();
514}
MachineState & selectedMachineState()

References selectedMachineState().

Here is the call graph for this function:

◆ immediateUnitRegisterValue()

SimValue SimulationController::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

Implements TTASimulationController.

Definition at line 495 of file SimulationController.cc.

496 {
497
498 return (selectedMachineState().longImmediateUnitState(iuName)).
499 registerValue(index);
500}

References selectedMachineState().

Here is the call graph for this function:

◆ instructionMemory()

const InstructionMemory & SimulationController::instructionMemory ( int  core = -1) const
virtual

Definition at line 543 of file SimulationController.cc.

543 {
544 if (core == -1) core = frontend_.selectedCore();
545 return *instructionMemories_.at(core);
546}

References TTASimulationController::frontend_, instructionMemories_, and SimulatorFrontend::selectedCore().

Referenced by SimulationController().

Here is the call graph for this function:

◆ machineState()

MachineState & SimulationController::machineState ( int  core = -1)
virtual

Returns a reference to the currently selected machine state model.

Definition at line 145 of file SimulationController.cc.

145 {
146 if (core == -1) core = frontend_.selectedCore();
147 return *machineStates_.at(core);
148}

References TTASimulationController::frontend_, machineStates_, and SimulatorFrontend::selectedCore().

Referenced by OTASimulationController::advanceMachineCycle(), SimulatorFrontend::machineState(), OTASimulationController::simulateCycle(), simulateCycle(), and SimulationController().

Here is the call graph for this function:

◆ next()

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

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

Parameters
countNumber of steps to simulate.
Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.

Implements TTASimulationController.

Definition at line 297 of file SimulationController.cc.

297 {
298 stopRequested_ = false;
299 stopReasons_.clear();
301
302 bool inCalledProcedure = false;
303 const Procedure& procedureWhereStartedStepping =
304 dynamic_cast<const Procedure&>(
306
307 int counter = 0;
308 while (!stopRequested_ && counter < count) {
309
310 // simulate cycles until we come back to the procedure we started
311 // simulating from or until the program ends
312 do {
313 const bool programEnded = !simulateCycle();
314
315 if (programEnded) {
317 } else {
318 const Procedure& currentProcedure =
319 dynamic_cast<const Procedure&>(
321 inCalledProcedure =
322 (&procedureWhereStartedStepping != &currentProcedure);
323 }
324 } while (inCalledProcedure && !stopRequested_);
325 ++counter;
326 }
327
328 if (counter == count && !inCalledProcedure) {
330 }
331
332 if (state_ != STA_FINISHED)
334
337}
@ SRE_AFTER_UNTIL
Stopped after running to the wanted.
@ SRE_AFTER_STEPPING
Stopped after stepping the given count.
void handleEvent(int event)
virtual InstructionAddress programCounter() const
@ SE_SIMULATION_STOPPED
Generated after simulation has stopped, temporarily or permantently, and control is being returned to...
SimulationEventHandler & eventHandler()
CodeSnippet & parent() const
Instruction & instructionAt(InstructionAddress address) const
Definition Program.cc:374
StopReasonContainer stopReasons_
The set of reasons the simulation was stopped.
bool stopRequested_
Flag indicating that simulation should stop.
virtual void prepareToStop(StopReason reason)
@ STA_FINISHED
Simulation ended after executing the last instruction.
@ STA_RUNNING
A run command (run, stepi, until...) given.
@ STA_STOPPED
Simulation stopped for some reason.
const TTAProgram::Program & program_
Program object model of the simulated program.
SimulationStatus state_
The current state of the simulation.

References SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), TTAProgram::Program::instructionAt(), TTAProgram::Instruction::parent(), TTASimulationController::prepareToStop(), TTASimulationController::program_, programCounter(), SimulationEventHandler::SE_SIMULATION_STOPPED, simulateCycle(), SRE_AFTER_STEPPING, SRE_AFTER_UNTIL, TTASimulationController::STA_FINISHED, TTASimulationController::STA_RUNNING, TTASimulationController::STA_STOPPED, TTASimulationController::state_, TTASimulationController::stopReasons_, and TTASimulationController::stopRequested_.

Here is the call graph for this function:

◆ operator=()

SimulationController & SimulationController::operator= ( const SimulationController )
private

Assignment not allowed.

◆ programCounter()

InstructionAddress SimulationController::programCounter ( ) const
virtual

Returns the program counter value of the currently selected core.

Implements TTASimulationController.

Definition at line 444 of file SimulationController.cc.

444 {
445 return machineStates_.at(frontend_.selectedCore())->gcuState().programCounter();
446}

References TTASimulationController::frontend_, machineStates_, and SimulatorFrontend::selectedCore().

Referenced by next(), and runUntil().

Here is the call graph for this function:

◆ registerFileValue()

std::string SimulationController::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.

Implements TTASimulationController.

Definition at line 457 of file SimulationController.cc.

458 {
459
460 std::string stringValue("");
461
462 if (registerIndex >= 0) {
463 stringValue += frontend_.findRegister(rfName, registerIndex).value().
464 hexValue();
465 } else {
468 RegisterFile& rf = *navigator.item(rfName);
469
470 bool firstReg = true;
471 for (int i = 0; i < rf.numberOfRegisters(); ++i) {
472 if (!firstReg)
473 stringValue += "\n";
474 const std::string registerName =
475 rfName + "." + Conversion::toString(i);
476
477 SimValue value = frontend_.findRegister(rfName, i).value();
478 stringValue += registerName + " " + value.hexValue();
479
480 firstReg = false;
481 }
482 }
483
484 return stringValue;
485}
static std::string toString(const T &source)
virtual const SimValue & value() const =0
TCEString hexValue(bool noHexIdentifier=false) const
Definition SimValue.cc:1150
StateData & findRegister(const std::string &rfName, int registerIndex)
virtual int numberOfRegisters() const
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
const TTAMachine::Machine & sourceMachine_
The simulated Machine Object Model.

References SimulatorFrontend::findRegister(), TTASimulationController::frontend_, SimValue::hexValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::registerFileNavigator(), TTASimulationController::sourceMachine_, Conversion::toString(), and ReadableState::value().

Here is the call graph for this function:

◆ reset()

void SimulationController::reset ( )
virtual

Resets the simulation so it can be started from the beginning.

Resets the program counter to its initial value, and also clears the instrution execution counts and states of possible FU resource conflict detectors.

Implements TTASimulationController.

Definition at line 421 of file SimulationController.cc.

421 {
422
424 stopRequested_ = false;
425 clockCount_ = 0;
427
428 for (int core = 0; core < 1; ++core) {
429 machineStates_.at(core)->gcuState().programCounter() = initialPC_;
430 machineStates_.at(core)->setFinished(false);
431 machineStates_.at(core)->resetAllFUs();
432 instructionMemories_.at(core)->resetExecutionCounts();
433 }
434
435 for (std::size_t vec = 0; vec < conflictDetectorVector_.size(); ++vec) {
436 conflictDetectorVector_.at(vec)->reset();
437 }
438}
InstructionAddress initialPC_
The address of the first executed instruction.
@ STA_INITIALIZING
Simulation is being initialized.
@ STA_INITIALIZED
Simulation initialized and ready to run.

References TTASimulationController::clockCount_, conflictDetectorVector_, TTASimulationController::initialPC_, instructionMemories_, machineStates_, TTASimulationController::STA_INITIALIZED, TTASimulationController::STA_INITIALIZING, TTASimulationController::state_, and TTASimulationController::stopRequested_.

Referenced by SimulationController().

◆ run()

void SimulationController::run ( )
virtual

◆ runUntil()

void SimulationController::runUntil ( UIntWord  address)
virtual

◆ selectedInstructionMemory()

InstructionMemory & SimulationController::selectedInstructionMemory ( )
private

Definition at line 554 of file SimulationController.cc.

554 {
556}

References TTASimulationController::frontend_, instructionMemories_, and SimulatorFrontend::selectedCore().

Here is the call graph for this function:

◆ selectedMachineState()

MachineState & SimulationController::selectedMachineState ( )
private

Definition at line 549 of file SimulationController.cc.

549 {
551}

References TTASimulationController::frontend_, machineStates_, and SimulatorFrontend::selectedCore().

Referenced by FUPortValue(), immediateUnitRegisterValue(), and runUntil().

Here is the call graph for this function:

◆ simulateCycle()

bool SimulationController::simulateCycle ( )
protectedvirtual

Simulates a cycle.

Returns
false in case there are no more instructions to execute, that is, the simulation ended sucessfully, true in case there are more instructions to execute.

Reimplemented in OTASimulationController.

Definition at line 158 of file SimulationController.cc.

158 {
159
161
162 // The number of cores that have reached the exit function,
163 // use this to stop automatically after all of them have
164 // called it.
165 unsigned finishedCoreCount = 0;
166 bool finished = false;
167 for (int core = 0; core < 1; ++core) {
169
170 if (machineState->isFinished()) {
171 ++finishedCoreCount;
172 continue;
173 }
174
176 const InstructionAddress& pc = gcu.programCounter();
177
179 try {
181
182 ExecutableInstruction* instruction =
183 &(instructionMemories_[core]->instructionAt(pc));
184
185 instruction->execute();
186
187 tmpExecutedInstructions_[core] = pc;
188
190
191 if (!gcu.isIdle()) {
192 gcu.endClock();
193 }
194
197
198 ++gcu.programCounter();
199 if (!gcu.isIdle())
200 gcu.advanceClock();
201
204
205 // check if the instruction was a return point from the program or
206 // the next executed instruction would be sequentially over the
207 // instruction space (PC+1 would overflow out of the program)
208 if (instruction->isExitPoint() ||
211 ++finishedCoreCount;
212 }
213 } catch (const Exception& e) {
214 frontend_.selectCore(core);
217 e.errorMessage());
219 return false;
220 }
221 }
222
223 if (finishedCoreCount == 1)
224 finished = true;
225
226 // assume all cores have identical memory systems, thus it's enough
227 // to advance the simulation clock only once for the first core's
228 // memory system's shared memory instance
230
231 // detect FU pipeline resource conflicts
232 size_t conflictDetectorVectorSize = conflictDetectorVector_.size();
233 for (std::size_t i = 0; i < conflictDetectorVectorSize; ++i) {
234 FUResourceConflictDetector& detector =
236 if (!detector.isIdle())
237 detector.advanceClock();
238 }
239
241
243
244 ++clockCount_;
245
246 if (finished) {
248 stopRequested_ = true;
249 return false;
250 }
251
254 return true;
255}
UInt32 InstructionAddress
Definition BaseType.hh:175
@ SRE_RUNTIME_ERROR
A fatal runtime error occured in the simulated program.
std::string errorMessage() const
Definition Exception.cc:123
bool isExitPoint() const
virtual void endClock()
Definition FUState.cc:122
bool isIdle()
virtual void advanceClock()
Definition GCUState.cc:98
InstructionAddress & programCounter()
void advanceClockOfAllLongImmediateUnitStates()
bool isFinished() const
void endClockOfAllFUStates()
void advanceClockOfAllFUStates()
void advanceClockOfAllGuardStates()
void clearBuses()
GCUState & gcuState()
void setFinished(bool finished=true)
void advanceClockOfSharedMemories()
void advanceClockOfLocalMemories()
@ 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.
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 ...
std::vector< InstructionAddress > lastExecutedInstruction_
The address of the last executed instruction.
InstructionAddress firstIllegalInstructionIndex_
The index of the first illegal instruction in the instruction sequence.
virtual MemorySystem & memorySystem(int coreId=-1)

References FUResourceConflictDetector::advanceClock(), GCUState::advanceClock(), MachineState::advanceClockOfAllFUStates(), MachineState::advanceClockOfAllGuardStates(), MachineState::advanceClockOfAllLongImmediateUnitStates(), MemorySystem::advanceClockOfLocalMemories(), MemorySystem::advanceClockOfSharedMemories(), MachineState::clearBuses(), TTASimulationController::clockCount_, conflictDetectorVector_, FUState::endClock(), MachineState::endClockOfAllFUStates(), Exception::errorMessage(), SimulatorFrontend::eventHandler(), ExecutableInstruction::execute(), TTASimulationController::firstIllegalInstructionIndex_, TTASimulationController::frontend_, MachineState::gcuState(), Informer::handleEvent(), instructionMemories_, ExecutableInstruction::isExitPoint(), MachineState::isFinished(), FUResourceConflictDetector::isIdle(), FUState::isIdle(), TTASimulationController::lastExecutedInstruction_, machineState(), machineStates_, SimulatorFrontend::memorySystem(), TTASimulationController::memorySystem(), TTASimulationController::prepareToStop(), GCUState::programCounter(), SimulatorFrontend::reportSimulatedProgramError(), SimulatorFrontend::RES_FATAL, SimulationEventHandler::SE_CYCLE_END, SimulationEventHandler::SE_NEW_INSTRUCTION, SimulatorFrontend::selectCore(), MachineState::setFinished(), SRE_RUNTIME_ERROR, TTASimulationController::STA_FINISHED, TTASimulationController::state_, TTASimulationController::stopRequested_, and tmpExecutedInstructions_.

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

Here is the call graph for this function:

◆ step()

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

Advance simulation by a given amout of cycles.

Parameters
countThe number of cycles the simulation is advanced.
Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.

Implements TTASimulationController.

Definition at line 265 of file SimulationController.cc.

265 {
267 stopReasons_.clear();
269 stopRequested_ = false;
270
271 double counter = 0;
272 while (counter < count && !stopRequested_) {
274 ++counter;
275 }
276
277 if (counter == count) {
279 }
280
281 if (state_ != STA_FINISHED)
283
286}
#define assert(condition)

References assert, SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), TTASimulationController::prepareToStop(), SimulationEventHandler::SE_SIMULATION_STOPPED, simulateCycle(), SRE_AFTER_STEPPING, TTASimulationController::STA_FINISHED, TTASimulationController::STA_INITIALIZED, TTASimulationController::STA_RUNNING, TTASimulationController::STA_STOPPED, TTASimulationController::state_, TTASimulationController::stopReasons_, and TTASimulationController::stopRequested_.

Here is the call graph for this function:

Member Data Documentation

◆ conflictDetectorVector_

std::vector<FUResourceConflictDetector*> SimulationController::conflictDetectorVector_
private

Resource conflict detectors in a more quickly traversed container.

Definition at line 112 of file SimulationController.hh.

Referenced by buildFUResourceConflictDetectors(), reset(), simulateCycle(), and ~SimulationController().

◆ fuConflictDetectors_

MultiCoreFUConflictDetectorIndex SimulationController::fuConflictDetectors_
private

The FU resource conflict detectors used to detect conflicts during simulation.

Definition at line 110 of file SimulationController.hh.

Referenced by buildFUResourceConflictDetectors(), and SimulationController().

◆ instructionMemories_

std::vector<InstructionMemory*> SimulationController::instructionMemories_
protected

◆ machineStates_

MachineStateContainer SimulationController::machineStates_
protected

◆ tmpExecutedInstructions_

std::vector<InstructionAddress> SimulationController::tmpExecutedInstructions_
private

Temporary place for lastExecuted Instruction.

Definition at line 114 of file SimulationController.hh.

Referenced by simulateCycle().


The documentation for this class was generated from the following files: