OpenASIP  2.0
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. More...
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

 SimulationController (const SimulationController &)
 Copying not allowed. More...
 
SimulationControlleroperator= (const SimulationController &)
 Assignment not allowed. More...
 
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. More...
 
std::vector< FUResourceConflictDetector * > conflictDetectorVector_
 Resource conflict detectors in a more quickly traversed container. More...
 
std::vector< InstructionAddresstmpExecutedInstructions_
 Temporary place for lastExecuted Instruction. More...
 

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);
102  MachineState* machineState = NULL;
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 }

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

◆ 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 }

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 }

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 }

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 }

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 {
466  Machine::RegisterFileNavigator navigator =
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 }

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 }

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

Advance simulation until given address is reached.

Parameters
addressThe instruction address to reach.
Exceptions
SimulationExecutionErrorIf a runtime error occurs in the simulated program.

Implements TTASimulationController.

Definition at line 369 of file SimulationController.cc.

369  {
370  stopRequested_ = false;
371  stopReasons_.clear();
373 
374  while (!stopRequested_) {
375  simulateCycle();
376 
377  if (state_ == STA_FINISHED)
378  return;
379 
380  if (selectedMachineState().gcuState().programCounter() == address) {
385  return;
386  }
387  }
388 
389  if (state_ != STA_FINISHED) {
391  }
392 
395 }

References SimulatorFrontend::eventHandler(), TTASimulationController::frontend_, Informer::handleEvent(), TTASimulationController::prepareToStop(), programCounter(), SimulationEventHandler::SE_SIMULATION_STOPPED, selectedMachineState(), simulateCycle(), 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:

