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

#include <RegisterFileState.hh>

Inheritance diagram for RegisterFileState:
Inheritance graph
Collaboration diagram for RegisterFileState:
Collaboration graph

Public Member Functions

 RegisterFileState (int size, int width, bool zeroRegister=false)
 
virtual ~RegisterFileState ()
 
virtual RegisterStateregisterState (int index)
 
virtual std::size_t registerCount () const
 

Private Member Functions

 RegisterFileState (const RegisterFileState &)
 Copying not allowed. More...
 
RegisterFileStateoperator= (const RegisterFileState)
 Assignment not allowed. More...
 

Private Attributes

std::vector< RegisterState * > registerStates_
 Contains all the registers of the state. More...
 
bool zeroRegister_
 

Detailed Description

Class that manages RegisterState objects.

Definition at line 49 of file RegisterFileState.hh.

Constructor & Destructor Documentation

◆ RegisterFileState() [1/2]

RegisterFileState::RegisterFileState ( int  size,
int  width,
bool  zeroRegister = false 
)
explicit

Constructor.

Parameters
sizeThe size of the RegisterFileState.
widthWidth of the registers.
zeroRegisterTells whether the first index is hardcoded to zero

Definition at line 54 of file RegisterFileState.cc.

54  :
55  zeroRegister_(zeroRegister) {
56  if (zeroRegister_) {
57  registerStates_.push_back(new RegisterState(width, true));
58  } else {
59  registerStates_.push_back(new RegisterState(width, false));
60  }
61  for (int i = 1; i < size; i++) {
62  registerStates_.push_back(new RegisterState(width, false));
63  }
64 }

References registerStates_, and zeroRegister_.

◆ ~RegisterFileState()

RegisterFileState::~RegisterFileState ( )
virtual

Destructor.

Definition at line 69 of file RegisterFileState.cc.

References SequenceTools::deleteAllItems(), and registerStates_.

Here is the call graph for this function:

◆ RegisterFileState() [2/2]

RegisterFileState::RegisterFileState ( const RegisterFileState )
private

Copying not allowed.

Member Function Documentation

◆ operator=()

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

Assignment not allowed.

◆ registerCount()

std::size_t RegisterFileState::registerCount ( ) const
virtual

Returns the count of registers in the register file.

Returns
Count of registers.

Definition at line 95 of file RegisterFileState.cc.

95  {
96  return registerStates_.size();
97 }

References registerStates_.

Referenced by ProximRFDetailsCmd::Do(), and ProximRegisterWindow::loadRegisterFile().

◆ registerState()

RegisterState & RegisterFileState::registerState ( int  index)
virtual

Returns RegisterState with a given index.

Parameters
indexIndex of the wanted RegisterState.
Returns
RegisterState with a given index.
Exceptions
OutOfRangeIf index is out of range.

Reimplemented in NullRegisterFileState.

Definition at line 81 of file RegisterFileState.cc.

81  {
82  if (index < 0 || index > static_cast<int>(registerStates_.size()) - 1) {
83  string msg = "Register index out of range";
84  throw OutOfRange(__FILE__, __LINE__, __func__, msg);
85  }
86  return *registerStates_[index];
87 }

References __func__, and registerStates_.

Referenced by MachineStateBuilder::buildMachineState(), RFTestbenchGenerator::createStimulus(), ProximRFDetailsCmd::Do(), SimulatorFrontend::findBooleanRegister(), SimulatorFrontend::findRegister(), ProximRegisterWindow::loadRegisterFile(), and SimProgramBuilder::processBidirTerminal().

Member Data Documentation

◆ registerStates_

std::vector<RegisterState*> RegisterFileState::registerStates_
private

Contains all the registers of the state.

Definition at line 66 of file RegisterFileState.hh.

Referenced by registerCount(), RegisterFileState(), registerState(), and ~RegisterFileState().

◆ zeroRegister_

bool RegisterFileState::zeroRegister_
private

Definition at line 68 of file RegisterFileState.hh.

Referenced by RegisterFileState().


The documentation for this class was generated from the following files:
RegisterFileState::registerStates_
std::vector< RegisterState * > registerStates_
Contains all the registers of the state.
Definition: RegisterFileState.hh:66
OutOfRange
Definition: Exception.hh:320
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
__func__
#define __func__
Definition: Application.hh:67
RegisterState
Definition: RegisterState.hh:50
RegisterFileState::zeroRegister_
bool zeroRegister_
Definition: RegisterFileState.hh:68