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

#include <FUPortCode.hh>

Inheritance diagram for FUPortCode:
Inheritance graph
Collaboration diagram for FUPortCode:
Collaboration graph

Public Member Functions

 FUPortCode (const std::string &fu, const std::string &port, unsigned int encoding, unsigned int extraBits, SocketCodeTable &parent)
 
 FUPortCode (const std::string &fu, const std::string &port, const std::string &operation, unsigned int encoding, unsigned int extraBits, SocketCodeTable &parent)
 
 FUPortCode (const ObjectState *state, SocketCodeTable &parent)
 
virtual ~FUPortCode ()
 
std::string portName () const
 
std::string operationName () const
 
bool hasOperation () const
 
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_FU_PORT_CODE = "fu_port_code"
 ObjectState name for FU port code.
 
static const std::string OSKEY_PORT_NAME = "port"
 ObjectState attribute key for the name of the port.
 
static const std::string OSKEY_OPERATION_NAME = "operation"
 ObjectState attribute key for the name of the operation.
 
- 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.
 

Private Attributes

std::string port_
 Name of the port.
 
std::string opName_
 Name of the operation.
 

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

Class FUPortCode represents the control code that identifies an FU port or, if the port carries an opcode, the combination of port and operation.

Definition at line 47 of file FUPortCode.hh.

Constructor & Destructor Documentation

◆ FUPortCode() [1/3]

FUPortCode::FUPortCode ( const std::string &  fu,
const std::string &  port,
unsigned int  encoding,
unsigned int  extraBits,
SocketCodeTable parent 
)

The constructor.

Creates an encoding for a FU port and registers it into a socket code table. The port is identified by a name string and by the name of its function unit.

Parameters
fuName of the function unit.
portName of the port.
encodingThe encoding.
extraBitsThe number of extra (zero) bits in the encoding.
parentThe parent socket code table.
Exceptions
ObjectAlreadyExistsIf the given socket code table already has a code for the same port 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 62 of file FUPortCode.cc.

65 : PortCode(fu, encoding, extraBits, 0), port_(port), opName_("") {
66 parent.addFUPortCode(*this);
68}
std::string opName_
Name of the operation.
Definition FUPortCode.hh:76
std::string port_
Name of the port.
Definition FUPortCode.hh:74
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 addFUPortCode(FUPortCode &code)

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

Here is the call graph for this function:

◆ FUPortCode() [2/3]

FUPortCode::FUPortCode ( const std::string &  fu,
const std::string &  port,
const std::string &  operation,
unsigned int  encoding,
unsigned int  extraBits,
SocketCodeTable parent 
)

The constructor.

Creates an encoding for a FU port and registers it into a socket code table. The port is identified by a name string, the operation carried by it and the name of the parent function unit.

Parameters
fuName of the function unit.
portName of the port.
operationName of the operation carried by the port.
encodingThe encoding for the port + operation.
extraBitsThe number of extra zero bits in the encoding.
parentThe parent socket code table.
Exceptions
ObjectAlreadyExistsIf the given socket code table already has a code for this port and the operation carried 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 90 of file FUPortCode.cc.

94 : PortCode(fu, encoding, extraBits, 0), port_(port), opName_(operation) {
95 parent.addFUPortCode(*this);
97}

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

Here is the call graph for this function:

◆ FUPortCode() [3/3]

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

The constructor.

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

Parameters
stateThe ObjectState tree.
parentThe parent socket code table.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.
ObjectAlreadyExistsIf the given socket code table already has a code for this port and the operation carried or if the encoding is ambiguous with another encoding in the same socket code table.

Definition at line 114 of file FUPortCode.cc.

115 : PortCode(state), port_(""), opName_("") {
116 const string procName = "FUPortCode::FUPortCode";
117
118 if (state->name() != OSNAME_FU_PORT_CODE) {
119 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
120 }
121
124 }
126
127 parent.addFUPortCode(*this);
129}
static const std::string OSNAME_FU_PORT_CODE
ObjectState name for FU port code.
Definition FUPortCode.hh:66
static const std::string OSKEY_OPERATION_NAME
ObjectState attribute key for the name of the operation.
Definition FUPortCode.hh:70
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
Definition FUPortCode.hh:68
bool hasAttribute(const std::string &name) const
std::string stringAttribute(const std::string &name) const
std::string name() const

