OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
CompiledSimMove Class Reference

#include <CompiledSimMove.hh>

Collaboration diagram for CompiledSimMove:
Collaboration graph

Public Member Functions

 CompiledSimMove (const TTAProgram::Move &move, const std::string &guardSymbol, const CompiledSimSymbolGenerator &symbolGenerator)
 
 CompiledSimMove (const CompiledSimMove &)
 
CompiledSimMoveoperator= (const CompiledSimMove &)
 
std::string copyToBusCode () const
 
std::string copyFromBusCode () const
 
const TTAProgram::Terminaldestination () const
 

Private Attributes

const TTAProgram::Movemove_
 The move. More...
 
const TTAProgram::Terminalsource_
 Source of move. More...
 
const TTAProgram::Terminaldestination_
 Destination of move. More...
 
const TTAMachine::Busbus_
 Bus. More...
 
std::string guardSymbol_
 guard symbol used for move More...
 
const CompiledSimSymbolGeneratorsymbolGenerator_
 the symbol generator More...
 

Detailed Description

A class that handles copying values to/from a bus in the compiled simulation

Definition at line 53 of file CompiledSimMove.hh.

Constructor & Destructor Documentation

◆ CompiledSimMove() [1/2]

CompiledSimMove::CompiledSimMove ( const TTAProgram::Move move,
const std::string &  guardSymbol,
const CompiledSimSymbolGenerator symbolGenerator 
)

The Constructor

Parameters
moveThe original move
guardSymbolSymbolname of the guard or "" if no guard is used

Definition at line 49 of file CompiledSimMove.cc.

52  :
53  move_(&move),
54  source_(&move.source()),
55  destination_(&move.destination()),
56  bus_(&move.bus()),
57  guardSymbol_(guardSymbol),
58  symbolGenerator_(symbolGenerator) {
59 }

◆ CompiledSimMove() [2/2]

CompiledSimMove::CompiledSimMove ( const CompiledSimMove move)

Copy constructor

Parameters
movethe move

Definition at line 66 of file CompiledSimMove.cc.

66  :
67  source_(move.source_),
69  bus_(move.bus_),
72 }

Member Function Documentation

◆ copyFromBusCode()

std::string CompiledSimMove::copyFromBusCode ( ) const

Generates C/C++ code that copies data from bus variable to a move destination

Returns
The generated code

Definition at line 107 of file CompiledSimMove.cc.

107  {
109  *move_);
110  string bus = symbolGenerator_.busSymbol(*bus_);
111  string code = destination + " = " + bus + ";";
112  if (guardSymbol_ != "") {
113  code = "if (" + guardSymbol_ + ") {" + code + " } ";
114  }
115 
116  return code;
117 }

References bus_, CompiledSimSymbolGenerator::busSymbol(), destination(), destination_, guardSymbol_, move_, CompiledSimSymbolGenerator::moveOperandSymbol(), and symbolGenerator_.

Here is the call graph for this function:

◆ copyToBusCode()

std::string CompiledSimMove::copyToBusCode ( ) const

Generates C/C++ code that copies data from move source to a bus variable

Returns
The generated code

Definition at line 95 of file CompiledSimMove.cc.

95  {
96  string source = symbolGenerator_.moveOperandSymbol(*source_, *move_);
97  string bus = symbolGenerator_.busSymbol(*bus_);
98  return bus + " = " + source + ";";
99 }

References bus_, CompiledSimSymbolGenerator::busSymbol(), move_, CompiledSimSymbolGenerator::moveOperandSymbol(), source_, and symbolGenerator_.

Referenced by CompiledSimCodeGenerator::generateInstruction().

Here is the call graph for this function:

◆ destination()

const TTAProgram::Terminal& CompiledSimMove::destination ( ) const
inline

Definition at line 64 of file CompiledSimMove.hh.

64 { return *destination_; }

References destination_.

Referenced by copyFromBusCode().

◆ operator=()

CompiledSimMove & CompiledSimMove::operator= ( const CompiledSimMove move)

Assignmnent operator

Parameters
movethe move

Definition at line 80 of file CompiledSimMove.cc.

80  {
81  this->source_ = move.source_;
82  this->destination_ = move.destination_;
83  this->bus_ = move.bus_;
84  this->guardSymbol_ = move.guardSymbol_;
85  return *this;
86 }

References bus_, destination_, guardSymbol_, and source_.

Member Data Documentation

◆ bus_

const TTAMachine::Bus* CompiledSimMove::bus_
private

Bus.

Definition at line 76 of file CompiledSimMove.hh.

Referenced by copyFromBusCode(), copyToBusCode(), and operator=().

◆ destination_

const TTAProgram::Terminal* CompiledSimMove::destination_
private

Destination of move.

Definition at line 73 of file CompiledSimMove.hh.

Referenced by copyFromBusCode(), destination(), and operator=().

◆ guardSymbol_

std::string CompiledSimMove::guardSymbol_
private

guard symbol used for move

Definition at line 79 of file CompiledSimMove.hh.

Referenced by copyFromBusCode(), and operator=().

◆ move_

const TTAProgram::Move* CompiledSimMove::move_
private

The move.

Definition at line 67 of file CompiledSimMove.hh.

Referenced by copyFromBusCode(), and copyToBusCode().

◆ source_

const TTAProgram::Terminal* CompiledSimMove::source_
private

Source of move.

Definition at line 70 of file CompiledSimMove.hh.

Referenced by copyToBusCode(), and operator=().

◆ symbolGenerator_

const CompiledSimSymbolGenerator& CompiledSimMove::symbolGenerator_
private

the symbol generator

Definition at line 82 of file CompiledSimMove.hh.

Referenced by copyFromBusCode(), and copyToBusCode().


The documentation for this class was generated from the following files:
CompiledSimSymbolGenerator::busSymbol
std::string busSymbol(const TTAMachine::Bus &bus) const
Definition: CompiledSimSymbolGenerator.cc:205
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
CompiledSimMove::destination_
const TTAProgram::Terminal * destination_
Destination of move.
Definition: CompiledSimMove.hh:73
CompiledSimMove::move_
const TTAProgram::Move * move_
The move.
Definition: CompiledSimMove.hh:67
CompiledSimMove::destination
const TTAProgram::Terminal & destination() const
Definition: CompiledSimMove.hh:64
CompiledSimMove::source_
const TTAProgram::Terminal * source_
Source of move.
Definition: CompiledSimMove.hh:70
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
CompiledSimMove::symbolGenerator_
const CompiledSimSymbolGenerator & symbolGenerator_
the symbol generator
Definition: CompiledSimMove.hh:82
CompiledSimSymbolGenerator::moveOperandSymbol
std::string moveOperandSymbol(const TTAProgram::Terminal &terminal, const TTAProgram::Move &move) const
Definition: CompiledSimSymbolGenerator.cc:228
CompiledSimMove::guardSymbol_
std::string guardSymbol_
guard symbol used for move
Definition: CompiledSimMove.hh:79
CompiledSimMove::bus_
const TTAMachine::Bus * bus_
Bus.
Definition: CompiledSimMove.hh:76