OpenASIP  2.0
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. More...
 
- Static Public Attributes inherited from PortCode
static const std::string OSNAME_PORT_CODE = "port_code"
 ObjectState name for PortCode. More...
 
static const std::string OSKEY_UNIT_NAME = "unit_name"
 ObjectState attribute key for the name of the unit. More...
 
static const std::string OSKEY_ENCODING = "encoding"
 ObjectState attribute key for the encoding. More...
 
static const std::string OSKEY_EXTRA_BITS = "extra_bits"
 ObjectState attribute key for the number of extra bits. More...
 
static const std::string OSKEY_INDEX_WIDTH = "index_width"
 ObjectState attribute key for the widht of register index. More...
 
static const std::string OSKEY_MAX_INDEX = "max-index"
 ObjectState attribute key for the max-index attribute. More...
 

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);
66  setParent(&parent);
67 }

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);
91  setParent(&parent);
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);
117  setParent(&parent);
118 }

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 }

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  {
137  ObjectState* state = PortCode::saveState();
139  return state;
140 }

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:
SocketCodeTable::addIUPortCode
void addIUPortCode(IUPortCode &code)
Definition: SocketCodeTable.cc:544
ObjectStateLoadingException
Definition: Exception.hh:551
ObjectState
Definition: ObjectState.hh:59
ObjectState::setName
void setName(const std::string &name)
SocketCodeTable::removeIUPortCode
void removeIUPortCode(IUPortCode &code)
Definition: SocketCodeTable.cc:574
SocketCodeTable
Definition: SocketCodeTable.hh:68
PortCode::extraBits
unsigned int extraBits() const
Definition: PortCode.cc:177
PortCode::indexWidth
int indexWidth() const
Definition: PortCode.cc:215
PortCode::PortCode
PortCode(const std::string &unitName, unsigned int encoding, unsigned int extraBits, int indexWidth)
Definition: PortCode.cc:56
ObjectState::name
std::string name() const
PortCode::setParent
void setParent(SocketCodeTable *parent)
Definition: PortCode.cc:256
IUPortCode::OSNAME_IU_PORT_CODE
static const std::string OSNAME_IU_PORT_CODE
ObjectState name for RF port code.
Definition: IUPortCode.hh:55
PortCode::parent
SocketCodeTable * parent() const
Definition: PortCode.cc:226
PortCode::encoding
unsigned int encoding() const
Definition: PortCode.cc:164
PortCode::saveState
virtual ObjectState * saveState() const
Definition: PortCode.cc:237