OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
RegisterState Class Reference

#include <RegisterState.hh>

Inheritance diagram for RegisterState:
Inheritance graph
Collaboration diagram for RegisterState:
Collaboration graph

Public Member Functions

 RegisterState (int width, bool constantZero=false)
 
 RegisterState (SimValue &sharedRegister)
 
virtual ~RegisterState ()
 
virtual void setValue (const SimValue &value)
 
virtual const SimValuevalue () const
 
- Public Member Functions inherited from StateData
 StateData ()
 
virtual ~StateData ()
 
- Public Member Functions inherited from WritableState
 WritableState ()
 
virtual ~WritableState ()
 
- Public Member Functions inherited from ReadableState
 ReadableState ()
 
virtual ~ReadableState ()
 

Protected Attributes

SimValuevalue_
 Value of the RegisterState.
 

Private Member Functions

 RegisterState (const RegisterState &)
 Copying not allowed.
 
RegisterStateoperator= (const RegisterState &)
 Assignment not allowed.
 

Private Attributes

bool shared_
 Is the storage of this RegisterState shared with someone else?
 
bool constantZero_
 Is this register constant zero?
 

Detailed Description

Class that represents the contents of a register.

Definition at line 50 of file RegisterState.hh.

Constructor & Destructor Documentation

◆ RegisterState() [1/3]

RegisterState::RegisterState ( int  width,
bool  constantZero = false 
)

Constructor.

Parameters
widthThe width of the register.
constantZeroTells whether the register is constant zero

Definition at line 50 of file RegisterState.cc.

50 :
51 StateData(), value_(*(new SimValue(width))), shared_(false),
52 constantZero_(constantZero) {
53}
SimValue & value_
Value of the RegisterState.
bool constantZero_
Is this register constant zero?
bool shared_
Is the storage of this RegisterState shared with someone else?

◆ RegisterState() [2/3]

RegisterState::RegisterState ( SimValue sharedRegister)

Constructor for RegisterState which shares the actual register storage.

Parameters
sharedRegisterThe register which is shared with this.

Definition at line 60 of file RegisterState.cc.

60 :
61 StateData(), value_(sharedRegister), shared_(true),
62 constantZero_(false) {
63}

◆ ~RegisterState()

RegisterState::~RegisterState ( )
virtual

Destructor.

Definition at line 68 of file RegisterState.cc.

68 {
69 if (!shared_) {
70 delete &value_;
71 }
72}

References shared_, and value_.

◆ RegisterState() [3/3]

RegisterState::RegisterState ( const RegisterState )
private

Copying not allowed.

Member Function Documentation

◆ operator=()

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

Assignment not allowed.

◆ setValue()

void RegisterState::setValue ( const SimValue value)
virtual

◆ value()

const SimValue & RegisterState::value ( ) const
virtual

Member Data Documentation

◆ constantZero_

bool RegisterState::constantZero_
private

Is this register constant zero?

Definition at line 73 of file RegisterState.hh.

Referenced by setValue().

◆ shared_

bool RegisterState::shared_
private

Is the storage of this RegisterState shared with someone else?

Definition at line 71 of file RegisterState.hh.

Referenced by ~RegisterState().

◆ value_

SimValue& RegisterState::value_
protected

Value of the RegisterState.

Todo:
Fix this mutable mess. It's needed because OutputPortState needs to mask the value_ in its value() implementation.

Definition at line 63 of file RegisterState.hh.

Referenced by setValue(), value(), and ~RegisterState().


The documentation for this class was generated from the following files: