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

#include <TransportPipeline.hh>

Inheritance diagram for TransportPipeline:
Inheritance graph
Collaboration diagram for TransportPipeline:
Collaboration graph

Public Member Functions

 TransportPipeline (GCUState &parent)
 
virtual ~TransportPipeline ()
 
virtual int latency () const
 
virtual void startOperation (Operation &op)
 
virtual void advanceClock ()
 
virtual OperationExecutorcopy ()
 
virtual void setContext (OperationContext &context)
 
bool hasPendingOperations () const
 
- Public Member Functions inherited from OperationExecutor
 OperationExecutor ()
 
 OperationExecutor (FUState &parent)
 
virtual ~OperationExecutor ()
 
FUStateparent () const
 
void setParent (FUState &parent)
 
void addBinding (int io, PortState &port)
 
PortStatebinding (int io) const
 
bool hasPendingOperations () const
 
virtual void reset ()
 

Private Member Functions

TransportPipelineoperator= (const TransportPipeline &)
 Assignment not allowed. More...
 

Private Attributes

Operationoperation_
 Operation to be triggered next. More...
 
OperationContextcontext_
 Operation context used to fetch the values for PC and RA. More...
 
OperationContext tempContext_
 Operation context seen by the operation. More...
 
InstructionAddress PC_
 Storage for PC value in the context. More...
 
InstructionAddress IBS_
 Storage for IRF block start in the context. More...
 
SimValue RA_
 Storage for RA value in the context. More...
 
int branchDelayCycles_
 Branch delay cycles. More...
 
GCUStateparent_
 The owner GCUState. More...
 

Additional Inherited Members

- Protected Attributes inherited from OperationExecutor
std::vector< PortState * > bindings_
 PortStates that are bound to a certain input or output operand. More...
 
bool hasPendingOperations_
 This is set to true if the OperationExecutor is not in 'idle' mode. More...
 

Detailed Description

Models the transport pipeline of global control unit.

Definition at line 49 of file TransportPipeline.hh.

Constructor & Destructor Documentation

◆ TransportPipeline()

TransportPipeline::TransportPipeline ( GCUState parent)
explicit

Constructor.

Parameters
parentParent of the pipeline.

Definition at line 57 of file TransportPipeline.cc.

57  :
59  context_(&parent.context()),
61  parent_(parent) {
62  // delete the own state registry to avoid mem leaks
63  delete &tempContext_.stateRegistry();
64  // share the state registry with the actual context
66 }

References FUState::context(), OperationExecutor::parent(), OperationContext::setStateRegistry(), OperationContext::stateRegistry(), and tempContext_.

Referenced by copy().

Here is the call graph for this function:

◆ ~TransportPipeline()

TransportPipeline::~TransportPipeline ( )
virtual

Destructor.

Definition at line 71 of file TransportPipeline.cc.

71  {
73 }

References tempContext_, and OperationContext::unsetStateRegistry().

Here is the call graph for this function:

Member Function Documentation

◆ advanceClock()

void TransportPipeline::advanceClock ( )
virtual

Nothing is done when clock cycle changes.

Implements OperationExecutor.

Definition at line 130 of file TransportPipeline.cc.

130  {
131 }

◆ copy()

OperationExecutor * TransportPipeline::copy ( )
virtual

Copies OperationExecutor.

Returns
The copied OperationExecutor.

Implements OperationExecutor.

Definition at line 139 of file TransportPipeline.cc.

139  {
140  return new TransportPipeline(*this);
141 }

References TransportPipeline().

Here is the call graph for this function:

◆ hasPendingOperations()

bool TransportPipeline::hasPendingOperations ( ) const
inline

Definition at line 59 of file TransportPipeline.hh.

59  {
60  return true;
61  }

◆ latency()

int TransportPipeline::latency ( ) const
virtual

Returns the latency of the pipeline.

Returns
The latency of the pipeline.

Definition at line 81 of file TransportPipeline.cc.

81  {
82  return 0;
83 }

◆ operator=()

TransportPipeline& TransportPipeline::operator= ( const TransportPipeline )
private

Assignment not allowed.

◆ setContext()

void TransportPipeline::setContext ( OperationContext context)
virtual

Sets the OperationContext of the pipeline.

Parameters
contextThe OperationContext.

Implements OperationExecutor.

Definition at line 149 of file TransportPipeline.cc.

149  {
150  context_ = &context;
151 }

References context_.

◆ startOperation()

void TransportPipeline::startOperation ( Operation op)
virtual

Start the execution of the operation.

First inputs and outputs of the operation are collected in a vector. Then a new operation context is created. After triggering the operation the registers which values are changed are updated in parent GCU state.

Parameters
opOperation to be triggered.
Todo:
This can be optimized a lot.

Implements OperationExecutor.

Definition at line 96 of file TransportPipeline.cc.

96  {
97 
98  operation_ = &op;
99  int operands = op.numberOfInputs() + op.numberOfOutputs();
100  SimValue* io[32];
101  assert(operands < 32);
102  for (int i = 0; i < operands; ++i)
103  io[i] = const_cast<SimValue*>(&(binding(i + 1).value()));
104 
105  // use a temporary context here as the original context points to the
106  // internal program counter variables of the simulator engine,
107  // which we do not want to modify in the middle of simulating
108  // a cycle
114 
115  // If the operation is a jump or a call operation, update the program
116  // counter after delay slot cycles. If a loop buffer setup op is called,
117  // do not update the program counter this way.
118  if (tempContext_.updateProgramCounter() && (op.isCall() || op.isBranch())) {
120  }
123  }
124 }