◆ 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  {
550  return *machineStates_.at(frontend_.selectedCore());
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 
175  GCUState& gcu = machineState->gcuState();
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 }

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_, TTASimulationController::memorySystem(), SimulatorFrontend::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_) {
273  simulateCycle();
274  ++counter;
275  }
276 
277  if (counter == count) {
279  }
280 
281  if (state_ != STA_FINISHED)
283 
286 }

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:
TTASimulationController::memorySystem
virtual MemorySystem & memorySystem(int coreId=-1)
Definition: TTASimulationController.cc:171
FUResourceConflictDetector::isIdle
virtual bool isIdle()
Definition: FUResourceConflictDetector.cc:104
ExecutableInstruction
Definition: ExecutableInstruction.hh:49
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ExecutableInstruction::execute
void execute()
TTASimulationController::STA_STOPPED
@ STA_STOPPED
Simulation stopped for some reason.
Definition: TTASimulationController.hh:76
TTASimulationController::stopReasons_
StopReasonContainer stopReasons_
The set of reasons the simulation was stopped.
Definition: TTASimulationController.hh:144
GCUState
Definition: GCUState.hh:46
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
SimulationController::findExitPoints
void findExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine)
Definition: SimulationController.cc:398
SimulatorFrontend::selectCore
void selectCore(int core)
Definition: SimulatorFrontend.hh:260
FUState::endClock
virtual void endClock()
Definition: FUState.cc:122
SimulationEventHandler::SE_SIMULATION_STOPPED
@ SE_SIMULATION_STOPPED
Generated after simulation has stopped, temporarily or permantently, and control is being returned to...
Definition: SimulationEventHandler.hh:54
TTASimulationController::TTASimulationController
TTASimulationController(SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program)
Definition: TTASimulationController.cc:60
MachineState::gcuState
GCUState & gcuState()
Definition: MachineState.cc:103
FUConflictDetectorIndex
std::map< std::string, FUResourceConflictDetector * > FUConflictDetectorIndex
Definition: FUConflictDetectorIndex.hh:45
MachineState::clearBuses
void clearBuses()
MachineState::advanceClockOfAllLongImmediateUnitStates
void advanceClockOfAllLongImmediateUnitStates()
GCUState::programCounter
InstructionAddress & programCounter()
OperationContext::setCycleCountVariable
void setCycleCountVariable(CycleCount &cycleCount)
Definition: OperationContext.cc:300
MachineState::setFinished
void setFinished(bool finished=true)
Definition: MachineState.hh:106
TTASimulationController::prepareToStop
virtual void prepareToStop(StopReason reason)
Definition: TTASimulationController.cc:90
MachineState::endClockOfAllFUStates
void endClockOfAllFUStates()
TTAMachine::Machine::Navigator::count
int count() const
InstructionMemory
Definition: InstructionMemory.hh:54
Conversion::toString
static std::string toString(const T &source)
TTASimulationController::initialPC_
InstructionAddress initialPC_
The address of the first executed instruction.
Definition: TTASimulationController.hh:153
MachineState::FUStateCount
int FUStateCount() const
SimValue
Definition: SimValue.hh:96
SimulationController::buildFUResourceConflictDetectors
void buildFUResourceConflictDetectors(const TTAMachine::Machine &machine)
Definition: SimulationController.cc:522
SimulatorFrontend::selectedCore
int selectedCore() const
Definition: SimulatorFrontend.hh:257
TTAMachine::BaseRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
MemorySystem::advanceClockOfLocalMemories
void advanceClockOfLocalMemories()
TTASimulationController::STA_RUNNING
@ STA_RUNNING
A run command (run, stepi, until...) given.
Definition: TTASimulationController.hh:75
FUState
Definition: FUState.hh:58
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
SimulationController::programCounter
virtual InstructionAddress programCounter() const
Definition: SimulationController.cc:444
TTAProgram::Program::instructionAt
Instruction & instructionAt(InstructionAddress address) const
Definition: Program.cc:374
MachineState::advanceClockOfAllFUStates
void advanceClockOfAllFUStates()
TTASimulationController::state_
SimulationStatus state_
The current state of the simulation.
Definition: TTASimulationController.hh:147
SimulatorFrontend::findRegister
StateData & findRegister(const std::string &rfName, int registerIndex)
Definition: SimulatorFrontend.cc:785
TTASimulationController::frontend_
SimulatorFrontend & frontend_
Reference to the simulator frontend.
Definition: TTASimulationController.hh:135
SimulationController::selectedMachineState
MachineState & selectedMachineState()
Definition: SimulationController.cc:549
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
SimulationController::instructionMemories_
std::vector< InstructionMemory * > instructionMemories_
The instruction memory models of cores.
Definition: SimulationController.hh:92
MachineState
Definition: MachineState.hh:61
MemorySystem::advanceClockOfSharedMemories
void advanceClockOfSharedMemories()
FUResourceConflictDetector
Definition: FUResourceConflictDetector.hh:45
SimProgramBuilder::build
InstructionMemory * build(const TTAProgram::Program &prog, MachineState &state)
Definition: SimProgramBuilder.cc:472
TTASimulationController::STA_INITIALIZED
@ STA_INITIALIZED
Simulation initialized and ready to run.
Definition: TTASimulationController.hh:74
TTASimulationController::findProgramExitPoints
virtual std::set< InstructionAddress > findProgramExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine) const
Definition: TTASimulationController.cc:209
TTASimulationController::STA_FINISHED
@ STA_FINISHED
Simulation ended after executing the last instruction.
Definition: TTASimulationController.hh:77
SimulationEventHandler::SE_CYCLE_END
@ SE_CYCLE_END
Generated before advancing the simulator clock at the end of a simulation cycle.
Definition: SimulationEventHandler.hh:50
TTASimulationController::sourceMachine_
const TTAMachine::Machine & sourceMachine_
The simulated Machine Object Model.
Definition: TTASimulationController.hh:137
TTAProgram::Instruction::parent
CodeSnippet & parent() const
Definition: Instruction.cc:109
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
TTASimulationController::lastExecutedInstruction_
std::vector< InstructionAddress > lastExecutedInstruction_
The address of the last executed instruction.
Definition: TTASimulationController.hh:151
TTASimulationController::stopRequested_
bool stopRequested_
Flag indicating that simulation should stop.
Definition: TTASimulationController.hh:142
MachineStateBuilder
Definition: MachineStateBuilder.hh:62
SRE_RUNTIME_ERROR
@ SRE_RUNTIME_ERROR
A fatal runtime error occured in the simulated program.
Definition: SimulatorConstants.hh:68
SimulatorFrontend::RES_FATAL
@ RES_FATAL
Fatal runtime error, there is a serious error in the simulated program, thus it makes no sense to go ...
Definition: SimulatorFrontend.hh:95
FUState::isIdle
bool isIdle()
Exception
Definition: Exception.hh:54
GCUState::advanceClock
virtual void advanceClock()
Definition: GCUState.cc:98
SimulationController::conflictDetectorVector_
std::vector< FUResourceConflictDetector * > conflictDetectorVector_
Resource conflict detectors in a more quickly traversed container.
Definition: SimulationController.hh:112
SimProgramBuilder
Definition: SimProgramBuilder.hh:62
MemorySystem
Definition: MemorySystem.hh:55
TTASimulationController::STA_INITIALIZING
@ STA_INITIALIZING
Simulation is being initialized.
Definition: TTASimulationController.hh:73
SimulationController::simulateCycle
virtual bool simulateCycle()
Definition: SimulationController.cc:158
SRE_AFTER_UNTIL
@ SRE_AFTER_UNTIL
Stopped after running to the wanted.
Definition: SimulatorConstants.hh:62
ExecutableInstruction::isExitPoint
bool isExitPoint() const
TTASimulationController::frontend
virtual SimulatorFrontend & frontend()
Definition: TTASimulationController.cc:181
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTASimulationController::clockCount_
ClockCycleCount clockCount_
How many clock cycles have been simulated.
Definition: TTASimulationController.hh:149
SimValue::hexValue
TCEString hexValue(bool noHexIdentifier=false) const
Definition: SimValue.cc:1150
SimulationController::fuConflictDetectors_
MultiCoreFUConflictDetectorIndex fuConflictDetectors_
The FU resource conflict detectors used to detect conflicts during simulation.
Definition: SimulationController.hh:110
TTASimulationController::firstIllegalInstructionIndex_
InstructionAddress firstIllegalInstructionIndex_
The index of the first illegal instruction in the instruction sequence.
Definition: TTASimulationController.hh:158
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
SimulatorFrontend::memorySystem
MemorySystem & memorySystem(int coreId=-1)
Definition: SimulatorFrontend.cc:2121
SimulatorFrontend::eventHandler
SimulationEventHandler & eventHandler()
Definition: SimulatorFrontend.cc:2260
MachineState::fuState
FUState & fuState(const std::string &name)
Definition: MachineState.cc:133
SRE_AFTER_STEPPING
@ SRE_AFTER_STEPPING
Stopped after stepping the given count.
Definition: SimulatorConstants.hh:61
FSAFUResourceConflictDetector
Definition: FSAFUResourceConflictDetector.hh:49
ReadableState::value
virtual const SimValue & value() const =0
FUResourceConflictDetector::advanceClock
virtual void advanceClock()
Definition: FUResourceConflictDetector.cc:86
SimulationController::machineStates_
MachineStateContainer machineStates_
The machine state models for the simulated cores.
Definition: SimulationController.hh:90
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
SimulationController::instructionMemory
virtual const InstructionMemory & instructionMemory(int core=-1) const
Definition: SimulationController.cc:543
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
Informer::handleEvent
void handleEvent(int event)
SimulationController::machineState
virtual MachineState & machineState(int core=-1)
Definition: SimulationController.cc:145
SimulatorFrontend::reportSimulatedProgramError
void reportSimulatedProgramError(RuntimeErrorSeverity severity, const std::string &description)
Definition: SimulatorFrontend.cc:2304
MachineState::advanceClockOfAllGuardStates
void advanceClockOfAllGuardStates()
TTASimulationController::program_
const TTAProgram::Program & program_
Program object model of the simulated program.
Definition: TTASimulationController.hh:139
TTAProgram::Procedure
Definition: Procedure.hh:55
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
SimulationController::reset
virtual void reset()
Definition: SimulationController.cc:421
SimulationController::tmpExecutedInstructions_
std::vector< InstructionAddress > tmpExecutedInstructions_
Temporary place for lastExecuted Instruction.
Definition: SimulationController.hh:114
MachineState::isFinished
bool isFinished() const
Definition: MachineState.hh:105
SimulationEventHandler::SE_NEW_INSTRUCTION
@ SE_NEW_INSTRUCTION
Generated before executing a new instructon.
Definition: SimulationEventHandler.hh:48
FUState::context
virtual OperationContext & context()
Definition: FUState.cc:376