OpenASIP
2.0
|
#include <CompiledSimSymbolGenerator.hh>
Public Member Functions | |
CompiledSimSymbolGenerator (const TCEString &globalSymbolSuffix) | |
virtual | ~CompiledSimSymbolGenerator () |
void | enablePrefix (const std::string &prefix) |
void | disablePrefix () |
std::string | timeStamp () const |
std::string | portSymbol (const TTAMachine::Port &port) const |
std::string | registerSymbol (const TTAProgram::Terminal &terminal) const |
std::string | registerSymbol (const TTAMachine::RegisterFile &rf, int index) const |
std::string | immediateRegisterSymbol (const TTAProgram::Terminal &terminal) const |
std::string | immediateRegisterSymbol (const TTAMachine::ImmediateUnit &iu, int index) const |
std::string | busSymbol (const TTAMachine::Bus &bus) const |
std::string | returnAddressSymbol (const TTAMachine::ControlUnit &gcu) const |
std::string | moveOperandSymbol (const TTAProgram::Terminal &terminal, const TTAProgram::Move &move) const |
std::string | operationContextSymbol (const TTAMachine::FunctionUnit &fu) const |
std::string | conflictDetectorSymbol (const TTAMachine::FunctionUnit &fu) const |
std::string | targetMemorySymbol (const TTAMachine::FunctionUnit &fu) const |
std::string | DAMemorySymbol (const TTAMachine::FunctionUnit &fu) const |
std::string | guardBoolSymbol () const |
std::string | basicBlockSymbol (InstructionAddress startAddress) const |
std::string | operationSymbol (const std::string &operationName, const TTAMachine::FunctionUnit &fu) const |
std::string | FUResultSymbol (const TTAMachine::Port &port) const |
std::string | generateTempVariable () const |
std::string | jumpTargetSetterSymbol (InstructionAddress address) const |
Private Member Functions | |
CompiledSimSymbolGenerator (const CompiledSimSymbolGenerator &) | |
Copying not allowed. More... | |
CompiledSimSymbolGenerator & | operator= (const CompiledSimSymbolGenerator &) |
Assignment not allowed. More... | |
Private Attributes | |
TCEString | prefix_ |
Prefix used for generated variable symbols. More... | |
TCEString | globalSymbolSuffix_ |
Suffix used for the generated global function symbols. More... | |
A class that generates C/C++ symbol names for given objects in the simulation
Used for the compiled simulation
Definition at line 66 of file CompiledSimSymbolGenerator.hh.
CompiledSimSymbolGenerator::CompiledSimSymbolGenerator | ( | const TCEString & | globalSymbolSuffix | ) |
Default constructor.
globalSymbolSuffix | Can be used to produce unique symbol names for the global BB simulation functions. This has to be used in case using multiple simulation engines in the same process. |
Definition at line 62 of file CompiledSimSymbolGenerator.cc.
|
virtual |
|
private |
Copying not allowed.
std::string CompiledSimSymbolGenerator::basicBlockSymbol | ( | InstructionAddress | startAddress | ) | const |
Generates an unique symbol name for a basic block function
A new C/C++ function is created for each basic block in the program, so the generated symbol will also be used as the generated function name.
startAddress | The start address of the basic block |
Definition at line 320 of file CompiledSimSymbolGenerator.cc.
References globalSymbolSuffix_, and Conversion::toString().
Referenced by CompiledSimulation::compileAndLoadFunction(), CompiledSimCodeGenerator::generateConstructorCode(), CompiledSimCodeGenerator::generateInstruction(), and CompiledSimCodeGenerator::generateJumpTableCode().
std::string CompiledSimSymbolGenerator::busSymbol | ( | const TTAMachine::Bus & | bus | ) | const |
Generates an unique symbol name for a TTA machine bus
bus | The given bus |
Definition at line 205 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Component::name(), and prefix_.
Referenced by CompiledSimMove::copyFromBusCode(), CompiledSimMove::copyToBusCode(), and CompiledSimCodeGenerator::generateHeaderAndMainCode().
std::string CompiledSimSymbolGenerator::conflictDetectorSymbol | ( | const TTAMachine::FunctionUnit & | fu | ) | const |
Generates an unique symbol name for a given FU conflict detector.
fu | The given function unit |
Definition at line 270 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Component::name(), and prefix_.
Referenced by ConflictDetectionCodeGenerator::ConflictDetectionCodeGenerator(), and ConflictDetectionCodeGenerator::symbolDeclaration().
std::string CompiledSimSymbolGenerator::DAMemorySymbol | ( | const TTAMachine::FunctionUnit & | fu | ) | const |
Generates an unique symbol name for the given FU's DirectAccessMemory&
fuName | Given function unit |
Definition at line 294 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Component::name(), and prefix_.
Referenced by CompiledSimCodeGenerator::generateConstructorCode(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateLoadTrigger(), CompiledSimCodeGenerator::generateStoreTrigger(), and CompiledSimCodeGenerator::updateDeclaredSymbolsList().
void CompiledSimSymbolGenerator::disablePrefix | ( | ) |
Disables the usage of prefix.
Definition at line 87 of file CompiledSimSymbolGenerator.cc.
References prefix_.
Referenced by CompiledSimCodeGenerator::generateConstructorCode(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateSymbolDeclarations(), and CompiledSimCodeGenerator::updateDeclaredSymbolsList().
void CompiledSimSymbolGenerator::enablePrefix | ( | const std::string & | prefix | ) |
Sets a new prefix to be used for generated variable symbols
prefix | new prefix to be set |
Definition at line 79 of file CompiledSimSymbolGenerator.cc.
References prefix_.
Referenced by CompiledSimCodeGenerator::generateFUOutputUpdater(), and CompiledSimCodeGenerator::generateInstruction().
std::string CompiledSimSymbolGenerator::FUResultSymbol | ( | const TTAMachine::Port & | port | ) | const |
Generates an unique symbol name for FU's results.
port | The FU port |
Definition at line 346 of file CompiledSimSymbolGenerator.cc.
References portSymbol().
Referenced by CompiledSimCodeGenerator::generateAddFUResult(), CompiledSimCodeGenerator::generateFUOutputUpdater(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateInstruction(), and CompiledSimCodeGenerator::updateDeclaredSymbolsList().
std::string CompiledSimSymbolGenerator::generateTempVariable | ( | ) | const |
Generates name for temporary variables using incremental numbers
Definition at line 356 of file CompiledSimSymbolGenerator.cc.
References Conversion::toString().
Referenced by CompiledSimCodeGenerator::generateLoadTrigger(), CompiledSimCodeGenerator::generateTriggerCode(), and CompiledSimCodeGenerator::handleOperationWithoutDag().
std::string CompiledSimSymbolGenerator::guardBoolSymbol | ( | ) | const |
Generates an unique symbol name for a temporary guard variable
Definition at line 305 of file CompiledSimSymbolGenerator.cc.
References Conversion::toString().
Referenced by CompiledSimCodeGenerator::generateGuardCondition(), and CompiledSimCodeGenerator::generateGuardRead().
std::string CompiledSimSymbolGenerator::immediateRegisterSymbol | ( | const TTAMachine::ImmediateUnit & | iu, |
int | index | ||
) | const |
Generates an unique symbol name for a IU register
iu | The given IU |
index | Index of the immediate register |
Definition at line 191 of file CompiledSimSymbolGenerator.cc.
References prefix_, and DisassemblyRegister::registerName().
std::string CompiledSimSymbolGenerator::immediateRegisterSymbol | ( | const TTAProgram::Terminal & | terminal | ) | const |
Generates an unique symbol name for a IU register of the terminal
terminal | Given terminal |
Definition at line 178 of file CompiledSimSymbolGenerator.cc.
References TTAProgram::Terminal::immediateUnit(), and TTAProgram::Terminal::index().
Referenced by CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateInstruction(), CompiledSimulation::immediateUnitRegisterValue(), and moveOperandSymbol().
std::string CompiledSimSymbolGenerator::jumpTargetSetterSymbol | ( | InstructionAddress | address | ) | const |
Generates name for jump target setting function
address | address of the simulate function to be set |
Definition at line 367 of file CompiledSimSymbolGenerator.cc.
References Conversion::toString().
std::string CompiledSimSymbolGenerator::moveOperandSymbol | ( | const TTAProgram::Terminal & | terminal, |
const TTAProgram::Move & | move | ||
) | const |
Generates an unique symbol name for a given move operand (terminal)
terminal | The operand terminal |
move | The move |
Definition at line 228 of file CompiledSimSymbolGenerator.cc.
References TTAProgram::Move::bus(), immediateRegisterSymbol(), TTAMachine::Bus::immediateWidth(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isImmediate(), TTAProgram::Terminal::isImmediateRegister(), TTAProgram::Terminal::port(), portSymbol(), registerSymbol(), TTAMachine::Bus::signExtends(), MathTools::signExtendTo(), Conversion::toString(), SimValue::unsignedValue(), TTAProgram::Terminal::value(), TTAMachine::Bus::zeroExtends(), and MathTools::zeroExtendTo().
Referenced by CompiledSimMove::copyFromBusCode(), CompiledSimMove::copyToBusCode(), and CompiledSimCodeGenerator::generateInstruction().
std::string CompiledSimSymbolGenerator::operationContextSymbol | ( | const TTAMachine::FunctionUnit & | fu | ) | const |
Generates an unique symbol name for a given operation context
fu | The given function unit |
Definition at line 258 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Component::name(), and prefix_.
Referenced by CompiledSimCodeGenerator::generateConstructorCode(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::handleOperation(), and CompiledSimCodeGenerator::handleOperationWithoutDag().
std::string CompiledSimSymbolGenerator::operationSymbol | ( | const std::string & | operationName, |
const TTAMachine::FunctionUnit & | fu | ||
) | const |
Generates an unique symbol name for a FU's operation
operationName | Name of the operation |
fu | The function unit containing the operation |
Definition at line 333 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Component::name(), and prefix_.
Referenced by CompiledSimCodeGenerator::generateConstructorCode(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), and CompiledSimCodeGenerator::handleOperationWithoutDag().
|
private |
Assignment not allowed.
std::string CompiledSimSymbolGenerator::portSymbol | ( | const TTAMachine::Port & | port | ) | const |
Generates an unique symbol name for the given port
Converts a TTA unit's port to a unique symbol name that can be later referred as a SimValue variable in the generated C/C++ code.
port | A port of the TTA unit |
Definition at line 117 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Port::name(), TTAMachine::Component::name(), TTAMachine::Port::parentUnit(), and prefix_.
Referenced by CompiledSimulation::FUPortValue(), FUResultSymbol(), CompiledSimCodeGenerator::generateAddFUResult(), CompiledSimCodeGenerator::generateFUOutputUpdater(), CompiledSimCodeGenerator::generateGuardCondition(), CompiledSimCodeGenerator::generateGuardRead(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateLoadTrigger(), CompiledSimCodeGenerator::generateStoreTrigger(), CompiledSimCodeGenerator::generateTriggerCode(), CompiledSimCodeGenerator::handleJump(), CompiledSimCodeGenerator::handleOperationWithoutDag(), moveOperandSymbol(), and returnAddressSymbol().
std::string CompiledSimSymbolGenerator::registerSymbol | ( | const TTAMachine::RegisterFile & | rf, |
int | index | ||
) | const |
Generates an unique symbol name for a RF register
rf | The given register file |
index | The index of the register |
Definition at line 163 of file CompiledSimSymbolGenerator.cc.
References prefix_, and DisassemblyRegister::registerName().
std::string CompiledSimSymbolGenerator::registerSymbol | ( | const TTAProgram::Terminal & | terminal | ) | const |
Generates an unique symbol name for a RF register of the terminal
terminal | Given terminal |
Definition at line 150 of file CompiledSimSymbolGenerator.cc.
References TTAProgram::Terminal::index(), and TTAProgram::Terminal::registerFile().
Referenced by CompiledSimCodeGenerator::CompiledSimCodeGenerator(), CompiledSimCodeGenerator::generateGuardCondition(), CompiledSimCodeGenerator::generateGuardRead(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateInstruction(), moveOperandSymbol(), and CompiledSimulation::registerFileValue().
std::string CompiledSimSymbolGenerator::returnAddressSymbol | ( | const TTAMachine::ControlUnit & | gcu | ) | const |
Generates a symbol name for the GCU's return address
Definition at line 215 of file CompiledSimSymbolGenerator.cc.
References portSymbol(), and TTAMachine::ControlUnit::returnAddressPort().
Referenced by CompiledSimCodeGenerator::handleJump().
std::string CompiledSimSymbolGenerator::targetMemorySymbol | ( | const TTAMachine::FunctionUnit & | fu | ) | const |
Generates an unique symbol name for the given FU's memory space
fuName | given function unit |
Definition at line 282 of file CompiledSimSymbolGenerator.cc.
References TTAMachine::Component::name(), and prefix_.
std::string CompiledSimSymbolGenerator::timeStamp | ( | ) | const |
Generates a timestamp
Definition at line 101 of file CompiledSimSymbolGenerator.cc.
|
private |
Suffix used for the generated global function symbols.
Definition at line 133 of file CompiledSimSymbolGenerator.hh.
Referenced by basicBlockSymbol().
|
private |
Prefix used for generated variable symbols.
Definition at line 130 of file CompiledSimSymbolGenerator.hh.
Referenced by busSymbol(), conflictDetectorSymbol(), DAMemorySymbol(), disablePrefix(), enablePrefix(), immediateRegisterSymbol(), operationContextSymbol(), operationSymbol(), portSymbol(), registerSymbol(), and targetMemorySymbol().