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

#include <IUPortCode.hh>

Inheritance diagram for IUPortCode:
Inheritance graph
Collaboration diagram for IUPortCode:
Collaboration graph

Public Member Functions

 IUPortCode (const std::string &immediateUnit, unsigned int encoding, unsigned int extraBits, int indexWidth, SocketCodeTable &parent)
 
 IUPortCode (const std::string &immediateUnit, int indexWidth, SocketCodeTable &parent)
 
 IUPortCode (const ObjectState *state, SocketCodeTable &parent)
 
virtual ~IUPortCode ()
 
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_IU_PORT_CODE = "iu_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

IUPortCode defined a binary encoding for an immediate unit port.

Definition at line 41 of file IUPortCode.hh.

Constructor & Destructor Documentation

◆ IUPortCode() [1/3]

IUPortCode::IUPortCode ( const std::string &  immediateUnit,
unsigned int  encoding,
unsigned int  extraBits,
int  indexWidth,
SocketCodeTable parent 
)

The constructor.

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

Parameters
immediateUnitName of the immediate unit.
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 IUPortCode.cc.

63 : PortCode(immediateUnit, encoding, extraBits, indexWidth) {
64 setParent(NULL);
65 parent.addIUPortCode(*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 addIUPortCode(IUPortCode &code)

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

Here is the call graph for this function:

◆ IUPortCode() [2/3]

IUPortCode::IUPortCode ( const std::string &  immediateUnit,
int  indexWidth,
SocketCodeTable parent 
)

The constructor.

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

Parameters
immediateUnitName of the immediate unit.
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 86 of file IUPortCode.cc.

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

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

Here is the call graph for this function:

◆ IUPortCode() [3/3]

IUPortCode::IUPortCode ( 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 IUPortCode.cc.

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

References SocketCodeTable::addIUPortCode(), ObjectState::name(), OSNAME_IU_PORT_CODE, PortCode::parent(), and PortCode::setParent().

Here is the call graph for this function:

◆ ~IUPortCode()

IUPortCode::~IUPortCode ( )
virtual

The destructor.

Definition at line 123 of file IUPortCode.cc.

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

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

Here is the call graph for this function:

Member Function Documentation

◆ saveState()

ObjectState * IUPortCode::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 IUPortCode.cc.

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

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

Referenced by SocketCodeTable::saveState().

Here is the call graph for this function:

Member Data Documentation

◆ OSNAME_IU_PORT_CODE

const std::string IUPortCode::OSNAME_IU_PORT_CODE = "iu_port_code"
static

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