References SocketCodeTable::addFUPortCode(), ObjectState::hasAttribute(), ObjectState::name(), opName_, OSKEY_OPERATION_NAME, OSKEY_PORT_NAME, OSNAME_FU_PORT_CODE, PortCode::parent(), port_, PortCode::setParent(), and ObjectState::stringAttribute().

Here is the call graph for this function:

◆ ~FUPortCode()

FUPortCode::~FUPortCode ( )
virtual

The destructor.

Definition at line 134 of file FUPortCode.cc.

134 {
135 SocketCodeTable* parent = this->parent();
136 setParent(NULL);
137 parent->removeFUPortCode(*this);
138}
void removeFUPortCode(FUPortCode &code)

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

Here is the call graph for this function:

Member Function Documentation

◆ hasOperation()

bool FUPortCode::hasOperation ( ) const

Tells whether this control code identifies also one of the operations carried by the FU port.

Returns
True if the control code identifies an operation, otherwise false.

Definition at line 176 of file FUPortCode.cc.

176 {
177 return opName_ != "";
178}

References opName_.

Referenced by SocketCodeTable::addFUPortCode(), SocketCodeTable::fuPortCode(), SocketCodeTable::fuPortCode(), portCodeDescription(), and saveState().

◆ operationName()

std::string FUPortCode::operationName ( ) const

Returns the name of the operation.

Returns
The name of the operation.
Exceptions
InstanceNotFoundIf this control code identifies a plain FU port without operation.

Definition at line 160 of file FUPortCode.cc.

160 {
161 if (opName_ == "") {
162 const string procName = "FUPortCode::operationName";
163 throw InstanceNotFound(__FILE__, __LINE__, procName);
164 }
165
166 return opName_;
167}

References opName_.

Referenced by SocketCodeTable::addFUPortCode(), SocketCodeTable::fuPortCode(), portCodeDescription(), and saveState().

◆ portName()

std::string FUPortCode::portName ( ) const

Returns the name of the port.

Returns
The name of the port.

Definition at line 147 of file FUPortCode.cc.

147 {
148 return port_;
149}

References port_.

Referenced by SocketCodeTable::addFUPortCode(), SocketCodeTable::fuPortCode(), SocketCodeTable::fuPortCode(), portCodeDescription(), and saveState().

◆ saveState()

ObjectState * FUPortCode::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 187 of file FUPortCode.cc.

187 {
191 if (hasOperation()) {
193 }
194 return state;
195}
std::string portName() const
std::string operationName() const
bool hasOperation() const
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
virtual ObjectState * saveState() const
Definition PortCode.cc:237

References hasOperation(), operationName(), OSKEY_OPERATION_NAME, OSKEY_PORT_NAME, OSNAME_FU_PORT_CODE, portName(), PortCode::saveState(), ObjectState::setAttribute(), and ObjectState::setName().

Referenced by SocketCodeTable::saveState().

Here is the call graph for this function:

Member Data Documentation

◆ opName_

std::string FUPortCode::opName_
private

Name of the operation.

Definition at line 76 of file FUPortCode.hh.

Referenced by FUPortCode(), hasOperation(), and operationName().

◆ OSKEY_OPERATION_NAME

const std::string FUPortCode::OSKEY_OPERATION_NAME = "operation"
static

ObjectState attribute key for the name of the operation.

Definition at line 70 of file FUPortCode.hh.

Referenced by FUPortCode(), saveState(), BEMSerializer::socketCodeTableToFile(), and BEMSerializer::socketCodeTableToOM().

◆ OSKEY_PORT_NAME

const std::string FUPortCode::OSKEY_PORT_NAME = "port"
static

ObjectState attribute key for the name of the port.

Definition at line 68 of file FUPortCode.hh.

Referenced by FUPortCode(), saveState(), BEMSerializer::socketCodeTableToFile(), and BEMSerializer::socketCodeTableToOM().

◆ OSNAME_FU_PORT_CODE

const std::string FUPortCode::OSNAME_FU_PORT_CODE = "fu_port_code"
static

◆ port_

std::string FUPortCode::port_
private

Name of the port.

Definition at line 74 of file FUPortCode.hh.

Referenced by FUPortCode(), and portName().


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