OpenASIP  2.0
CompiledSimulation.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file CompiledSimulation.cc
26  *
27  * Definition of CompiledSimulation class.
28  *
29  * @author Viljami Korhonen 2007 (viljami.korhonen-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2009 (pekka.jaaskelainen-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #include <string>
35 #include "CompiledSimulation.hh"
36 #include "Machine.hh"
37 #include "Instruction.hh"
38 #include "SimulatorFrontend.hh"
39 #include "CompiledSimController.hh"
42 #include "DirectAccessMemory.hh"
44 #include "ControlUnit.hh"
46 #include "CompiledSimCompiler.hh"
47 #include "PluginTools.hh"
48 #include "FileSystem.hh"
49 #include "Program.hh"
50 #include "Move.hh"
51 #include "MemorySystem.hh"
52 #include "Conversion.hh"
53 
54 using namespace TTAMachine;
55 using namespace TTAProgram;
56 
58  std::numeric_limits<ClockCycleCount>::max();
59 
60 /**
61  * The constructor
62  *
63  * Grabs all shared data from machine and program and saves them for
64  * easy access for later usage.
65  *
66  * @param machine The simulated machine
67  * @param program The simulated program
68  * @param frontend The simulation frontend
69  * @param memorySystem The memory system
70  *
71  */
74  InstructionAddress entryAddress,
75  InstructionAddress lastInstruction,
76  SimulatorFrontend& frontend,
77  CompiledSimController& controller,
78  MemorySystem& memorySystem,
79  bool dynamicCompilation,
80  ProcedureBBRelations& procedureBBRelations) :
81  cycleCount_(0),
82  basicBlockCount_(0),
83  jumpTarget_(entryAddress),
84  programCounter_(entryAddress),
85  lastExecutedInstruction_(0),
86  cyclesToSimulate_(MAX_CYCLES),
87  stopRequested_(false),
88  isFinished_(false),
89  conflictDetected_(false),
90  dynamicCompilation_(dynamicCompilation),
91  procedureBBRelations_(procedureBBRelations),
92  machine_(machine),
93  entryAddress_(entryAddress),
94  lastInstruction_(lastInstruction), pimpl_(new CompiledSimulationPimpl()) {
97  pimpl_->controller_ = &controller;
98 
99  // Allocate memory for calculating move and basic block execution counts
100  int moveCount = pimpl_->controller_->program().moveCount();
101  moveExecCounts_ = new ClockCycleCount[moveCount];
102  for (int i = 0; i < moveCount; ++i) {
103  moveExecCounts_[i] = 0;
104  }
105 
106  int bbCount = lastInstruction - entryAddress + 1;
107  bbExecCounts_ = new ClockCycleCount[bbCount];
108  for (int i = 0; i < bbCount; ++i) {
109  bbExecCounts_[i] = 0;
110  }
111 
112  // Find program exit points
115 }
116 
117 /**
118  * The destructor. Frees private implementation
119  */
121  delete[] bbExecCounts_;
122  bbExecCounts_ = NULL;
123 
124  delete[] moveExecCounts_;
125  moveExecCounts_ = NULL;
126 
127  delete pimpl_;
128  pimpl_ = NULL;
129 
130 }
131 
132 /**
133  * Lets the simulator frontend handle a single cycle end.
134  *
135  * Used for example when generating traces.
136  */
137 void
140  programCounter_++;
143 }
144 
145 /**
146  * Advance the simulation by a given amout of cycles.
147  *
148  * @note Advances only at an accuracy of a one basic block!
149  *
150  * @param count The number of cycles the simulation should be advanced at least
151  * @exception SimulationExecutionError If a runtime error occurs in
152  * the simulated program.
153  */
154 void
156  cyclesToSimulate_ = cycleCount_ + static_cast<ClockCycleCount>(count);
157  stopRequested_ = false;
158 
159  while (!stopRequested_ && !isFinished_) {
160  simulateCycle();
161  }
162 }
163 
164 /**
165  * Throws an exception since this feature is not supported yet!
166  *
167  * @exception SimulationExecutionError always thrown
168  */
169 void
171 
172  std::string msg(
173  "Command nexti not yet supported in the compiled simulation!");
174  throw SimulationExecutionError(__FILE__, __LINE__, __FUNCTION__, msg);
175 
176  if (count) {}
177 }
178 
179 /**
180  * Runs the simulation until it is finished or an exception occurs
181  *
182  * @note Advances only at an accuracy of a one basic block!
183  *
184  * @param address An address the simulation is allowed to stop after
185  * @exception SimulationExecutionError If a runtime error occurs in
186  * the simulated program.
187  */
188 void
191  stopRequested_ = false;
192  while (!isFinished_ && !stopRequested_) {
193  simulateCycle();
194  }
195 }
196 
197 /**
198  * Advance the simulation until a given address is reached
199  *
200  * @note Advances only at an accuracy of a one basic block!
201  *
202  * @param address An address the simulation is allowed to stop after
203  * @exception SimulationExecutionError If a runtime error occurs in
204  * the simulated program.
205  */
206 void
209  stopRequested_ = false;
210  while ((!stopRequested_ && !isFinished_ &&
211  (jumpTarget_ != address || cycleCount_ == 0))) {
212  simulateCycle();
213  }
214 }
215 
216 /**
217  * Returns the value of the current PC
218  *
219  * @return the value of the current PC
220  *
221  */
224  return programCounter_;
225 }
226 
227 /**
228  * Returns address of the last executed instruction
229  *
230  * @return Address of the last executed instruction
231  */
234  return lastExecutedInstruction_;
235 }
236 
237 /**
238  * Returns the current cycle count
239  *
240  * @return the current cycle count
241  */
243  return cycleCount_;
244 }
245 
246 /**
247  * Returns the value of the selected register
248  *
249  * @param rfName The name of the register file
250  * @param registerIndex index of the register in the RF
251  * @return A SimValue containing the present register value
252  * @exception InstanceNotFound If the RF cannot be found
253  */
254 SimValue
255 CompiledSimulation::registerFileValue(const char* rfName, int registerIndex) {
256 
259  std::string registerFile = symbolGen.registerSymbol(rf, registerIndex);
260 
261  CompiledSimulationPimpl::Symbols::const_iterator rfIterator =
262  pimpl_->symbols_.find(registerFile);
263  if (rfIterator != pimpl_->symbols_.end()) {
264  return *(rfIterator->second);
265  } else {
266  throw InstanceNotFound(__FILE__, __LINE__, __func__,
267  "Register file " + std::string(rfName) + " not found.");
268  }
269 }
270 
271 /**
272  * Returns the value of the selected immediate unit register
273  *
274  * @param iuName The name of the immediate unit
275  * @param index Index of the immediate register
276  * @return A SimValue containing the present immediate register value
277  * @exception InstanceNotFound If the immediate unit cannot be found
278  */
279 SimValue
280 CompiledSimulation::immediateUnitRegisterValue(const char* iuName, int index) {
281 
284  std::string immediateUnit = symbolGen.immediateRegisterSymbol(
285  iu, index);
286 
287  CompiledSimulationPimpl::Symbols::const_iterator iuIterator =
288  pimpl_->symbols_.find(immediateUnit);
289  if (iuIterator != pimpl_->symbols_.end()) {
290  return *(iuIterator->second);
291  } else {
292  throw InstanceNotFound(__FILE__, __LINE__, __func__,
293  "Immediate unit " + std::string(iuName) + " not found.");
294  }
295 }
296 
297 /**
298  * Returns the value of the given FU port
299  *
300  * @param fuName Name of the FU
301  * @param portIndex index of the port in the FU
302  * @return A SimValue containing the port's present value
303  * @exception InstanceNotFound If the FU port cannot be found
304  */
305 SimValue
306 CompiledSimulation::FUPortValue(const char* fuName, const char* portName) {
307 
309  FunctionUnit* fu = NULL;
310  try {
311  fu = &functionUnit(fuName);
312  } catch(InstanceNotFound& e) {
313  fu = machine_.controlUnit();
314  }
315 
316  std::string fuPort = symbolGen.portSymbol(*fu->port(portName));
317 
318  CompiledSimulationPimpl::Symbols::const_iterator fuPortIterator =
319  pimpl_->symbols_.find(fuPort);
320  if (fuPortIterator != pimpl_->symbols_.end()) {
321  return *(fuPortIterator->second);
322  } else {
323  throw InstanceNotFound(__FILE__, __LINE__, __func__,
324  "FU port " + std::string(fuPort) + " not found.");
325  }
326 }
327 
328 /**
329  * Sets the simulation to be requested to stop
330  */
331 void
333  stopRequested_ = true;
334 }
335 
336 /**
337  * Returns true if the simulation is requested to stop
338  *
339  * This can be either because the simulation has finished or the
340  * requested amount of cycles has been simulated.
341  *
342  * @return true if the simulation should stop
343  */
344 bool
346  return stopRequested_;
347 }
348 
349 /** Returns true if the simulation is finished
350  *
351  * @return true if the simulation is finished
352  */
353 bool
355  return isFinished_;
356 }
357 
358 /**
359  * Returns move execution count for move #moveNumber.
360  *
361  * @param moveNumber move number as in POM
362  * @return move execution count
363  */
366  int moveNumber,
367  InstructionAddress address) const {
369  InstructionAddress programStartAddress = program.startAddress().location();
370  const Move& move = program.moveAt(moveNumber);
371 
372  if (move.isUnconditional() && pimpl_->exitPoints_.find(address) ==
373  pimpl_->exitPoints_.end()) {
374  // Grab the whole basic block execution count
375  InstructionAddress bbStart = basicBlockStart(address -
376  programStartAddress);
377  return bbExecCounts_[bbStart];
378  } else { // guarded move or an exit point, grab single move execution count
379  return moveExecCounts_[moveNumber];
380  }
381 }
382 
383 /**
384  * Returns start of the basic block for given address of a basic block
385  * @param address address of a basic block
386  * @return start address of the basic block
387  */
390  return pimpl_->controller_->basicBlockStart(address);
391 }
392 
393 /**
394  * Returns a function unit of the given name
395  *
396  * @param name name of the function unit to return
397  * @return function unit of given name
398  * @exception InstanceNotFound If a function unit is not found
399  */
401 CompiledSimulation::functionUnit(const char* name) const {
402  return *machine_.functionUnitNavigator().item(name);
403 }
404 
405 /**
406  * Returns a memory object of the given function unit
407  *
408  * @param FUName name of the function unit
409  * @return memory object of the given function unit
410  * @exception InstanceNotFound If an item is not found
411  */
413 CompiledSimulation::FUMemory(const char* FUName) const {
414  assert(
415  machine_.functionUnitNavigator().item(FUName)->addressSpace() != NULL);
416  return
417  dynamic_cast<DirectAccessMemory&>(
418  *memorySystem()->memory(
420  FUName)->addressSpace()).get());
421 }
422 
423 /**
424  * Returns a pointer to the memory system
425  *
426  * @return a pointer to the memory system
427  */
428 MemorySystem *
430  assert (pimpl_->memorySystem_ != NULL);
431  return pimpl_->memorySystem_;
432 }
433 
434 /**
435  * Returns a reference to the simulator frontend
436  *
437  * @return a reference to the simulator frontend
438  */
441  return *(pimpl_->frontend_);
442 }
443 
444 /**
445  * A short cut for printing debugging info from the compiled code.
446  *
447  * @param message The message string to be shown on the log stream
448  */
449 void
450 CompiledSimulation::msg(const char* message) const {
451  Application::logStream() << message << std::endl;
452 }
453 
454 /**
455  * Halts simulation by throwing an exception with a message attached to it
456  *
457  * @param file file where the exception happened, i.e. __FILE__
458  * @param line line where the exception happened, i.e. __LINE__
459  * @param procedure function where the exception happened, i.e. __FUNCTION__
460  * @param message message to attach
461  * @exception SimulationExecutionError thrown always
462  */
463 void
465  const char* file,
466  int line,
467  const char* procedure,
468  const char* message) const {
469  throw SimulationExecutionError(file, line, procedure, message);
470 }
471 
472 /**
473  * Resizes the jump table
474  *
475  * @param newSize New size
476  */
477 void
479  pimpl_->jumpTable_.resize(newSize, 0);
480 }
481 
482 /**
483  * Gets the simulate function of given address from the jump table.
484  *
485  * If this is a dynamic compiled simulation, it'll first check if the simulate-
486  * function is available. If not, it will compile the required files first and
487  * then loads the simulate function symbols.
488  *
489  * @param address address to get the simulate function for
490  * @return Simulate Function of given address from the jump table
491  * @exception SimulationExecutionError If the jump function couldn't be gotten
492  */
495 
496  // Is there an already existing simulate function in the given address?
497  SimulateFunction targetFunction = pimpl_->jumpTable_[address];
498  if (targetFunction != 0) {
499  return targetFunction;
500  }
501 
502  if (dynamicCompilation_) {
503  compileAndLoadFunction(address);
504  targetFunction = pimpl_->jumpTable_[address];
505  if (targetFunction != 0) {
506  return targetFunction;
507  }
508  }
509 
510  throw SimulationExecutionError(__FILE__, __LINE__, __FUNCTION__,
511  "Cannot simulate jump to address " + Conversion::toString(address) +
512  ". Please try with the interpretive simulation engine." );
513 }
514 
515 /**
516  * Sets a jump target function for given address at the jump table
517  *
518  * @param address address to set a jump function for
519  * @param fp function pointer to set at the address
520  */
521 void
523  InstructionAddress address,
524  SimulateFunction fp) {
525  pimpl_->jumpTable_[address] = fp;
526 }
527 
528 /**
529  * Compiles and loads all simulate functions belonging to a procedure
530  * containing the given address.
531  *
532  * @param address (any) address of a procedure to compile
533  */
534 void
536 
537  InstructionAddress procedureStart =
539 
540  // Files compiled so far
541  std::set<std::string> compiledFiles;
542 
544 
545  // Get basic blocks of a procedure
546  typedef ProcedureBBRelations::BasicBlockStarts::iterator BBIterator;
547  std::pair<BBIterator, BBIterator> equalRange =
548  procedureBBRelations_.basicBlockStarts.equal_range(procedureStart);
549 
550  // Loop all basic blocks of a procedure, then compile all its files
551  for (BBIterator it = equalRange.first; it != equalRange.second; ++it) {
552  std::string file = procedureBBRelations_.basicBlockFiles[it->second];
553 
554  // Compile the file if it hasn't been already
555  if (compiledFiles.find(file) == compiledFiles.end()) {
557  std::string soPath = FileSystem::directoryOfPath(file)
559  + FileSystem::fileNameBody(file) + ".so";
561  compiledFiles.insert(file);
562  }
563 
564  // Load the generated simulate function
565  SimulateFunction fn;
567  symbolGen.basicBlockSymbol(it->second), fn);
568  setJumpTargetFunction(it->second, fn);
569  }
570 }
571 
572 /**
573  * Returns value of the given symbol (be it RF, FU, or IU)
574  *
575  * @param symbolName Symbol name in the generated code
576  * @return a pointer to the symbol's SimValue or 0 if the symbol wasn't found
577  */
578 SimValue*
579 CompiledSimulation::getSymbolValue(const char* symbolName) {
580 
581  CompiledSimulationPimpl::Symbols::iterator it = pimpl_->symbols_.find(
582  std::string(symbolName));
583 
584  if (it != pimpl_->symbols_.end()) {
585  return it->second;
586  } else {
587  return 0;
588  }
589 }
590 
591 /**
592  * Adds a new symbol name -> SimValue pair to the symbols map
593  * @param symbolName the symbol name
594  * @param value the SimValue
595  */
596 void
597 CompiledSimulation::addSymbol(const char* symbolName, SimValue& value) {
598  pimpl_->symbols_[std::string(symbolName)] = &value;
599 }
CompiledSimulation::compileAndLoadFunction
void compileAndLoadFunction(InstructionAddress address)
Definition: CompiledSimulation.cc:535
CompiledSimSymbolGenerator::immediateRegisterSymbol
std::string immediateRegisterSymbol(const TTAProgram::Terminal &terminal) const
Definition: CompiledSimSymbolGenerator.cc:178
CompiledSimulation::requestToStop
virtual void requestToStop()
Definition: CompiledSimulation.cc:332
TTAProgram
Definition: Estimator.hh:65
UIntWord
Word UIntWord
Definition: BaseType.hh:144
TTAProgram::Program
Definition: Program.hh:63
CompiledSimulation::cycleCount_
ClockCycleCount cycleCount_
Number of cycles simulated so far.
Definition: CompiledSimulation.hh:162
ProcedureBBRelations::procedureStart
std::map< InstructionAddress, InstructionAddress > procedureStart
Procedure start per basic block starts.
Definition: CompiledSimCodeGenerator.hh:80
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
FileSystem.hh
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
CompiledSimulation::programCounter
virtual InstructionAddress programCounter() const
Definition: CompiledSimulation.cc:223
CompiledSimulation::step
virtual void step(double count)
Definition: CompiledSimulation.cc:155
CompiledSimSymbolGenerator::portSymbol
std::string portSymbol(const TTAMachine::Port &port) const
Definition: CompiledSimSymbolGenerator.cc:117
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
CompiledSimCodeGenerator.hh
CompiledSimulation::stopRequested
virtual bool stopRequested() const
Definition: CompiledSimulation.cc:345
CompiledSimulation::FUPortValue
virtual SimValue FUPortValue(const char *fuName, const char *portName)
Definition: CompiledSimulation.cc:306
CompiledSimulation::~CompiledSimulation
virtual ~CompiledSimulation()
Definition: CompiledSimulation.cc:120
CompiledSimulation::setJumpTargetFunction
void setJumpTargetFunction(InstructionAddress address, SimulateFunction fp)
Definition: CompiledSimulation.cc:522
CompiledSimulation::frontend
SimulatorFrontend & frontend() const
Definition: CompiledSimulation.cc:440
CompiledSimulation::moveExecCounts_
ClockCycleCount * moveExecCounts_
Move execution counts in a C style table.
Definition: CompiledSimulation.hh:189
DirectAccessMemory
Definition: DirectAccessMemory.hh:55
CompiledSimulation::programCounter_
InstructionAddress programCounter_
The program counter. i.e. which address the simulation is currently at.
Definition: CompiledSimulation.hh:168
CompiledSimulationPimpl::memorySystem_
MemorySystem * memorySystem_
The memory system.
Definition: CompiledSimulationPimpl.hh:65
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
CompiledSimulation::immediateUnitRegisterValue
virtual SimValue immediateUnitRegisterValue(const char *iuName, int index)
Definition: CompiledSimulation.cc:280
SimulationExecutionError
Definition: Exception.hh:951
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
MemorySystem.hh
CompiledSimulation::jumpTarget_
InstructionAddress jumpTarget_
The jump target. Allows jumping to different addresses in the code.
Definition: CompiledSimulation.hh:166
Conversion::toString
static std::string toString(const T &source)
CompiledSimulationPimpl::controller_
CompiledSimController * controller_
Simulation controller.
Definition: CompiledSimulationPimpl.hh:69
CompiledSimulation::lastExecutedInstruction_
InstructionAddress lastExecutedInstruction_
Last executed instruction.
Definition: CompiledSimulation.hh:170
SimValue
Definition: SimValue.hh:96
CompiledSimulation::isFinished
virtual bool isFinished() const
Definition: CompiledSimulation.cc:354
CompiledSimulation::memorySystem
MemorySystem * memorySystem() const
Definition: CompiledSimulation.cc:429
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
SimulationEventHandler.hh
CompiledSimulation::pimpl_
CompiledSimulationPimpl * pimpl_
Private implementation in a separate source file.
Definition: CompiledSimulation.hh:256
CompiledSimulationPimpl.hh
CompiledSimulation::isFinished_
bool isFinished_
Is the simulation finished?
Definition: CompiledSimulation.hh:176
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
CompiledSimulationPimpl
Definition: CompiledSimulationPimpl.hh:53
PluginTools::importSymbol
void importSymbol(const std::string &symbolName, T *&target, const std::string &module)
Instruction.hh
SimulateFunction
void(* SimulateFunction)(void *engine)
Type for the simulateXXXXX basic block functions.
Definition: CompiledSimulation.hh:62
CompiledSimulation::bbExecCounts_
ClockCycleCount * bbExecCounts_
Basic block execution counts in a C style table.
Definition: CompiledSimulation.hh:192
CompiledSimulation::procedureBBRelations_
ProcedureBBRelations & procedureBBRelations_
A struct for finding out procedure begins from procedure's basic blocks.
Definition: CompiledSimulation.hh:239
CompiledSimSymbolGenerator::basicBlockSymbol
std::string basicBlockSymbol(InstructionAddress startAddress) const
Definition: CompiledSimSymbolGenerator.cc:320
CompiledSimulationPimpl::jumpTable_
JumpTable jumpTable_
The jump table.
Definition: CompiledSimulationPimpl.hh:76
CompiledSimulation::run
virtual void run()
Definition: CompiledSimulation.cc:189
TTAMachine::Machine::immediateUnitNavigator
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition: Machine.cc:416
TTASimulationController::findProgramExitPoints
virtual std::set< InstructionAddress > findProgramExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine) const
Definition: TTASimulationController.cc:209
CompiledSimulationPimpl::frontend_
SimulatorFrontend * frontend_
The simulator frontend.
Definition: CompiledSimulationPimpl.hh:67
Conversion.hh
ProcedureBBRelations::basicBlockFiles
std::map< InstructionAddress, std::string > basicBlockFiles
Basic block starts and their corresponding .cpp files.
Definition: CompiledSimCodeGenerator.hh:89
CompiledSimulation::haltSimulation
void haltSimulation(const char *file, int line, const char *procedure, const char *message) const
Definition: CompiledSimulation.cc:464
CompiledSimSymbolGenerator::registerSymbol
std::string registerSymbol(const TTAProgram::Terminal &terminal) const
Definition: CompiledSimSymbolGenerator.cc:150
SimulationEventHandler::SE_CYCLE_END
@ SE_CYCLE_END
Generated before advancing the simulator clock at the end of a simulation cycle.
Definition: SimulationEventHandler.hh:50
CompiledSimulation::getSimulateFunction
SimulateFunction getSimulateFunction(InstructionAddress address)
Definition: CompiledSimulation.cc:494
__func__
#define __func__
Definition: Application.hh:67
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
PluginTools::registerModule
void registerModule(const std::string &module)
Definition: PluginTools.cc:138
CompiledSimulation::simulateCycle
virtual void simulateCycle()=0
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
CompiledSimulation::CompiledSimulation
CompiledSimulation(const TTAMachine::Machine &machine, InstructionAddress entryAddress, InstructionAddress lastInstruction, SimulatorFrontend &frontend, CompiledSimController &controller, MemorySystem &memorySystem, bool dynamicCompilation, ProcedureBBRelations &procedureBBRelations)
Definition: CompiledSimulation.cc:72
CompiledSimulation::resizeJumpTable
void resizeJumpTable(int newSize)
Definition: CompiledSimulation.cc:478
TTAProgram::Move
Definition: Move.hh:55
CompiledSimulation::getSymbolValue
SimValue * getSymbolValue(const char *symbolName)
Definition: CompiledSimulation.cc:579
CompiledSimulation::machine_
const TTAMachine::Machine & machine_
The simulated machine.
Definition: CompiledSimulation.hh:242
Machine.hh
CompiledSimulationPimpl::exitPoints_
std::set< InstructionAddress > exitPoints_
Program exit points in a set.
Definition: CompiledSimulationPimpl.hh:79
CompiledSimulationPimpl::symbols_
Symbols symbols_
A Symbol map for easily getting the SimValues out of the simulation.
Definition: CompiledSimulationPimpl.hh:74
MemorySystem
Definition: MemorySystem.hh:55
PluginTools.hh
ProcedureBBRelations::basicBlockStarts
BasicBlockStarts basicBlockStarts
All basic block start addresses per procedure start.
Definition: CompiledSimCodeGenerator.hh:86
SimulatorFrontend.hh
CompiledSimulation.hh
CompiledSimCompiler.hh
CompiledSimulation::moveExecutionCount
virtual ClockCycleCount moveExecutionCount(int moveNumber, InstructionAddress address) const
Definition: CompiledSimulation.cc:365
CompiledSimulationPimpl::compiler_
CompiledSimCompiler compiler_
The Compiled Simulation compiler.
Definition: CompiledSimulationPimpl.hh:82
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
CompiledSimSymbolGenerator
Definition: CompiledSimSymbolGenerator.hh:66
CompiledSimController::basicBlockStart
InstructionAddress basicBlockStart(InstructionAddress address) const
Definition: CompiledSimController.cc:385
CompiledSimController::program
const TTAProgram::Program & program() const
Definition: CompiledSimController.cc:394
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
DirectAccessMemory.hh
Program.hh
SimulatorFrontend::eventHandler
SimulationEventHandler & eventHandler()
Definition: SimulatorFrontend.cc:2260
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
TTAProgram::Program::moveCount
int moveCount() const
Definition: Program.cc:494
CompiledSimulationPimpl::pluginTools_
PluginTools pluginTools_
Plugintools used to load the compiled .so files.
Definition: CompiledSimulationPimpl.hh:84
CompiledSimulation::dynamicCompilation_
bool dynamicCompilation_
Is this a dynamic compiled simulation?
Definition: CompiledSimulation.hh:236
CompiledSimulation::stopRequested_
bool stopRequested_
Should the simulation stop or not?
Definition: CompiledSimulation.hh:174
ControlUnit.hh
CompiledSimulation::lastExecutedInstruction
virtual InstructionAddress lastExecutedInstruction() const
Definition: CompiledSimulation.cc:233
CompiledSimulation::FUMemory
DirectAccessMemory & FUMemory(const char *FUName) const
Definition: CompiledSimulation.cc:413
MemorySystem::memory
MemoryPtr memory(const TTAMachine::AddressSpace &as)
Definition: MemorySystem.cc:170
CompiledSimulation::runUntil
virtual void runUntil(UIntWord address)
Definition: CompiledSimulation.cc:207
CompiledSimCompiler::compileToSO
int compileToSO(const std::string &path, const std::string &flags="", bool verbose=false) const
Definition: CompiledSimCompiler.cc:210
CompiledSimulation::addSymbol
void addSymbol(const char *symbolName, SimValue &value)
Definition: CompiledSimulation.cc:597
CompiledSimulation::next
virtual void next(int count)
Definition: CompiledSimulation.cc:170
CompiledSimulation::cyclesToSimulate_
ClockCycleCount cyclesToSimulate_
Number of cycles left to simulate until the execution returns.
Definition: CompiledSimulation.hh:172
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
MAX_CYCLES
static const ClockCycleCount MAX_CYCLES
Definition: CompiledSimulation.cc:57
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
CompiledSimulation::basicBlockStart
virtual InstructionAddress basicBlockStart(InstructionAddress address) const
Definition: CompiledSimulation.cc:389
CompiledSimulation::cycleCount
virtual ClockCycleCount cycleCount() const
Definition: CompiledSimulation.cc:242
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
ProcedureBBRelations
A struct for tracking basic blocks and their relation to their procedures.
Definition: CompiledSimCodeGenerator.hh:78
CompiledSimController
Definition: CompiledSimController.hh:52
Informer::handleEvent
void handleEvent(int event)
Move.hh
TTAMachine
Definition: Assembler.hh:48
CompiledSimulation::cycleEnd
virtual void cycleEnd()
Definition: CompiledSimulation.cc:138
FileSystem::fileNameBody
static std::string fileNameBody(const std::string &fileName)
Definition: FileSystem.cc:291
CompiledSimController.hh
SimulatorFrontend
Definition: SimulatorFrontend.hh:89
CompiledSimulation::registerFileValue
virtual SimValue registerFileValue(const char *rfName, int registerIndex)
Definition: CompiledSimulation.cc:255
CompiledSimulation::functionUnit
TTAMachine::FunctionUnit & functionUnit(const char *name) const
Definition: CompiledSimulation.cc:401
InstanceNotFound
Definition: Exception.hh:304
CompiledSimSymbolGenerator.hh
TTAMachine::Machine
Definition: Machine.hh:73
CompiledSimulation::msg
void msg(const char *message) const
Definition: CompiledSimulation.cc:450
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50