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

#include <GCUState.hh>

Inheritance diagram for GCUState:
Inheritance graph
Collaboration diagram for GCUState:
Collaboration graph

Public Member Functions

 GCUState (int latency, int nww, int cuDelaySlots, int instructionAddressIncrement=1)
 
virtual ~GCUState ()
 
InstructionAddressprogramCounter ()
 
SimValuereturnAddressRegister ()
 
void setProgramCounter (const InstructionAddress &value)
 
void setReturnAddress (const InstructionAddress &value)
 
void setReturnAddress ()
 
virtual void advanceClock ()
 
virtual void reset ()
 this is called at (re)initialization of the simulation More...
 
virtual OperationContextcontext ()
 
- Public Member Functions inherited from FUState
 FUState ()
 
 FUState (const TCEString &name)
 
virtual ~FUState ()
 
void setTriggered ()
 
void setOperation (Operation &operation)
 
void setOperation (Operation &operation, OperationExecutor &executor)
 
bool isIdle ()
 
virtual void endClock ()
 
virtual void addInputPortState (PortState &port)
 
virtual void addOutputPortState (PortState &port)
 
virtual void addOperationExecutor (OperationExecutor &opExec, Operation &op)
 
virtual void setOperationSimulator (DetailedOperationSimulator &sim)
 
virtual void replaceOperationExecutor (Operation &op, OperationExecutor *newExecutor)
 
virtual OperationExecutorexecutor (Operation &op)
 
- Public Member Functions inherited from ClockedState
 ClockedState ()
 
virtual ~ClockedState ()
 

Private Member Functions

 GCUState (const GCUState &)
 Copying not allowed. More...
 
GCUStateoperator= (const GCUState &)
 Assignment not allowed. More...
 

Private Attributes

int naturalWordWidth_
 Natural word width as minimum addressable units. More...
 
SimValue returnAddressRegister_
 The return address register. More...
 
InstructionAddress programCounter_
 Program counter. More...
 
InstructionAddress newProgramCounter_
 In case an control flow operation is pending, this variable contains the program counter value that should be updated when the control stage counter goes down. More...
 
int latency_
 The delay of the control flow operations to take place. More...
 
int branchDelayCycles_
 The delay of branch operations in the pipeline, as opposed to this unit. More...
 
bool operationPending_
 If this this is true, there's a control flow operation pending. More...
 
int operationPendingTime_
 This indicates how many cycles the operation has been pending, when this reaches the latency, the PC is updated with the new value. More...
 
OperationContext operationContext_
 The operation context for this FU. More...
 
int instructionAddressIncrement_ = 1
 The increment to instruction address to retrieve next instruction. More...
 

Additional Inherited Members

- Protected Attributes inherited from FUState
bool idle_
 The idle status of the FU. The derived classes should alway set this to true when possible to avoid unnecessary advanceClock() and endClock() calls. More...
 

Detailed Description

Models the global control unit state.

Definition at line 46 of file GCUState.hh.

Constructor & Destructor Documentation

◆ GCUState() [1/2]

GCUState::GCUState ( int  latency,
int  nww,
int  cuDelaySlots,
int  instructionAddressIncrement = 1 
)

Constructor.

Parameters
latencyLatency of the unit.
nwwNatural word width as MAUs.
lockGlobal lock signal.

Definition at line 49 of file GCUState.cc.

53  :
55  latency_(latency),
56  branchDelayCycles_(cuDelaySlots),
60  instructionAddressIncrement_(instructionAddressIncrement) {
61  reset();
62 }

References reset().

Here is the call graph for this function:

◆ ~GCUState()

GCUState::~GCUState ( )
virtual

Destructor.

Definition at line 76 of file GCUState.cc.

76  {
77 }

◆ GCUState() [2/2]

GCUState::GCUState ( const GCUState )
private

Copying not allowed.

Member Function Documentation

◆ advanceClock()

void GCUState::advanceClock ( )
virtual

Handles the actions when clock is advanced.

The value of program counter is updated. Pipeline is advanced.

Reimplemented from FUState.

Definition at line 98 of file GCUState.cc.

98  {
99 
100  // For call and jump operations
101  if (operationPending_) {
103  }
106  operationPending_ = false;
107  }
108 
109  // Special handling for Loop Buffer Setup operation
110  if (!context().isEmpty()) {
111  idle_ = false;
112  context().advanceClock();
113  } else {
115  }
116 }

References OperationContext::advanceClock(), context(), FUState::idle_, newProgramCounter_, operationPending_, operationPendingTime_, and programCounter_.

Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().

Here is the call graph for this function:

◆ context()

OperationContext & GCUState::context ( )
virtual

Returns the operation context.

This is basically a "template method" to allow differently initialized OperationContext-classes in FUState subclasses.

Returns
The operation context for the FU.

Reimplemented from FUState.

