OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
RFPortCode Class Reference

#include <RFPortCode.hh>

Inheritance diagram for RFPortCode:
Inheritance graph
Collaboration diagram for RFPortCode:
Collaboration graph

Public Member Functions

 RFPortCode (const std::string &regFile, unsigned int encoding, unsigned int extraBits, int indexWidth, SocketCodeTable &parent)
 
 RFPortCode (const std::string &regFile, int indexWidth, SocketCodeTable &parent)
 
 RFPortCode (const ObjectState *state, SocketCodeTable &parent)
 
virtual ~RFPortCode ()
 
virtual ObjectStatesaveState () const
 
- Public Member Functions inherited from PortCode
virtual ~PortCode ()
 
std::string unitName () const
 
bool hasEncoding () const
 
unsigned int encoding () const
 
unsigned int extraBits () const
 
int width () const
 
int encodingWidth () const
 
int indexWidth () const
 
void setMaxIndex (unsigned regIndex)
 
bool isMaxIndexSet () const
 
unsigned maxIndex () const
 
SocketCodeTableparent () const
 

Static Public Attributes

static const std::string OSNAME_RF_PORT_CODE = "rf_port_code"
 ObjectState name for RF port code.
 
- Static Public Attributes inherited from PortCode
static const std::string OSNAME_PORT_CODE = "port_code"
 ObjectState name for PortCode.
 
static const std::string OSKEY_UNIT_NAME = "unit_name"
 ObjectState attribute key for the name of the unit.
 
static const std::string OSKEY_ENCODING = "encoding"
 ObjectState attribute key for the encoding.
 
static const std::string OSKEY_EXTRA_BITS = "extra_bits"
 ObjectState attribute key for the number of extra bits.
 
static const std::string OSKEY_INDEX_WIDTH = "index_width"
 ObjectState attribute key for the widht of register index.
 
static const std::string OSKEY_MAX_INDEX = "max-index"
 ObjectState attribute key for the max-index attribute.
 

Additional Inherited Members

- Protected Member Functions inherited from PortCode
 PortCode (const std::string &unitName, unsigned int encoding, unsigned int extraBits, int indexWidth)
 
 PortCode (const std::string &unitName, int indexWidth)
 
 PortCode (const ObjectState *state)
 
void setParent (SocketCodeTable *parent)
 

Detailed Description

RFPortCode class defines a binary encoding for a register file port.

Definition at line 44 of file RFPortCode.hh.

Constructor & Destructor Documentation

◆ RFPortCode() [1/3]

RFPortCode::RFPortCode ( const std::string &  regFile,
unsigned int  encoding,
unsigned int  extraBits,
int  indexWidth,
SocketCodeTable parent 
)

The constructor.

Registers the created instance to the given socket code table automatically.

Parameters
regFileName of the register file.
encodingThe encoding for the register file port.
extraBitsThe number of extra zero bits in the encoding.
indexWidthThe number of bits reserved for the register index.
parentThe parent socket code table.
Exceptions
ObjectAlreadyExistsIf the socket code table has an encoding defined for the same port already, or if the encoding is ambiguous with another encoding in the same socket code table.
OutOfRangeIf some of the given values is out of range.

Definition at line 60 of file RFPortCode.cc.

64 setParent(NULL);
65 parent.addRFPortCode(*this);
67}
int indexWidth() const
Definition PortCode.cc:215
SocketCodeTable * parent() const
Definition PortCode.cc:226
unsigned int extraBits() const
Definition PortCode.cc:177
void setParent(SocketCodeTable *parent)
Definition PortCode.cc:256
unsigned int encoding() const
Definition PortCode.cc:164
void addRFPortCode(RFPortCode &code)

References SocketCodeTable::addRFPortCode(), PortCode::parent(), and PortCode::setParent().

Here is the call graph for this function:

◆ RFPortCode() [2/3]

RFPortCode::RFPortCode ( const std::string &  regFile,
int  indexWidth,
SocketCodeTable parent 
)

The constructor.

Creates an RF port code without port encoding. That is, the port code consists of mere register index. This is useful when the parent socket code table does not have other port codes. Registers the created instance to the given socket code table automatically.

Parameters
regFileName of the register file.
indexWidthThe number of bits reserved for the register index.
parentThe parent socket code table.
Exceptions
ObjectAlreadyExistsIf the socket code table has an encoding defined for the same port already, or if the encoding is ambiguous with another encoding in the same socket code table.
OutOfRangeIf the given index width is negative.

Definition at line 86 of file RFPortCode.cc.

88 : PortCode(regFile, indexWidth) {
89 setParent(NULL);
90 parent.addRFPortCode(*this);
92}

References SocketCodeTable::addRFPortCode(), PortCode::parent(), and PortCode::setParent().

Here is the call graph for this function:

◆ RFPortCode() [3/3]

RFPortCode::RFPortCode ( const ObjectState state,
SocketCodeTable parent 
)

The constructor.

Loads the state of the object from the given ObjectState tree.

Parameters
stateThe ObjectState tree.
parentThe parent encoding map.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.
ObjectAlreadyExistsIf the socket code table has an encoding defined for the same port already, or if the encoding is ambiguous with another encoding in the same socket code table.

Definition at line 108 of file RFPortCode.cc.

109 : PortCode(state) {
110 if (state->name() != OSNAME_RF_PORT_CODE) {
111 const string procName = "RFPortCode::RFPortCode";
112 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
113 }
114
115 setParent(NULL);
116 parent.addRFPortCode(*this);
118}
std::string name() const
static const std::string OSNAME_RF_PORT_CODE
ObjectState name for RF port code.
Definition RFPortCode.hh:57

References SocketCodeTable::addRFPortCode(), ObjectState::name(), OSNAME_RF_PORT_CODE, PortCode::parent(), and PortCode::setParent().

Here is the call graph for this function:

◆ ~RFPortCode()

RFPortCode::~RFPortCode ( )
virtual

The destructor.

Definition at line 123 of file RFPortCode.cc.

123 {
124 SocketCodeTable* parent = this->parent();
125 setParent(NULL);
126 parent->removeRFPortCode(*this);
127}
void removeRFPortCode(RFPortCode &code)

References PortCode::parent(), SocketCodeTable::removeRFPortCode(), and PortCode::setParent().

Here is the call graph for this function:

Member Function Documentation

◆ saveState()

ObjectState * RFPortCode::saveState ( ) const
virtual

Saves the state of the object to an ObjectState tree.

Returns
The newly created ObjectState tree.

Reimplemented from PortCode.

Definition at line 136 of file RFPortCode.cc.

136 {
139 return state;
140}
void setName(const std::string &name)
virtual ObjectState * saveState() const
Definition PortCode.cc:237

References OSNAME_RF_PORT_CODE, PortCode::saveState(), and ObjectState::setName().

Referenced by SocketCodeTable::saveState().

Here is the call graph for this function:

Member Data Documentation

◆ OSNAME_RF_PORT_CODE

const std::string RFPortCode::OSNAME_RF_PORT_CODE = "rf_port_code"
static

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