OpenASIP
2.0
|
#include <OperationContext.hh>
Public Types | |
typedef std::map< std::string, OperationState * > | StateRegistry |
Type of state registry. More... | |
Private Member Functions | |
OperationContext & | operator= (const OperationContext &) |
Assignment not allowed. More... | |
Private Attributes | |
OperationContextPimpl * | pimpl_ |
Implementation in separate source file to speed up compiling. More... | |
OperationContext is used to store any implementation and context dependent data that may affect the result of an operation.
In typical client applications, operation implementations are related to a function unit.
Definition at line 56 of file OperationContext.hh.
typedef std::map<std::string, OperationState*> OperationContext::StateRegistry |
Type of state registry.
Definition at line 72 of file OperationContext.hh.
OperationContext::OperationContext | ( | ) |
Constructor for contexts suitable for basic operations.
Definition at line 48 of file OperationContext.cc.
OperationContext::OperationContext | ( | const TCEString & | name | ) |
Constructor for basic operations in simulation – FU name passed.
Definition at line 54 of file OperationContext.cc.
OperationContext::OperationContext | ( | Memory * | memory, |
InstructionAddress & | programCounter, | ||
SimValue & | returnAddress, | ||
int | delayCycles | ||
) |
Constructor for contexts suitable for any kinds of operations.
memory | The memory model instance. |
programCounter | The program counter register. |
returnAddress | The return address register. |
Definition at line 65 of file OperationContext.cc.
OperationContext::OperationContext | ( | const OperationContext & | context | ) |
A copy constructor that performs a deep copy for the pimpl_
context | OperationContext |
Definition at line 80 of file OperationContext.cc.
|
virtual |
Destructor. Deletes the pimpl object
Definition at line 87 of file OperationContext.cc.
References pimpl_.
void OperationContext::advanceClock | ( | ) |
Advances the internal clock of each registered operation state object.
Definition at line 108 of file OperationContext.cc.
References OperationContextPimpl::advanceClock(), and pimpl_.
Referenced by GCUState::advanceClock(), FUState::advanceClock(), and SimulateDialog::onAdvanceClock().
int OperationContext::branchDelayCycles | ( | ) | const |
Returns the amount of pipeline delay cycles.
Definition at line 308 of file OperationContext.cc.
References OperationContextPimpl::branchDelayCycles(), and pimpl_.
Referenced by OperationDAGBehavior::areValid().
int OperationContext::contextId | ( | ) | const |
Returns the unique id of the OperationContext instance.
Definition at line 266 of file OperationContext.cc.
References OperationContextPimpl::contextId(), and pimpl_.
CycleCount OperationContext::cycleCount | ( | ) | const |
Returns the elapsed time since the beginning of simulation.
Can be used to implement real time timer operations, etc. Uses the simulator's cycle count, if available, otherwise uses internal cycle counter that is incremented with the advanceClock();
Definition at line 288 of file OperationContext.cc.
References OperationContextPimpl::cycleCount(), and pimpl_.
Referenced by setCycleCountVariable().
const TCEString & OperationContext::functionUnitName | ( | ) | const |
Returns the FU name of the OperationContext instance.
Definition at line 276 of file OperationContext.cc.
References OperationContextPimpl::functionUnitName(), and pimpl_.
bool OperationContext::hasMemoryModel | ( | ) | const |
bool OperationContext::isEmpty | ( | ) | const |
Returns true if there are no operation state objects stored in the context.
Definition at line 224 of file OperationContext.cc.
References OperationContextPimpl::isEmpty(), and pimpl_.
Referenced by FUState::advanceClock().
const Memory & OperationContext::memory | ( | ) |
Returns a reference to a Memory Module wrapper instance.
This instance can be accessed by the function unit and behavior simulation methods to simulate memory access.
Definition at line 251 of file OperationContext.cc.
References OperationContextPimpl::memory(), and pimpl_.
Referenced by setMemory().
const Memory& OperationContext::memory | ( | ) | const |
|
private |
Assignment not allowed.
const InstructionAddress & OperationContext::programCounter | ( | ) |
Returns a reference to the current value of the program counter register.
The value of the program counter can be changed through this reference. This is used to implement control transfer operations like jumps and calls to subroutines.
Definition at line 152 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::programCounter().
Referenced by OperationDAGBehavior::areValid(), CmdTrigger::execute(), SimulationInfoDialog::handleEvent(), TesterContext::programCounter(), TransportPipeline::startOperation(), and SimulationInfoDialog::updateList().
const InstructionAddress& OperationContext::programCounter | ( | ) | const |
void OperationContext::registerState | ( | OperationState * | stateToRegister | ) |
Registers the operation state for given name.
Called in the createState() of the custom OperationBehavior classes. If state with given identifier is already found in the context, program is aborted. This method is only for internal use. Used by the macro definitions of OSAL.hh.
name | The identifier for the registered state instance. |
stateToRegister | The state instance. |
Definition at line 124 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::registerState().
const SimValue & OperationContext::returnAddress | ( | ) |
Returns a reference to the current value of the return address register.
The value of the return address can be changed through this reference. This is used in implementing calls to subroutines.
Definition at line 207 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::returnAddress().
Referenced by OperationDAGBehavior::areValid(), CmdTrigger::execute(), SimulationInfoDialog::handleEvent(), TesterContext::returnAddress(), TransportPipeline::startOperation(), and SimulationInfoDialog::updateList().
const SimValue& OperationContext::returnAddress | ( | ) | const |
bool OperationContext::saveReturnAddress | ( | ) |
Returns true if RA should saved before executing next control flow operation.
Definition at line 194 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::saveReturnAddress().
Referenced by CmdTrigger::execute(), and TransportPipeline::startOperation().
void OperationContext::setCycleCountVariable | ( | CycleCount & | cycleCount | ) |
Sets the variable that contains the current simulation cycle count at the best possible accuracy.
Used by real time operations to track simulation time during simulations.
Definition at line 300 of file OperationContext.cc.
References cycleCount(), pimpl_, and OperationContextPimpl::setCycleCountVariable().
Referenced by SimulationController::SimulationController().
void OperationContext::setMemory | ( | Memory * | memory | ) |
Sets the reference to a Memory Module instance.
This instance can be accessed by the function unit and behavior simulation methods to simulate memory access.
memory | The Memory instance. |
Definition at line 238 of file OperationContext.cc.
References memory(), pimpl_, and OperationContextPimpl::setMemory().
Referenced by main(), and MemoryAccessingFUState::MemoryAccessingFUState().
void OperationContext::setSaveReturnAddress | ( | bool | value | ) |
Makes the return address to be saved in the RA register.
This is used by CALL instruction to save the RA before jumping.
value | Value to set to. |
Definition at line 183 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::setSaveReturnAddress().
Referenced by TransportPipeline::startOperation().
void OperationContext::setStateRegistry | ( | StateRegistry & | stateRegistry | ) |
Definition at line 313 of file OperationContext.cc.
References pimpl_, OperationContextPimpl::setStateRegistry(), and stateRegistry().
Referenced by TransportPipeline::TransportPipeline().
void OperationContext::setUpdateProgramCounter | ( | bool | value | ) |
Definition at line 162 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::setUpdateProgramCounter().
Referenced by TransportPipeline::startOperation().
OperationState & OperationContext::state | ( | const char * | name | ) | const |
Looks up the (concrete) operation state identified by the string name.
name | The state identifier. |
KeyNotFound | If state by name couldn't be found. |
Definition at line 100 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::state().
OperationContext::StateRegistry & OperationContext::stateRegistry | ( | ) |
Definition at line 323 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::stateRegistry().
Referenced by setStateRegistry(), and TransportPipeline::TransportPipeline().
void OperationContext::unregisterState | ( | const char * | name | ) |
Unregisters the operation state of given name.
This method is only for internal use. Used by the macro definitions of OSAL.hh.
Called in deleteState() of the custom OperationBehavior classes. Aborts if there's no state with given identifier in the context.
Definition at line 138 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::unregisterState().
void OperationContext::unsetStateRegistry | ( | ) |
Definition at line 318 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::unsetStateRegistry().
Referenced by TransportPipeline::~TransportPipeline().
bool OperationContext::updateProgramCounter | ( | ) | const |
Definition at line 169 of file OperationContext.cc.
References pimpl_, and OperationContextPimpl::updateProgramCounter().
Referenced by TransportPipeline::startOperation().
|
private |
Implementation in separate source file to speed up compiling.
Definition at line 113 of file OperationContext.hh.
Referenced by advanceClock(), branchDelayCycles(), contextId(), cycleCount(), functionUnitName(), isEmpty(), memory(), programCounter(), registerState(), returnAddress(), saveReturnAddress(), setCycleCountVariable(), setMemory(), setSaveReturnAddress(), setStateRegistry(), setUpdateProgramCounter(), state(), stateRegistry(), unregisterState(), unsetStateRegistry(), updateProgramCounter(), and ~OperationContext().