Definition at line 88 of file GCUState.cc.

88  {
89  return operationContext_;
90 }

References operationContext_.

Referenced by advanceClock().

◆ operator=()

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

Assignment not allowed.

◆ programCounter()

InstructionAddress& GCUState::programCounter ( )

◆ reset()

void GCUState::reset ( )
virtual

this is called at (re)initialization of the simulation

Reimplemented from FUState.

Definition at line 65 of file GCUState.cc.

65  {
66  programCounter_ = 0;
69  operationPending_ = false;
71 }

References newProgramCounter_, operationPending_, operationPendingTime_, programCounter_, and returnAddressRegister_.

Referenced by GCUState().

◆ returnAddressRegister()

SimValue& GCUState::returnAddressRegister ( )

◆ setProgramCounter()

void GCUState::setProgramCounter ( const InstructionAddress value)

◆ setReturnAddress() [1/2]

void GCUState::setReturnAddress ( )

◆ setReturnAddress() [2/2]

void GCUState::setReturnAddress ( const InstructionAddress value)

Member Data Documentation

◆ branchDelayCycles_

int GCUState::branchDelayCycles_
private

The delay of branch operations in the pipeline, as opposed to this unit.

Definition at line 85 of file GCUState.hh.

◆ instructionAddressIncrement_

int GCUState::instructionAddressIncrement_ = 1
private

The increment to instruction address to retrieve next instruction.

Definition at line 95 of file GCUState.hh.

◆ latency_

int GCUState::latency_
private

The delay of the control flow operations to take place.

Definition at line 83 of file GCUState.hh.

◆ naturalWordWidth_

int GCUState::naturalWordWidth_
private

Natural word width as minimum addressable units.

Definition at line 73 of file GCUState.hh.

◆ newProgramCounter_

InstructionAddress GCUState::newProgramCounter_
private

In case an control flow operation is pending, this variable contains the program counter value that should be updated when the control stage counter goes down.

Definition at line 81 of file GCUState.hh.

Referenced by advanceClock(), and reset().

◆ operationContext_

OperationContext GCUState::operationContext_
private

The operation context for this FU.

Definition at line 93 of file GCUState.hh.

Referenced by context().

◆ operationPending_

bool GCUState::operationPending_
private

If this this is true, there's a control flow operation pending.

Definition at line 87 of file GCUState.hh.

Referenced by advanceClock(), and reset().

◆ operationPendingTime_

int GCUState::operationPendingTime_
private

This indicates how many cycles the operation has been pending, when this reaches the latency, the PC is updated with the new value.

Definition at line 91 of file GCUState.hh.

Referenced by advanceClock(), and reset().

◆ programCounter_

InstructionAddress GCUState::programCounter_
private

Program counter.

Definition at line 77 of file GCUState.hh.

Referenced by advanceClock(), and reset().

◆ returnAddressRegister_

SimValue GCUState::returnAddressRegister_
private

The return address register.

Definition at line 75 of file GCUState.hh.

Referenced by reset().


The documentation for this class was generated from the following files:
GCUState::branchDelayCycles_
int branchDelayCycles_
The delay of branch operations in the pipeline, as opposed to this unit.
Definition: GCUState.hh:85
GCUState::returnAddressRegister_
SimValue returnAddressRegister_
The return address register.
Definition: GCUState.hh:75
GCUState::naturalWordWidth_
int naturalWordWidth_
Natural word width as minimum addressable units.
Definition: GCUState.hh:73
GCUState::operationPending_
bool operationPending_
If this this is true, there's a control flow operation pending.
Definition: GCUState.hh:87
GCUState::operationContext_
OperationContext operationContext_
The operation context for this FU.
Definition: GCUState.hh:93
GCUState::programCounter_
InstructionAddress programCounter_
Program counter.
Definition: GCUState.hh:77
GCUState::reset
virtual void reset()
this is called at (re)initialization of the simulation
Definition: GCUState.cc:65
GCUState::newProgramCounter_
InstructionAddress newProgramCounter_
In case an control flow operation is pending, this variable contains the program counter value that s...
Definition: GCUState.hh:81
GCUState::instructionAddressIncrement_
int instructionAddressIncrement_
The increment to instruction address to retrieve next instruction.
Definition: GCUState.hh:95
GCUState::operationPendingTime_
int operationPendingTime_
This indicates how many cycles the operation has been pending, when this reaches the latency,...
Definition: GCUState.hh:91
FUState::idle_
bool idle_
The idle status of the FU. The derived classes should alway set this to true when possible to avoid u...
Definition: FUState.hh:95
GCUState::context
virtual OperationContext & context()
Definition: GCUState.cc:88
OperationContext::advanceClock
void advanceClock()
Definition: OperationContext.cc:108
GCUState::latency_
int latency_
The delay of the control flow operations to take place.
Definition: GCUState.hh:83