OpenASIP
2.0
|
#include <FUState.hh>
Public Member Functions | |
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 | advanceClock () |
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 OperationExecutor * | executor (Operation &op) |
virtual OperationContext & | context () |
virtual void | reset () |
this is called at (re)initialization of the simulation More... | |
Public Member Functions inherited from ClockedState | |
ClockedState () | |
virtual | ~ClockedState () |
Protected Attributes | |
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... | |
Private Types | |
typedef std::map< Operation *, OperationExecutor * > | ExecutorContainer |
Maps operations to executors. More... | |
typedef std::vector< OperationExecutor * > | ExecutorList |
Contains all the different instances of executors. More... | |
Private Member Functions | |
FUState (const FUState &) | |
Copying not allowed. More... | |
FUState & | operator= (const FUState &) |
Assignment not allowed. More... | |
void | clearPorts () |
bool | sameBindings (OperationExecutor &exec1, OperationExecutor &exec2, Operation &op) |
virtual void | setOperationSimulator (Operation &op, DetailedOperationSimulator &sim) |
Private Attributes | |
bool | trigger_ |
True if operation is triggered in current clock cycle. More... | |
Operation * | nextOperation_ |
Operation to be triggered next. More... | |
OperationExecutor * | nextExecutor_ |
OperationExecutor to be used for the next operation (an optimization). More... | |
OperationContext | operationContext_ |
The operation context for this FU. More... | |
ExecutorContainer | executors_ |
All operation executors. More... | |
ExecutorList | execList_ |
All the different instances of OperationExecutors. More... | |
std::vector< PortState * > | inputPorts_ |
Input ports of the function unit. More... | |
std::vector< PortState * > | outputPorts_ |
Output ports of the function unit. More... | |
std::size_t | activeExecutors_ |
Count of active executors (to allow returning instantly from advanceClock()) More... | |
DetailedOperationSimulator * | detailedModel_ |
Optional detailed operation simulation model. Assume there's one such model per FU or none at all for now (could be possible to be one model per Operation). More... | |
Models the state of the function unit of a TTA processor.
Definition at line 58 of file FUState.hh.
|
private |
Maps operations to executors.
Definition at line 114 of file FUState.hh.
|
private |
Contains all the different instances of executors.
Definition at line 116 of file FUState.hh.
FUState::FUState | ( | ) |
Constructor (no explicitly given FU name).
lock | Global lock signal. |
Definition at line 67 of file FUState.cc.
FUState::FUState | ( | const TCEString & | name | ) |
Constructor (with explicitly given FU name).
lock | Global lock signal. |
Definition at line 79 of file FUState.cc.
|
virtual |
Destructor.
Definition at line 88 of file FUState.cc.
References clearPorts(), SequenceTools::deleteAllItems(), and execList_.
|
private |
Copying not allowed.
|
virtual |
Adds new input port state.
port | New input port state. |
Reimplemented in NullFUState.
Definition at line 211 of file FUState.cc.
References inputPorts_.
Referenced by MachineStateBuilder::addPortToFU(), and MachineStateBuilder::addVirtualOpcodeSettingPortsToFU().
|
virtual |
Adds operation executor for a given operation.
Reimplemented in NullFUState.
Definition at line 232 of file FUState.cc.
References context(), OperationExecutor::copy(), Operation::createState(), execList_, executors_, and OperationExecutor::setContext().
Referenced by MachineStateBuilder::addVirtualOpcodeSettingPortsToFU().
|
virtual |
Adds new output port state.
port | New output port state. |
Reimplemented in NullFUState.
Definition at line 221 of file FUState.cc.
References outputPorts_.
Referenced by MachineStateBuilder::addPortToFU().
|
virtual |
Handles actions that take place while clock cycle changes.
advanceClock() of all active operation executors are called.
Implements ClockedState.
Reimplemented in NullFUState, and GCUState.
Definition at line 152 of file FUState.cc.
References activeExecutors_, OperationExecutor::advanceClock(), OperationContext::advanceClock(), context(), detailedModel_, execList_, OperationExecutor::hasPendingOperations(), idle_, OperationContext::isEmpty(), nextExecutor_, and DetailedOperationSimulator::simulateCycleStart().
Referenced by FUTestbenchGenerator::createStimulus().
|
private |
Clears input and output ports.
Definition at line 97 of file FUState.cc.
References inputPorts_, and outputPorts_.
Referenced by ~FUState().
|
virtual |
Returns the operation context.
This is a "template method" to allow differently initialized OperationContext-classes in FUState subclasses.
Reimplemented in GCUState, and MemoryAccessingFUState.
Definition at line 376 of file FUState.cc.
References operationContext_.
Referenced by addOperationExecutor(), advanceClock(), replaceOperationExecutor(), reset(), SimulationController::SimulationController(), and TransportPipeline::TransportPipeline().
|
virtual |
Handles actions that take place in the end of the clock cycle.
If operation is triggered, startOperation() of the executor of the operation is called.
Implements ClockedState.
Reimplemented in NullFUState.
Definition at line 122 of file FUState.cc.
References __func__, activeExecutors_, assert, executors_, OperationExecutor::hasPendingOperations(), idle_, nextExecutor_, nextOperation_, OperationExecutor::startOperation(), and trigger_.
Referenced by OTASimulationController::advanceMachineCycle(), FUTestbenchGenerator::createStimulus(), and SimulationController::simulateCycle().
|
virtual |
Returns OperationExecutor for the given operation.
op | The operation of the wanted OperationExecutor. |
Reimplemented in NullFUState.
Definition at line 358 of file FUState.cc.
References executors_.
Referenced by MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), and setOperationSimulator().
bool FUState::isIdle | ( | ) |
Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().
|
virtual |
Replaces the operation executor model for an operation.
Does not copy the operation executor but uses the given instance. The method copies the I/O bindings and sets the parent FUState from the old model.
Definition at line 257 of file FUState.cc.
References OperationExecutor::addBinding(), assert, OperationExecutor::binding(), context(), Operation::createState(), execList_, executors_, Operation::numberOfInputs(), Operation::numberOfOutputs(), OperationExecutor::parent(), sameBindings(), OperationExecutor::setContext(), and OperationExecutor::setParent().
|
virtual |
this is called at (re)initialization of the simulation
Reimplemented from ClockedState.
Reimplemented in GCUState.
Definition at line 103 of file FUState.cc.
References context(), Operation::createState(), Operation::deleteState(), and executors_.
|
private |
Returns true if the two OperationExecutors have the same bindings.
exec1 | First OperationExecutor. |
exec2 | Second OperationExecutor. |
op | Operation to be executed with executors. |
Definition at line 324 of file FUState.cc.
References OperationExecutor::binding(), Operation::numberOfInputs(), and Operation::numberOfOutputs().
Referenced by replaceOperationExecutor().
void FUState::setOperation | ( | Operation & | operation | ) |
Referenced by OpcodeSettingVirtualInputPortState::setValue().
void FUState::setOperation | ( | Operation & | operation, |
OperationExecutor & | executor | ||
) |
|
virtual |
Sets a detailed operation simulation model for all operations in the FU.
Definition at line 304 of file FUState.cc.
References detailedModel_, and executors_.
|
privatevirtual |
Sets a detailed operation simulation model for all operations in the FU.
Definition at line 290 of file FUState.cc.
References assert, executor(), and MultiLatencyOperationExecutor::setOperationSimulator().
void FUState::setTriggered | ( | ) |
Referenced by TriggeringInputPortState::setValue(), and OpcodeSettingVirtualInputPortState::setValue().
|
private |
Count of active executors (to allow returning instantly from advanceClock())
Definition at line 136 of file FUState.hh.
Referenced by advanceClock(), and endClock().
|
private |
Optional detailed operation simulation model. Assume there's one such model per FU or none at all for now (could be possible to be one model per Operation).
Definition at line 140 of file FUState.hh.
Referenced by advanceClock(), and setOperationSimulator().
|
private |
All the different instances of OperationExecutors.
Definition at line 129 of file FUState.hh.
Referenced by addOperationExecutor(), advanceClock(), replaceOperationExecutor(), and ~FUState().
|
private |
All operation executors.
Definition at line 127 of file FUState.hh.
Referenced by addOperationExecutor(), endClock(), executor(), replaceOperationExecutor(), reset(), and setOperationSimulator().
|
protected |
The idle status of the FU. The derived classes should alway set this to true when possible to avoid unnecessary advanceClock() and endClock() calls.
Definition at line 95 of file FUState.hh.
Referenced by GCUState::advanceClock(), advanceClock(), and endClock().
|
private |
Input ports of the function unit.
Definition at line 131 of file FUState.hh.
Referenced by addInputPortState(), and clearPorts().
|
private |
OperationExecutor to be used for the next operation (an optimization).
Definition at line 123 of file FUState.hh.
Referenced by advanceClock(), and endClock().
|
private |
Operation to be triggered next.
Definition at line 121 of file FUState.hh.
Referenced by endClock().
|
private |
The operation context for this FU.
Definition at line 125 of file FUState.hh.
Referenced by context().
|
private |
Output ports of the function unit.
Definition at line 133 of file FUState.hh.
Referenced by addOutputPortState(), and clearPorts().
|
private |
True if operation is triggered in current clock cycle.
Definition at line 119 of file FUState.hh.
Referenced by endClock().