References assert, OperationExecutor::binding(), context_, Operation::isBranch(), Operation::isCall(), Operation::numberOfInputs(), Operation::numberOfOutputs(), operation_, parent_, OperationContext::programCounter(), OperationContext::returnAddress(), OperationContext::saveReturnAddress(), GCUState::setProgramCounter(), GCUState::setReturnAddress(), OperationContext::setSaveReturnAddress(), OperationContext::setUpdateProgramCounter(), Operation::simulateTrigger(), tempContext_, and OperationContext::updateProgramCounter().

Here is the call graph for this function:

Member Data Documentation

◆ branchDelayCycles_

int TransportPipeline::branchDelayCycles_
private

Branch delay cycles.

Definition at line 80 of file TransportPipeline.hh.

◆ context_

OperationContext* TransportPipeline::context_
private

Operation context used to fetch the values for PC and RA.

Definition at line 70 of file TransportPipeline.hh.

Referenced by setContext(), and startOperation().

◆ IBS_

InstructionAddress TransportPipeline::IBS_
private

Storage for IRF block start in the context.

Definition at line 76 of file TransportPipeline.hh.

◆ operation_

Operation* TransportPipeline::operation_
private

Operation to be triggered next.

Definition at line 68 of file TransportPipeline.hh.

Referenced by startOperation().

◆ parent_

GCUState& TransportPipeline::parent_
private

The owner GCUState.

Definition at line 82 of file TransportPipeline.hh.

Referenced by startOperation().

◆ PC_

InstructionAddress TransportPipeline::PC_
private

Storage for PC value in the context.

Definition at line 74 of file TransportPipeline.hh.

◆ RA_

SimValue TransportPipeline::RA_
private

Storage for RA value in the context.

Definition at line 78 of file TransportPipeline.hh.

◆ tempContext_

OperationContext TransportPipeline::tempContext_
private

Operation context seen by the operation.

Definition at line 72 of file TransportPipeline.hh.

Referenced by startOperation(), TransportPipeline(), and ~TransportPipeline().


The documentation for this class was generated from the following files:
TransportPipeline::tempContext_
OperationContext tempContext_
Operation context seen by the operation.
Definition: TransportPipeline.hh:72
OperationContext::setSaveReturnAddress
void setSaveReturnAddress(bool value)
Definition: OperationContext.cc:183
TransportPipeline::parent_
GCUState & parent_
The owner GCUState.
Definition: TransportPipeline.hh:82
OperationExecutor::OperationExecutor
OperationExecutor()
Definition: OperationExecutor.hh:51
TransportPipeline::PC_
InstructionAddress PC_
Storage for PC value in the context.
Definition: TransportPipeline.hh:74
TransportPipeline::TransportPipeline
TransportPipeline(GCUState &parent)
Definition: TransportPipeline.cc:57
Operation::numberOfInputs
virtual int numberOfInputs() const
Definition: Operation.cc:192
OperationContext::setStateRegistry
void setStateRegistry(StateRegistry &stateRegistry)
Definition: OperationContext.cc:313
OperationContext::saveReturnAddress
bool saveReturnAddress()
Definition: OperationContext.cc:194
SimValue
Definition: SimValue.hh:96
assert
#define assert(condition)
Definition: Application.hh:86
TransportPipeline::context_
OperationContext * context_
Operation context used to fetch the values for PC and RA.
Definition: TransportPipeline.hh:70
OperationContext::branchDelayCycles
int branchDelayCycles() const
Definition: OperationContext.cc:308
OperationContext::stateRegistry
StateRegistry & stateRegistry()
Definition: OperationContext.cc:323
TransportPipeline::operation_
Operation * operation_
Operation to be triggered next.
Definition: TransportPipeline.hh:68
GCUState::setReturnAddress
void setReturnAddress(const InstructionAddress &value)
OperationExecutor::parent
FUState & parent() const
OperationContext::programCounter
InstructionAddress & programCounter()
Definition: OperationContext.cc:152
OperationContext::setUpdateProgramCounter
void setUpdateProgramCounter(bool value)
Definition: OperationContext.cc:162
Operation::simulateTrigger
virtual bool simulateTrigger(SimValue **, OperationContext &context) const
Definition: Operation.cc:555
OperationContext::unsetStateRegistry
void unsetStateRegistry()
Definition: OperationContext.cc:318
Operation::isCall
virtual bool isCall() const
Definition: Operation.cc:318
OperationContext::updateProgramCounter
bool updateProgramCounter() const
Definition: OperationContext.cc:169
Operation::numberOfOutputs
virtual int numberOfOutputs() const
Definition: Operation.cc:202
OperationExecutor::binding
PortState & binding(int io) const
Operation::isBranch
virtual bool isBranch() const
Definition: Operation.cc:306
OperationContext::returnAddress
SimValue & returnAddress()
Definition: OperationContext.cc:207
TransportPipeline::RA_
SimValue RA_
Storage for RA value in the context.
Definition: TransportPipeline.hh:78
GCUState::setProgramCounter
void setProgramCounter(const InstructionAddress &value)
FUState::context
virtual OperationContext & context()
Definition: FUState.cc:376