OpenASIP  2.0
CompiledSimSymbolGenerator.hh
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 SymbolGenerator.hh
26  *
27  * Declaration of CompiledSimSymbolGenerator class.
28  *
29  * @author Viljami Korhonen 2008 (viljami.korhonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef COMPILED_SIM_SYMBOL_GENERATOR_HH
34 #define COMPILED_SIM_SYMBOL_GENERATOR_HH
35 
36 #include "BaseType.hh"
37 #include "TCEString.hh"
38 
39 namespace TTAMachine {
40  class Machine;
41  class FunctionUnit;
42  class FUPort;
43  class Port;
44  class Unit;
45  class HWOperation;
46  class Guard;
47  class RegisterFile;
48  class ImmediateUnit;
49  class ControlUnit;
50  class Bus;
51 }
52 
53 namespace TTAProgram {
54  class Instruction;
55  class Terminal;
56  class Move;
57 }
58 
59 
60 /**
61  * A class that generates C/C++ symbol names for given objects in the simulation
62  *
63  * Used for the compiled simulation
64  *
65  */
67 public:
68 
69  CompiledSimSymbolGenerator(const TCEString& globalSymbolSuffix);
71 
72  void enablePrefix(const std::string& prefix);
73  void disablePrefix();
74 
75 
76  std::string timeStamp() const;
77 
78  std::string portSymbol(const TTAMachine::Port& port) const;
79 
80  std::string registerSymbol(const TTAProgram::Terminal& terminal) const;
81  std::string registerSymbol(
82  const TTAMachine::RegisterFile& rf,
83  int index) const;
84 
85  std::string immediateRegisterSymbol(
86  const TTAProgram::Terminal& terminal) const;
87  std::string immediateRegisterSymbol(
88  const TTAMachine::ImmediateUnit& iu,
89  int index) const;
90 
91  std::string busSymbol(const TTAMachine::Bus& bus) const;
92 
93  std::string returnAddressSymbol(const TTAMachine::ControlUnit& gcu) const;
94 
95  std::string moveOperandSymbol(
96  const TTAProgram::Terminal& terminal,
97  const TTAProgram::Move & move) const;
98 
99  std::string operationContextSymbol(
100  const TTAMachine::FunctionUnit& fu) const;
101 
102  std::string conflictDetectorSymbol(
103  const TTAMachine::FunctionUnit& fu) const;
104 
105  std::string targetMemorySymbol(const TTAMachine::FunctionUnit& fu) const;
106 
107  std::string DAMemorySymbol(const TTAMachine::FunctionUnit& fu) const;
108 
109  std::string guardBoolSymbol() const;
110 
111  std::string basicBlockSymbol(InstructionAddress startAddress) const;
112 
113  std::string operationSymbol(
114  const std::string& operationName,
115  const TTAMachine::FunctionUnit& fu) const;
116 
117  std::string FUResultSymbol(const TTAMachine::Port& port) const;
118 
119  std::string generateTempVariable() const;
120 
121  std::string jumpTargetSetterSymbol(InstructionAddress address) const;
122 
123 private:
124  /// Copying not allowed.
126  /// Assignment not allowed.
128 
129  /// Prefix used for generated variable symbols
131 
132  /// Suffix used for the generated global function symbols.
134 };
135 
136 #endif
CompiledSimSymbolGenerator::immediateRegisterSymbol
std::string immediateRegisterSymbol(const TTAProgram::Terminal &terminal) const
Definition: CompiledSimSymbolGenerator.cc:178
TTAProgram
Definition: Estimator.hh:65
CompiledSimSymbolGenerator::prefix_
TCEString prefix_
Prefix used for generated variable symbols.
Definition: CompiledSimSymbolGenerator.hh:130
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
CompiledSimSymbolGenerator::disablePrefix
void disablePrefix()
Definition: CompiledSimSymbolGenerator.cc:87
BaseType.hh
CompiledSimSymbolGenerator::portSymbol
std::string portSymbol(const TTAMachine::Port &port) const
Definition: CompiledSimSymbolGenerator.cc:117
CompiledSimSymbolGenerator::operationSymbol
std::string operationSymbol(const std::string &operationName, const TTAMachine::FunctionUnit &fu) const
Definition: CompiledSimSymbolGenerator.cc:333
TTAMachine::Bus
Definition: Bus.hh:53
CompiledSimSymbolGenerator::busSymbol
std::string busSymbol(const TTAMachine::Bus &bus) const
Definition: CompiledSimSymbolGenerator.cc:205
CompiledSimSymbolGenerator::DAMemorySymbol
std::string DAMemorySymbol(const TTAMachine::FunctionUnit &fu) const
Definition: CompiledSimSymbolGenerator.cc:294
CompiledSimSymbolGenerator::returnAddressSymbol
std::string returnAddressSymbol(const TTAMachine::ControlUnit &gcu) const
Definition: CompiledSimSymbolGenerator.cc:215
CompiledSimSymbolGenerator::operationContextSymbol
std::string operationContextSymbol(const TTAMachine::FunctionUnit &fu) const
Definition: CompiledSimSymbolGenerator.cc:258
CompiledSimSymbolGenerator::globalSymbolSuffix_
TCEString globalSymbolSuffix_
Suffix used for the generated global function symbols.
Definition: CompiledSimSymbolGenerator.hh:133
CompiledSimSymbolGenerator::CompiledSimSymbolGenerator
CompiledSimSymbolGenerator(const TCEString &globalSymbolSuffix)
Definition: CompiledSimSymbolGenerator.cc:62
CompiledSimSymbolGenerator::jumpTargetSetterSymbol
std::string jumpTargetSetterSymbol(InstructionAddress address) const
Definition: CompiledSimSymbolGenerator.cc:367
TCEString.hh
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
CompiledSimSymbolGenerator::guardBoolSymbol
std::string guardBoolSymbol() const
Definition: CompiledSimSymbolGenerator.cc:305
CompiledSimSymbolGenerator::basicBlockSymbol
std::string basicBlockSymbol(InstructionAddress startAddress) const
Definition: CompiledSimSymbolGenerator.cc:320
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
TTAMachine::Port
Definition: Port.hh:54
CompiledSimSymbolGenerator::registerSymbol
std::string registerSymbol(const TTAProgram::Terminal &terminal) const
Definition: CompiledSimSymbolGenerator.cc:150
CompiledSimSymbolGenerator::enablePrefix
void enablePrefix(const std::string &prefix)
Definition: CompiledSimSymbolGenerator.cc:79
CompiledSimSymbolGenerator::operator=
CompiledSimSymbolGenerator & operator=(const CompiledSimSymbolGenerator &)
Assignment not allowed.
CompiledSimSymbolGenerator::FUResultSymbol
std::string FUResultSymbol(const TTAMachine::Port &port) const
Definition: CompiledSimSymbolGenerator.cc:346
TTAProgram::Move
Definition: Move.hh:55
CompiledSimSymbolGenerator
Definition: CompiledSimSymbolGenerator.hh:66
CompiledSimSymbolGenerator::generateTempVariable
std::string generateTempVariable() const
Definition: CompiledSimSymbolGenerator.cc:356
CompiledSimSymbolGenerator::targetMemorySymbol
std::string targetMemorySymbol(const TTAMachine::FunctionUnit &fu) const
Definition: CompiledSimSymbolGenerator.cc:282
TCEString
Definition: TCEString.hh:53
TTAProgram::Terminal
Definition: Terminal.hh:60
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
TTAMachine
Definition: Assembler.hh:48
CompiledSimSymbolGenerator::moveOperandSymbol
std::string moveOperandSymbol(const TTAProgram::Terminal &terminal, const TTAProgram::Move &move) const
Definition: CompiledSimSymbolGenerator.cc:228
CompiledSimSymbolGenerator::conflictDetectorSymbol
std::string conflictDetectorSymbol(const TTAMachine::FunctionUnit &fu) const
Definition: CompiledSimSymbolGenerator.cc:270
CompiledSimSymbolGenerator::timeStamp
std::string timeStamp() const
Definition: CompiledSimSymbolGenerator.cc:101
CompiledSimSymbolGenerator::~CompiledSimSymbolGenerator
virtual ~CompiledSimSymbolGenerator()
Definition: CompiledSimSymbolGenerator.cc:70
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50