OpenASIP  2.0
CompiledSimController.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 CompiledSimController.hh
26  *
27  * Declaration of CompiledSimController class.
28  *
29  * @author Viljami Korhonen 2007 (viljami.korhonen-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2010
31  * @note rating: red
32  */
33 
34 #ifndef COMPILED_SIM_CONTROLLER_HH
35 #define COMPILED_SIM_CONTROLLER_HH
36 
38 #include "PluginTools.hh"
39 #include <boost/shared_ptr.hpp>
41 
42 class CompiledSimulation;
44 
45 namespace TTAProgram {
46  class Program;
47 }
48 
49 /**
50  * A Simulation controller that uses the compiled simulation techniques.
51  */
53 public:
58  bool leaveDirty=false);
59 
60  virtual ~CompiledSimController();
61 
62  virtual void step(double count = 1);
63 
64  virtual void next(int count = 1);
65 
66  virtual void run();
67 
68  virtual void runUntil(UIntWord address);
69 
70  virtual void reset();
71 
72  virtual InstructionAddress programCounter() const;
74  virtual ClockCycleCount clockCount() const;
75 
76  virtual boost::shared_ptr<CompiledSimulation> compiledSimulation();
77 
78  virtual void deleteGeneratedFiles();
79 
80  /// Function type for the getSimulation() function
83  InstructionAddress entryAddress,
84  InstructionAddress lastInstruction,
86  CompiledSimController& controller,
88  bool dynamicCompilation,
89  ProcedureBBRelations& procedureBBRelations);
90 
91  virtual std::string registerFileValue(
92  const std::string& rfName,
93  int registerIndex = -1);
94 
96  const std::string& iuName, int index = -1);
97 
98  virtual SimValue FUPortValue(
99  const std::string& fuName,
100  const std::string& portName);
101 
102  virtual void prepareToStop(StopReason reason);
103 
105  const TTAProgram::Program& program() const;
106 
107 private:
108  /// Copying not allowed.
110  /// Assignment not allowed.
112 
113  /// Used for loading the compiled simulation plugin
115 
116  /// Pointer to the loaded simulation
117  boost::shared_ptr<CompiledSimulation> simulation_;
118 
119  /// Path to the generated simulation files
121 
122  /// True, if the simulation should leave all the generated code files
124 
125  /// A map containing the basic blocks' start..end pairs
127  /// A struct for tracking basic blocks and their relation to their procedures
129  /// The unique identifier for this simulation engine. Used for
130  /// enabling multiple compiled engines in the same process while
131  /// still having ccache hits (which would not happen when using
132  /// the object address as the id).
134 };
135 
136 #endif
TTASimulationController::memorySystem
virtual MemorySystem & memorySystem(int coreId=-1)
Definition: TTASimulationController.cc:171
CompiledSimController::compiledSimulationPath_
std::string compiledSimulationPath_
Path to the generated simulation files.
Definition: CompiledSimController.hh:120
TTAProgram
Definition: Estimator.hh:65
UIntWord
Word UIntWord
Definition: BaseType.hh:144
TTAProgram::Program
Definition: Program.hh:63
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
CompiledSimController::next
virtual void next(int count=1)
Definition: CompiledSimController.cc:138
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
CompiledSimCodeGenerator::AddressMap
std::map< InstructionAddress, InstructionAddress > AddressMap
A type for storing address-to-address combinations.
Definition: CompiledSimCodeGenerator.hh:104
PluginTools
Definition: PluginTools.hh:53
CompiledSimController::run
virtual void run()
Definition: CompiledSimController.cc:173
CompiledSimCodeGenerator.hh
CompiledSimController::FUPortValue
virtual SimValue FUPortValue(const std::string &fuName, const std::string &portName)
Definition: CompiledSimController.cc:460
CompiledSimController::clockCount
virtual ClockCycleCount clockCount() const
Definition: CompiledSimController.cc:345
TTASimulationController.hh
CompiledSimController::SimulationGetterFunction
CompiledSimulation *() SimulationGetterFunction(const TTAMachine::Machine &machine, InstructionAddress entryAddress, InstructionAddress lastInstruction, SimulatorFrontend &frontend, CompiledSimController &controller, MemorySystem &memorySystem, bool dynamicCompilation, ProcedureBBRelations &procedureBBRelations)
Function type for the getSimulation() function.
Definition: CompiledSimController.hh:81
CompiledSimController::prepareToStop
virtual void prepareToStop(StopReason reason)
Definition: CompiledSimController.cc:472
CompiledSimController::lastExecutedInstruction
virtual InstructionAddress lastExecutedInstruction() const
Definition: CompiledSimController.cc:335
SimValue
Definition: SimValue.hh:96
CompiledSimController::immediateUnitRegisterValue
virtual SimValue immediateUnitRegisterValue(const std::string &iuName, int index=-1)
Definition: CompiledSimController.cc:445
TTASimulationController
Definition: TTASimulationController.hh:69
CompiledSimController::procedureBBRelations_
ProcedureBBRelations procedureBBRelations_
A struct for tracking basic blocks and their relation to their procedures.
Definition: CompiledSimController.hh:128
CompiledSimController::deleteGeneratedFiles
virtual void deleteGeneratedFiles()
Definition: CompiledSimController.cc:367
CompiledSimController::pluginTools_
PluginTools pluginTools_
Used for loading the compiled simulation plugin.
Definition: CompiledSimController.hh:114
CompiledSimController::registerFileValue
virtual std::string registerFileValue(const std::string &rfName, int registerIndex=-1)
Definition: CompiledSimController.cc:407
CompiledSimController::programCounter
virtual InstructionAddress programCounter() const
Definition: CompiledSimController.cc:325
CompiledSimController::~CompiledSimController
virtual ~CompiledSimController()
Definition: CompiledSimController.cc:94
StopReason
StopReason
The reasons to stop simulation.
Definition: SimulatorConstants.hh:60
CompiledSimController::leaveDirty_
bool leaveDirty_
True, if the simulation should leave all the generated code files.
Definition: CompiledSimController.hh:123
MemorySystem
Definition: MemorySystem.hh:55
PluginTools.hh
CompiledSimController::step
virtual void step(double count=1)
Definition: CompiledSimController.cc:104
TTASimulationController::frontend
virtual SimulatorFrontend & frontend()
Definition: TTASimulationController.cc:181
CompiledSimController::runUntil
virtual void runUntil(UIntWord address)
Definition: CompiledSimController.cc:209
CompiledSimController::instanceId_
int instanceId_
The unique identifier for this simulation engine. Used for enabling multiple compiled engines in the ...
Definition: CompiledSimController.hh:133
CompiledSimController::basicBlockStart
InstructionAddress basicBlockStart(InstructionAddress address) const
Definition: CompiledSimController.cc:385
CompiledSimulation
Definition: CompiledSimulation.hh:112
CompiledSimController::program
const TTAProgram::Program & program() const
Definition: CompiledSimController.cc:394
CompiledSimController::compiledSimulation
virtual boost::shared_ptr< CompiledSimulation > compiledSimulation()
Definition: CompiledSimController.cc:359
CompiledSimController::simulation_
boost::shared_ptr< CompiledSimulation > simulation_
Pointer to the loaded simulation.
Definition: CompiledSimController.hh:117
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
CompiledSimController::reset
virtual void reset()
Definition: CompiledSimController.cc:243
CompiledSimController::operator=
CompiledSimController & operator=(const CompiledSimController &)
Assignment not allowed.
ProcedureBBRelations
A struct for tracking basic blocks and their relation to their procedures.
Definition: CompiledSimCodeGenerator.hh:78
CompiledSimController
Definition: CompiledSimController.hh:52
CompiledSimController::basicBlocks_
CompiledSimCodeGenerator::AddressMap basicBlocks_
A map containing the basic blocks' start..end pairs.
Definition: CompiledSimController.hh:126
CompiledSimController::CompiledSimController
CompiledSimController(SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program, bool leaveDirty=false)
Definition: CompiledSimController.cc:68
SimulatorFrontend
Definition: SimulatorFrontend.hh:89
TTAMachine::Machine
Definition: Machine.hh:73