OpenASIP
2.0
|
#include <GuardState.hh>
Public Member Functions | |
GuardState (const ReadableState &targetRegister, int latency) | |
virtual | ~GuardState () |
virtual const SimValue & | value () const |
virtual void | endClock () |
virtual void | advanceClock () |
Public Member Functions inherited from ClockedState | |
ClockedState () | |
virtual | ~ClockedState () |
virtual void | reset () |
this is called at (re)initialization of the simulation More... | |
Public Member Functions inherited from ReadableState | |
ReadableState () | |
virtual | ~ReadableState () |
Protected Member Functions | |
GuardState () | |
Only subclasses allowed to create empty GuardStates. More... | |
Private Member Functions | |
GuardState (const GuardState &) | |
Copying not allowed. More... | |
GuardState & | operator= (const GuardState &) |
Assignment not allowed. More... | |
Private Attributes | |
const ReadableState * | target_ |
The target register watched by this guard. More... | |
std::vector< SimValue > | history_ |
Value history ring buffer. More... | |
int | position_ |
History ring buffer position. Point to the index of the current value of the guard. More... | |
Models the programmer visible delay of guards with latency more than 1.
GuardState with latency of 1 is the default latency which can be modeled with a direct reference to the guarded register, thus this class should not be used to model such cases. Guard latency of 1 means that the guard value can be used in the same instruction in which the value itself can be used. Thus, in case of a register guard, the instruction following the write to the register. For example, guard with latency of 2 means that there is one instruction cycle after updating the value of the guard in which the new value is not yet visible, and so on. This latency is modeled with a ring buffer which represents the history of guard's target values.
Definition at line 60 of file GuardState.hh.
GuardState::GuardState | ( | const ReadableState & | targetRegister, |
int | latency | ||
) |
Constructor.
targetRegister | The target register this guard watches. |
latency | The total guard latency modeled. |
Definition at line 50 of file GuardState.cc.
References assert, history_, position_, and ReadableState::value().
|
virtual |
|
protected |
Only subclasses allowed to create empty GuardStates.
Constructor.
Creates an empty GuardState, only to be used by subclasses, i.e., NullGuardState.
Definition at line 67 of file GuardState.cc.
|
private |
Copying not allowed.
|
virtual |
Updates the guard value history.
Implements ClockedState.
Reimplemented in DirectGuardState.
Definition at line 89 of file GuardState.cc.
References history_, position_, target_, and ReadableState::value().
|
virtual |
Does nothing.
The guard history is updated in advanceClock().
Implements ClockedState.
Reimplemented in DirectGuardState.
Definition at line 82 of file GuardState.cc.
|
private |
Assignment not allowed.
|
virtual |
Returns the current value of the guard, taking the latency in account.
Implements ReadableState.
Reimplemented in DirectGuardState.
Definition at line 102 of file GuardState.cc.
|
private |
Value history ring buffer.
Definition at line 86 of file GuardState.hh.
Referenced by advanceClock(), GuardState(), and value().
|
private |
History ring buffer position. Point to the index of the current value of the guard.
Definition at line 89 of file GuardState.hh.
Referenced by advanceClock(), GuardState(), and value().
|
private |
The target register watched by this guard.
Definition at line 84 of file GuardState.hh.
Referenced by advanceClock().