OpenASIP
2.0
|
#include <UniversalFunctionUnit.hh>
Public Member Functions | |
UniversalFunctionUnit (const std::string &name, OperationPool &opPool) | |
virtual | ~UniversalFunctionUnit () |
virtual bool | hasOperation (const std::string &name) const |
virtual TTAMachine::HWOperation * | operation (const std::string &name) const |
virtual void | addPipelineElement (TTAMachine::PipelineElement &element) |
virtual void | loadState (const ObjectState *state) |
int | portCountWithWidth (int width) const |
TTAMachine::FUPort & | portWithWidth (int index, int width) const |
Public Member Functions inherited from TTAMachine::FunctionUnit | |
FunctionUnit (const std::string &name) | |
FunctionUnit (const ObjectState *state) | |
virtual | ~FunctionUnit () |
virtual FunctionUnit * | copy () const |
virtual void | setName (const std::string &name) |
virtual BaseFUPort * | port (const std::string &name) const |
virtual BaseFUPort * | port (int index) const |
virtual int | operationPortCount () const |
virtual bool | hasOperationPort (const std::string &name) const |
virtual FUPort * | operationPort (const std::string &name) const |
virtual FUPort * | operationPort (int index) const |
virtual BaseFUPort * | triggerPort () const |
virtual void | addOperation (HWOperation &operation) |
virtual void | deleteOperation (HWOperation &operation) |
virtual bool | hasOperationLowercase (const std::string &name) const |
virtual HWOperation * | operationLowercase (const std::string &name) const |
virtual HWOperation * | operation (int index) const |
virtual int | operationCount () const |
virtual void | operationNames (TCETools::CIStringSet &opNames) const |
virtual int | maxLatency () const |
virtual void | deletePipelineElement (PipelineElement &element) |
virtual int | pipelineElementCount () const |
virtual PipelineElement * | pipelineElement (int index) const |
virtual bool | hasPipelineElement (const std::string &name) const |
virtual PipelineElement * | pipelineElement (const std::string &name) const |
virtual AddressSpace * | addressSpace () const |
virtual void | setAddressSpace (AddressSpace *as) |
virtual bool | hasAddressSpace () const |
virtual void | cleanup (const std::string &resource) |
virtual void | unsetMachine () |
virtual ObjectState * | saveState () const |
virtual bool | isArchitectureEqual (const FunctionUnit *fu, const bool checkPortWidths=true) const |
bool | needsConflictDetection () const |
virtual int | orderNumber () const |
virtual void | setOrderNumber (int) |
Public Member Functions inherited from TTAMachine::Unit | |
virtual | ~Unit () |
virtual bool | hasPort (const std::string &name) const |
virtual int | portCount () const |
virtual int | outputPortCount (bool countBidir=false) const |
virtual int | inputPortCount (bool countBidir=false) const |
virtual int | bidirPortCount () const |
virtual void | setMachine (Machine &mach) |
Public Member Functions inherited from TTAMachine::Component | |
virtual | ~Component () |
virtual TCEString | name () const |
virtual Machine * | machine () const |
virtual void | ensureRegistration (const Component &component) const |
virtual bool | isRegistered () const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
Static Public Member Functions | |
static bool | is32BitOperation (const std::string &opName) |
Static Public Attributes | |
static const std::string | OC_SETTING_PORT_32 = "OCSetting32" |
Name of the 32 bit wide opcode setting port. More... | |
static const std::string | OC_SETTING_PORT_64 = "OCSetting64" |
Name of the 64 bit wide opcode setting port. More... | |
Static Public Attributes inherited from TTAMachine::FunctionUnit | |
static const std::string | OSNAME_FU = "fu" |
ObjectState name for function unit. More... | |
static const std::string | OSKEY_AS = "as" |
ObjectState attribute key for name of the address space. More... | |
static const std::string | OSKEY_ORDER_NUMBER = "order_no" |
ObjectState attribute key for FU order number name. More... | |
Static Public Attributes inherited from TTAMachine::Unit | |
static const std::string | OSNAME_UNIT = "unit" |
ObjectState name for Unit. More... | |
Static Public Attributes inherited from TTAMachine::Component | |
static const std::string | OSNAME_COMPONENT = "component" |
ObjectState name for component. More... | |
static const std::string | OSKEY_NAME = "name" |
ObjectState attribute key for the name of the component. More... | |
Private Member Functions | |
SmartHWOperation & | addSupportedOperation (const Operation &operation) |
void | ensureInputPorts (int width, int count) |
void | ensureOutputPorts (int width, int count) |
Private Attributes | |
OperationPool & | opPool_ |
Operation pool from which the operations are searched. More... | |
Static Private Attributes | |
static const std::string | OPERATIONS_OF_32_BITS [] |
Table of names of 32 bit operations. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from TTAMachine::FunctionUnit | |
void | unsetMachineDerived () |
Protected Member Functions inherited from TTAMachine::Unit | |
Unit (const std::string &name) | |
Unit (const ObjectState *state) | |
virtual void | removePort (Port &port) |
Protected Member Functions inherited from TTAMachine::Component | |
Component (const std::string &name) | |
Component (const ObjectState *state) | |
void | internalSetMachine (Machine &machine) |
void | internalUnsetMachine () |
Protected Member Functions inherited from TTAMachine::MachinePart | |
MachinePart () | |
virtual | ~MachinePart () |
UniversalFunctionUnit class represents a function unit which has all the operations of an operation pool. The operations are added on demand, not at construction.
Definition at line 50 of file UniversalFunctionUnit.hh.
UniversalFunctionUnit::UniversalFunctionUnit | ( | const std::string & | name, |
OperationPool & | opPool | ||
) |
The constructor.
name | Name of the function unit. |
opPool | The operation pool from which the operations are obtained on demand. |
InvalidName | If the given name is not a valid component name. |
Definition at line 64 of file UniversalFunctionUnit.cc.
|
virtual |
|
virtual |
Aborts the program. It should not be needed to add pipeline elements to universal function unit.
element | Never used. |
ComponentAlreadyExists | Never thrown. |
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 131 of file UniversalFunctionUnit.cc.
References Application::abortProgram(), and Application::writeToErrorLog().
|
private |
Adds the given operation to the function unit.
Adds input and/or output ports if there is not enough ports for the operands of the given operation. Operand bindings and pipeline are not created.
operation | The operation to be added. |
Definition at line 228 of file UniversalFunctionUnit.cc.
References Application::abortProgram(), assert, ensureInputPorts(), ensureOutputPorts(), is32BitOperation(), TTAMachine::HWOperation::name(), TTAMachine::HWOperation::numberOfInputs(), TTAMachine::HWOperation::numberOfOutputs(), operation(), and Application::writeToErrorLog().
Referenced by operation().
|
private |
Ensures that there is at least the given number of input ports of the given width.
Adds input ports if there is not enough ports.
width | Bit width of the ports to be ensured. |
count | The number of ports to be ensured. |
Definition at line 271 of file UniversalFunctionUnit.cc.
References assert, TTAMachine::Port::attachSocket(), TTAMachine::Port::inputSocket(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), OC_SETTING_PORT_32, OC_SETTING_PORT_64, TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), portCountWithWidth(), portWithWidth(), TTAMachine::Machine::socketNavigator(), Conversion::toString(), UM_INPUT_SOCKET_NAME, and TTAMachine::BaseFUPort::width().
Referenced by addSupportedOperation().
|
private |
Ensures that there is at least the given number of output ports of the given width.
Adds output ports if there is not enough ports.
width | Bit width of the ports to be ensured. |
count | The number of ports to be ensured. |
Definition at line 322 of file UniversalFunctionUnit.cc.
References assert, TTAMachine::Port::attachSocket(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), TTAMachine::Port::outputSocket(), TTAMachine::FunctionUnit::port(), portCountWithWidth(), portWithWidth(), TTAMachine::Machine::socketNavigator(), Conversion::toString(), UM_OUTPUT_SOCKET_NAME, and TTAMachine::BaseFUPort::width().
Referenced by addSupportedOperation().
|
virtual |
Tells whether the universal function unit has an operation of the given name.
Returns true even if the operation is not loaded yet but it exists in the operation pool.
name | Name of the operation. |
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 85 of file UniversalFunctionUnit.cc.
References NullOperation::instance(), TTAMachine::Component::name(), OperationPool::operation(), and opPool_.
Referenced by llvm::LLVMTCEBuilder::emitOperationMacro().
|
static |
Tells whether operation of the given name has 32 bits wide operands and return value.
opName | Name of the operation. |
Definition at line 358 of file UniversalFunctionUnit.cc.
References OPERATIONS_OF_32_BITS.
Referenced by addSupportedOperation(), and SmartHWOperation::SmartHWOperation().
|
virtual |
Aborts the program. It is not allowed to load UniversalFunctionUnit from an ObjectState instance. DO NOT CALL THIS METHOD!
state | Never used. |
ObjectStateLoadingException | Never thrown. |
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 147 of file UniversalFunctionUnit.cc.
References Application::abortProgram(), and Application::writeToErrorLog().
|
virtual |
Returns an operation by the given name.
Adds the operation to the function unit if it doen't exist yet but exist in the operation pool.
name | Name of the operation. |
InstanceNotFound | If an operation by the given name does not exist in the operation pool. |
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 102 of file UniversalFunctionUnit.cc.
References addSupportedOperation(), NullOperation::instance(), TTAMachine::Component::name(), OperationPool::operation(), and opPool_.
Referenced by addSupportedOperation(), TTAProgram::CodeGenerator::createBreakOperation(), TTAProgram::CodeGenerator::createForLoopBufferInit(), TTAProgram::CodeGenerator::createTerminalFUPort(), TTAProgram::CodeGenerator::createWhileLoopBufferInit(), and llvm::LLVMTCEBuilder::emitOperationMacro().
int UniversalFunctionUnit::portCountWithWidth | ( | int | width | ) | const |
Returns the number of ports of the given bit width.
width | The bit width. |
OutOfRange | If the given bit width is out of range. |
Definition at line 164 of file UniversalFunctionUnit.cc.
Referenced by ensureInputPorts(), ensureOutputPorts(), SmartHWOperation::port(), and portWithWidth().
FUPort & UniversalFunctionUnit::portWithWidth | ( | int | index, |
int | width | ||
) | const |
By the given index, returns a port which has the given bit width.
index | The index. |
width | The bit width. |
OutOfRange | If the given bit width or index is out of range. |
Definition at line 190 of file UniversalFunctionUnit.cc.
References assert, TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), portCountWithWidth(), and TTAMachine::BaseFUPort::width().
Referenced by ensureInputPorts(), ensureOutputPorts(), and SmartHWOperation::port().
|
static |
Name of the 32 bit wide opcode setting port.
Definition at line 66 of file UniversalFunctionUnit.hh.
Referenced by ensureInputPorts(), and SmartHWOperation::port().
|
static |
Name of the 64 bit wide opcode setting port.
Definition at line 68 of file UniversalFunctionUnit.hh.
Referenced by ensureInputPorts(), and SmartHWOperation::port().
|
staticprivate |
Table of names of 32 bit operations.
Definition at line 78 of file UniversalFunctionUnit.hh.
Referenced by is32BitOperation().
|
private |
Operation pool from which the operations are searched.
Definition at line 76 of file UniversalFunctionUnit.hh.
Referenced by hasOperation(), and operation().