OpenASIP  2.0
Public Member Functions | Static Public Attributes | List of all members
TTAMachine::SpecialRegisterPort Class Reference

#include <SpecialRegisterPort.hh>

Inheritance diagram for TTAMachine::SpecialRegisterPort:
Inheritance graph
Collaboration diagram for TTAMachine::SpecialRegisterPort:
Collaboration graph

Public Member Functions

 SpecialRegisterPort (const std::string &name, int width, ControlUnit &parent)
 
 SpecialRegisterPort (const ObjectState *state, Unit &parent)
 
virtual ~SpecialRegisterPort ()
 
virtual bool isTriggering () const
 
virtual bool isOpcodeSetting () const
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
- Public Member Functions inherited from TTAMachine::BaseFUPort
virtual ~BaseFUPort ()
 
FunctionUnitparentUnit () const
 
virtual int width () const
 
void setWidth (int width)
 
- Public Member Functions inherited from TTAMachine::Port
 Port (const std::string &name, Unit &parentUnit)
 
 Port (const ObjectState *state, Unit &parentUnit)
 
virtual ~Port ()
 
virtual std::string name () const
 
virtual void setName (const std::string &name)
 
virtual void attachSocket (Socket &socket)
 
virtual void detachSocket (Socket &socket)
 
virtual void detachAllSockets ()
 
UnitparentUnit () const
 
virtual SocketinputSocket () const
 
virtual SocketoutputSocket () const
 
virtual SocketunconnectedSocket (int index) const
 
virtual int socketCount () const
 
virtual bool isConnectedTo (const Socket &socket) const
 
virtual bool isOutput () const
 
virtual bool isInput () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_SPECIAL_REG_PORT = "sr_port"
 ObjectState name for special register port. More...
 
- Static Public Attributes inherited from TTAMachine::BaseFUPort
static const std::string OSKEY_WIDTH = "width"
 ObjectState attribute key for bit width of the port. More...
 
- Static Public Attributes inherited from TTAMachine::Port
static const std::string OSNAME_PORT = "port"
 ObjectState name for Port. More...
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the port. More...
 
static const std::string OSKEY_FIRST_SOCKET = "1_socket"
 ObjectState attribute key for the name of the connected socket. More...
 
static const std::string OSKEY_SECOND_SOCKET = "2_socket"
 ObjectState attribute key for the name of the other connected socket. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TTAMachine::BaseFUPort
 BaseFUPort (const std::string &name, int width, FunctionUnit &parent)
 
 BaseFUPort (const ObjectState *state, Unit &parent)
 
- Protected Member Functions inherited from TTAMachine::Port
 Port (const std::string &name, FunctionUnit &parentUnit)
 
- Protected Member Functions inherited from TTAMachine::SubComponent
 SubComponent ()
 
virtual ~SubComponent ()
 
- Protected Member Functions inherited from TTAMachine::MachinePart
 MachinePart ()
 
virtual ~MachinePart ()
 

Detailed Description

SpecialRegisterPort class represent a port of a special register in control unit.

An example of such a port is the return address port.

Definition at line 48 of file SpecialRegisterPort.hh.

Constructor & Destructor Documentation

◆ SpecialRegisterPort() [1/2]

TTAMachine::SpecialRegisterPort::SpecialRegisterPort ( const std::string &  name,
int  width,
ControlUnit parent 
)

The constructor.

Parameters
nameName of the port.
widthBit width of the port.
parentThe function unit to which the port belongs.
Exceptions
InvalidNameIf the given name is not a valid component name.
OutOfRangeIf the given bit width is less or equal to zero.
ComponentAlreadyExistsIf the function unit already has another port by the same name or another port that sets operation code.

Definition at line 57 of file SpecialRegisterPort.cc.

59  : BaseFUPort(name, width, parent) {}

◆ SpecialRegisterPort() [2/2]

TTAMachine::SpecialRegisterPort::SpecialRegisterPort ( const ObjectState state,
Unit parent 
)

The constructor.

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

Parameters
stateThe ObjectState tree.
parentThe parent unit of the port.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.

Definition at line 71 of file SpecialRegisterPort.cc.

72  : BaseFUPort(state, parent) {}

◆ ~SpecialRegisterPort()

TTAMachine::SpecialRegisterPort::~SpecialRegisterPort ( )
virtual

The destructor.

Definition at line 77 of file SpecialRegisterPort.cc.

77  {
78 }

Member Function Documentation

◆ isOpcodeSetting()

bool TTAMachine::SpecialRegisterPort::isOpcodeSetting ( ) const
virtual

Always returns false. SpecialRegisterPort cannot be operation code setting.

Returns
false

Implements TTAMachine::BaseFUPort.

Definition at line 99 of file SpecialRegisterPort.cc.

99  {
100  return false;
101 }

◆ isTriggering()

bool TTAMachine::SpecialRegisterPort::isTriggering ( ) const
virtual

Always returns false. SpecialRegisterPort cannot be triggering.

Returns
false

Implements TTAMachine::BaseFUPort.

Definition at line 87 of file SpecialRegisterPort.cc.

87  {
88  return false;
89 }

◆ loadState()

void TTAMachine::SpecialRegisterPort::loadState ( const ObjectState state)
virtual

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

Parameters
stateAn ObjectState instance representing state of a SpecialRegisterPort.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Reimplemented from TTAMachine::BaseFUPort.

Definition at line 126 of file SpecialRegisterPort.cc.

126  {
127  if (state->name() != OSNAME_SPECIAL_REG_PORT) {
128  const string procName = "SpecialRegisterPort::loadState";
129  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
130  }
131 
132  BaseFUPort::loadState(state);
133 }

References TTAMachine::BaseFUPort::loadState(), ObjectState::name(), and OSNAME_SPECIAL_REG_PORT.

Here is the call graph for this function:

◆ saveState()

ObjectState * TTAMachine::SpecialRegisterPort::saveState ( ) const
virtual

Saves the state of the object to an ObjectState tree and returns it.

Returns
The newly created ObjectState tree.

Reimplemented from TTAMachine::BaseFUPort.

Definition at line 110 of file SpecialRegisterPort.cc.

110  {
113  return state;
114 }

References OSNAME_SPECIAL_REG_PORT, TTAMachine::BaseFUPort::saveState(), and ObjectState::setName().

Here is the call graph for this function:

Member Data Documentation

◆ OSNAME_SPECIAL_REG_PORT

const std::string TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT = "sr_port"
static

ObjectState name for special register port.

Definition at line 62 of file SpecialRegisterPort.hh.

Referenced by loadState(), TTAMachine::Unit::loadState(), TTAMachine::Unit::loadStateWithoutReferences(), and saveState().


The documentation for this class was generated from the following files:
TTAMachine::BaseFUPort::BaseFUPort
BaseFUPort(const std::string &name, int width, FunctionUnit &parent)
Definition: BaseFUPort.cc:58
ObjectStateLoadingException
Definition: Exception.hh:551
ObjectState
Definition: ObjectState.hh:59
ObjectState::setName
void setName(const std::string &name)
TTAMachine::BaseFUPort::loadState
virtual void loadState(const ObjectState *state)
Definition: BaseFUPort.cc:153
ObjectState::name
std::string name() const
TTAMachine::BaseFUPort::saveState
virtual ObjectState * saveState() const
Definition: BaseFUPort.cc:136
TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT
static const std::string OSNAME_SPECIAL_REG_PORT
ObjectState name for special register port.
Definition: SpecialRegisterPort.hh:62
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TTAMachine::BaseFUPort::width
virtual int width() const
Definition: BaseFUPort.cc:109