OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TTAMachine::FunctionUnit Class Reference

#include <FunctionUnit.hh>

Inheritance diagram for TTAMachine::FunctionUnit:
Inheritance graph
Collaboration diagram for TTAMachine::FunctionUnit:
Collaboration graph

Public Member Functions

 FunctionUnit (const std::string &name)
 
 FunctionUnit (const ObjectState *state)
 
virtual ~FunctionUnit ()
 
virtual FunctionUnitcopy () const
 
virtual void setName (const std::string &name)
 
virtual BaseFUPortport (const std::string &name) const
 
virtual BaseFUPortport (int index) const
 
virtual int operationPortCount () const
 
virtual bool hasOperationPort (const std::string &name) const
 
virtual FUPortoperationPort (const std::string &name) const
 
virtual FUPortoperationPort (int index) const
 
virtual BaseFUPorttriggerPort () const
 
virtual void addOperation (HWOperation &operation)
 
virtual void deleteOperation (HWOperation &operation)
 
virtual bool hasOperation (const std::string &name) const
 
virtual bool hasOperationLowercase (const std::string &name) const
 
virtual HWOperationoperation (const std::string &name) const
 
virtual HWOperationoperationLowercase (const std::string &name) const
 
virtual HWOperationoperation (int index) const
 
virtual int operationCount () const
 
virtual void operationNames (TCETools::CIStringSet &opNames) const
 
virtual int maxLatency () const
 
virtual void addPipelineElement (PipelineElement &element)
 
virtual void deletePipelineElement (PipelineElement &element)
 
virtual int pipelineElementCount () const
 
virtual PipelineElementpipelineElement (int index) const
 
virtual bool hasPipelineElement (const std::string &name) const
 
virtual PipelineElementpipelineElement (const std::string &name) const
 
virtual AddressSpaceaddressSpace () const
 
virtual void setAddressSpace (AddressSpace *as)
 
virtual bool hasAddressSpace () const
 
virtual void cleanup (const std::string &resource)
 
virtual void unsetMachine ()
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
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 Machinemachine () const
 
virtual void ensureRegistration (const Component &component) const
 
virtual bool isRegistered () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_FU = "fu"
 ObjectState name for function unit.
 
static const std::string OSKEY_AS = "as"
 ObjectState attribute key for name of the address space.
 
static const std::string OSKEY_ORDER_NUMBER = "order_no"
 ObjectState attribute key for FU order number name.
 
- Static Public Attributes inherited from TTAMachine::Unit
static const std::string OSNAME_UNIT = "unit"
 ObjectState name for Unit.
 
- Static Public Attributes inherited from TTAMachine::Component
static const std::string OSNAME_COMPONENT = "component"
 ObjectState name for component.
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the component.
 

Protected Member Functions

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 ()
 

Private Types

typedef std::vector< HWOperation * > OperationTable
 Container for operations.
 
typedef std::vector< PipelineElement * > PipelineElementTable
 Container for pipeline elements.
 

Private Member Functions

 FunctionUnit (const FunctionUnit &)
 Copying forbidden.
 
void cleanupGuards () const
 
void loadStateWithoutReferences (const ObjectState *fuState)
 
void deleteAllOperations ()
 

Private Attributes

OperationTable operations_
 Contains all the operations of the function unit.
 
PipelineElementTable pipelineElements_
 Contains all the pipeline elements of the function unit.
 
AddressSpaceaddressSpace_
 Address space used by the function unit.
 
int orderNumber_
 Number indicating possition of the FU in the ADF file. Alows putting the FU into the order in the instruction.
 

Detailed Description

Represents a function unit in machine object model.

Definition at line 55 of file FunctionUnit.hh.

Member Typedef Documentation

◆ OperationTable

Container for operations.

Definition at line 130 of file FunctionUnit.hh.

◆ PipelineElementTable

Container for pipeline elements.

Definition at line 132 of file FunctionUnit.hh.

Constructor & Destructor Documentation

◆ FunctionUnit() [1/3]

TTAMachine::FunctionUnit::FunctionUnit ( const std::string &  name)

Constructor.

Parameters
nameName of the function unit.
Exceptions
InvalidNameIf the given name is not a valid component name.

Definition at line 66 of file FunctionUnit.cc.

67 : Unit(name), addressSpace_(NULL), orderNumber_(0) {}
virtual TCEString name() const
int orderNumber_
Number indicating possition of the FU in the ADF file. Alows putting the FU into the order in the ins...
AddressSpace * addressSpace_
Address space used by the function unit.
Unit(const std::string &name)
Definition Unit.cc:59

◆ FunctionUnit() [2/3]

TTAMachine::FunctionUnit::FunctionUnit ( const ObjectState state)

Constructor.

Loads the state of the function unit from the given ObjectState instance. Does not load references to other components.

Parameters
stateThe ObjectState instance to load the state from.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 79 of file FunctionUnit.cc.

80 : Unit(state), addressSpace_(NULL), orderNumber_(0) {
82}
void loadStateWithoutReferences(const ObjectState *fuState)

References loadStateWithoutReferences().

Here is the call graph for this function:

◆ ~FunctionUnit()

TTAMachine::FunctionUnit::~FunctionUnit ( )
virtual

Destructor.

Deletes all the operations.

Definition at line 89 of file FunctionUnit.cc.

References deleteAllOperations(), and unsetMachine().

Here is the call graph for this function:

◆ FunctionUnit() [3/3]

TTAMachine::FunctionUnit::FunctionUnit ( const FunctionUnit )
private

Copying forbidden.

Member Function Documentation

◆ addOperation()

void TTAMachine::FunctionUnit::addOperation ( HWOperation operation)
virtual

Adds an operation into the function unit. This method is called from HWOperation constructor. Do not use this method.

Parameters
operationOperation which is added.
Exceptions
ComponentAlreadyExistsIf there is already an operation by the same name as the given operation.

Definition at line 286 of file FunctionUnit.cc.

286 {
287 // run time check that this method is called from HWOperation constructor
288 // only.
289 assert(operation.parentUnit() == NULL);
290
292 operations_.push_back(&operation);
293 } else {
294 string procName = "FunctionUnit::addOperation";
295 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
296 }
297}
#define assert(condition)
virtual HWOperation * operation(const std::string &name) const
OperationTable operations_
Contains all the operations of the function unit.
virtual bool hasOperation(const std::string &name) const
const std::string & name() const
FunctionUnit * parentUnit() const

References assert, hasOperation(), TTAMachine::HWOperation::name(), operation(), operations_, and TTAMachine::HWOperation::parentUnit().

Referenced by TTAMachine::HWOperation::HWOperation(), and TTAMachine::HWOperation::HWOperation().

Here is the call graph for this function:

◆ addPipelineElement()

void TTAMachine::FunctionUnit::addPipelineElement ( PipelineElement element)
virtual

Adds a pipeline element to the function unit.

Pipeline elements are added automatically if some operation uses it. Clients must not add pipeline elements explicitly. PipelineElement adds itself automatically to the parent function when it is created.

Parameters
nameName of the pipeline element.
Exceptions
ComponentAlreadyExistsIf there is already a pipeline element by the given name.

Reimplemented in UniversalFunctionUnit.

Definition at line 466 of file FunctionUnit.cc.

466 {
467 // sanity check to verify that this is called from PipelineElement's
468 // constructor
469 assert(element.parentUnit() == NULL);
470
471 string name = element.name();
473 string procName = "FunctionUnit::addPipelineElement";
474 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
475 } else {
476 pipelineElements_.push_back(&element);
477 }
478}
virtual bool hasPipelineElement(const std::string &name) const
PipelineElementTable pipelineElements_
Contains all the pipeline elements of the function unit.

References assert, hasPipelineElement(), TTAMachine::Component::name(), TTAMachine::PipelineElement::name(), TTAMachine::PipelineElement::parentUnit(), and pipelineElements_.

Referenced by TTAMachine::PipelineElement::PipelineElement().

Here is the call graph for this function:

◆ addressSpace()

AddressSpace * TTAMachine::FunctionUnit::addressSpace ( ) const
virtual

Returns the address space used by the function unit.

Returns
The address space used by the function unit.

Definition at line 580 of file FunctionUnit.cc.

580 {
581 return addressSpace_;
582}

References addressSpace_.

Referenced by llvm::LLVMTCEBuilder::addCandidateLSUAnnotations(), ProGe::NetlistGenerator::addFUExternalPortsToNetlist(), ADFCombiner::addFunctionUnits(), ProGe::ProcessorWrapperBlock::addInstructionMemory(), MachineStateBuilder::buildMachineState(), ProGe::NetlistGenerator::calculateAddressWidth(), AddressSpaceCheck::check(), MachineValidator::checkGCUHasAddressSpace(), MachineValidator::checkIMemAddrWidth(), BEMValidator::checkImemMauWidth(), MachineResourceManager::codeAddressSpace(), TTAProgram::ProgramWriter::createASpaceElement(), TTAProgram::ProgramWriter::createBinary(), FUFactory::createEditPart(), FUGen::createExternalInterfaces(), PlatformIntegrator::createMemories(), OpsetDialog::createOperation(), TTAProgram::CodeGenerator::createSchedYieldProcedure(), MachineInfo::defaultDataAddressSpace(), PasteComponentCmd::Do(), llvm::LLVMTCEBuilder::emitOperationMacro(), ITemplateBroker::findITemplates(), AlmaIFIntegrator::findMemories(), FUGen::FUGen(), CompiledSimCodeGenerator::generateConstructorCode(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateLoadTrigger(), ProgramImageGenerator::generateProgramImage(), ProGe::ProcessorGenerator::iMemAddressWidth(), ProGe::ProcessorGenerator::iMemWidth(), llvm::LLVMTCEBuilder::initDataSections(), SimulatorFrontend::initializeMemorySystem(), ProGe::NetlistGenerator::instructionMemory(), isArchitectureEqual(), isInstructionMemory(), MachineInfo::maxMemoryAlignment(), PlatformIntegrator::parseDataMemories(), printLatexAddressSpaceDescription(), printLatexFunctionUnitDescription(), ProgrammabilityValidator::ProgrammabilityValidator(), ProGe::ProGeUI::readImemParameters(), PlatformIntegrator::readLsuParameters(), TTAProgram::Program::replaceUniversalAddressSpaces(), MachineConnectivityCheck::requiredImmediateWidth(), CodeCompressorPlugin::setImemWidth(), CodeCompressorPlugin::setMachine(), TTAMachine::AddressSpace::unsetMachine(), FUDialog::updateAddressSpaceChoice(), GCUDialog::updateAddressSpaceChoice(), CompiledSimCodeGenerator::updateDeclaredSymbolsList(), and llvm::LLVMTCEIRBuilder::writeMachineFunction().

◆ cleanup()

void TTAMachine::FunctionUnit::cleanup ( const std::string &  resource)
virtual

Deletes a pipeline element by the given name if it is not used by any operation.

Definition at line 622 of file FunctionUnit.cc.

622 {
623
624 if (!hasPipelineElement(resource)) {
625 return;
626 }
627
628 for (int i = 0; i < operationCount(); i++) {
629 HWOperation* operation = this->operation(i);
630 ExecutionPipeline* pLine = operation->pipeline();
631 for (int cycle = 0; cycle < pLine->latency(); cycle++) {
632 if (pLine->isResourceUsed(resource, cycle)) {
633 return;
634 }
635 }
636 }
637
638
639 PipelineElement* toDelete = pipelineElement(resource);
640 delete toDelete;
641}
virtual int operationCount() const
virtual PipelineElement * pipelineElement(int index) const
ExecutionPipeline * pipeline() const

References hasPipelineElement(), TTAMachine::ExecutionPipeline::isResourceUsed(), TTAMachine::ExecutionPipeline::latency(), operation(), operationCount(), TTAMachine::HWOperation::pipeline(), and pipelineElement().

Referenced by TTAMachine::ExecutionPipeline::internalRemoveResourceUse(), and TTAMachine::ExecutionPipeline::removeAllResourceUses().

Here is the call graph for this function:

◆ cleanupGuards()

void TTAMachine::FunctionUnit::cleanupGuards ( ) const
private

Cleans up the guards that refer to a port of this function unit.

Definition at line 830 of file FunctionUnit.cc.

830 {
831
832 Machine* mach = machine();
833 if (mach == NULL) {
834 return;
835 }
836
837 Machine::BusNavigator navi = mach->busNavigator();
838 for (int busIndex = 0; busIndex < navi.count(); busIndex++) {
839 Bus* bus = navi.item(busIndex);
840 int guardIndex = 0;
841 while (guardIndex < bus->guardCount()) {
842 Guard* guard = bus->guard(guardIndex);
843 PortGuard* portGuard =
844 dynamic_cast<PortGuard*>(guard);
845 if (portGuard != NULL) {
846 BaseFUPort* port = portGuard->port();
847 FunctionUnit* referenced = port->parentUnit();
848 if (referenced == this) {
849
850 // guard is removed from bus automatically
851 delete portGuard;
852 } else {
853 guardIndex++;
854 }
855 } else {
856 guardIndex++;
857 }
858 }
859 }
860}
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
virtual Machine * machine() const
FunctionUnit(const std::string &name)
virtual BaseFUPort * port(const std::string &name) const
Navigator< Bus > BusNavigator
Navigator type for BusNavigator.
Definition Machine.hh:213

References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::guard(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::PortGuard::port(), and port().

Referenced by unsetMachine().

Here is the call graph for this function:

◆ copy()

FunctionUnit * TTAMachine::FunctionUnit::copy ( ) const
virtual

Copies the instance.

Current FunctionUnit state is copied to a new FunctionUnit object.

Returns
Copy of the instance.

Reimplemented in TTAMachine::ControlUnit.

Definition at line 103 of file FunctionUnit.cc.

103 {
104
105 return new FunctionUnit(saveState());
106}
virtual ObjectState * saveState() const

References saveState().

Referenced by HDB::FUArchitecture::FUArchitecture().

Here is the call graph for this function:

◆ deleteAllOperations()

void TTAMachine::FunctionUnit::deleteAllOperations ( )
private

Deletes all the operations of the function unit.

Definition at line 899 of file FunctionUnit.cc.

899 {
900 while (operations_.size() > 0) {
901 delete operations_[0];
902 }
903}

References operations_.

Referenced by loadStateWithoutReferences(), and ~FunctionUnit().

◆ deleteOperation()

void TTAMachine::FunctionUnit::deleteOperation ( HWOperation operation)
virtual

Deletes an operation from the function unit.

Destructor of the operation is called.

Parameters
operationOperation to be deleted.
Exceptions
InstanceNotFoundIf the given operation doesn't belong to this function unit.

Definition at line 309 of file FunctionUnit.cc.

309 {
310 if (operation.parentUnit() == NULL) {
312 &operation);
313 assert(removed);
314 } else {
316 string procName = "FunctionUnit::deleteOperation";
317 throw InstanceNotFound(__FILE__, __LINE__, procName);
318 }
319 delete &operation;
320 }
321}
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
static bool containsValue(const ContainerType &aContainer, const ElementType &aKey)

References assert, ContainerTools::containsValue(), operation(), operations_, TTAMachine::HWOperation::parentUnit(), and ContainerTools::removeValueIfExists().

Referenced by TTAMachine::HWOperation::~HWOperation().

Here is the call graph for this function:

◆ deletePipelineElement()

void TTAMachine::FunctionUnit::deletePipelineElement ( PipelineElement element)
virtual

Deletes the given pipeline element from function unit.

The pipeline element is automatically deleted if it is not used by any of the operations. Clients must not use this method!

Parameters
elementThe pipeline element to delete.

Definition at line 489 of file FunctionUnit.cc.

489 {
490
491 // sanity check to verify that this is called from PipelineElement's
492 // destructor.
493 assert(element.parentUnit() == NULL);
494
496 pipelineElements_, &element);
497 assert(removed);
498}

References assert, TTAMachine::PipelineElement::parentUnit(), pipelineElements_, and ContainerTools::removeValueIfExists().

Referenced by TTAMachine::PipelineElement::~PipelineElement().

Here is the call graph for this function:

◆ hasAddressSpace()

bool TTAMachine::FunctionUnit::hasAddressSpace ( ) const
virtual

◆ hasOperation()

bool TTAMachine::FunctionUnit::hasOperation ( const std::string &  name) const
virtual

Returns true if the requested operation exists in the function unit.

Parameters
operationName of the operation.
Returns
True if the requested operation exists in the function unit.

Reimplemented in UniversalFunctionUnit.

Definition at line 330 of file FunctionUnit.cc.

330 {
332}
static std::string stringToLower(const std::string &source)
virtual bool hasOperationLowercase(const std::string &name) const

References hasOperationLowercase(), TTAMachine::Component::name(), and StringTools::stringToLower().

Referenced by llvm::LLVMTCEBuilder::addCandidateLSUAnnotations(), addOperation(), HDB::HDBManager::addOperationPipelinesToFUArchitecture(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), OutputFUBroker::allAvailableResources(), MachineValidator::checkIMemAddrWidth(), MachineValidator::checkJumpAndCallOperandBindings(), MachineValidator::checkProgramCounterPort(), MachineValidator::checkRAPortHasSameWidthAsPCPort(), MachineValidator::checkReturnAddressPort(), TTAProgram::CodeGenerator::createBreakOperation(), TTAProgram::CodeGenerator::createForLoopBufferInit(), OpsetDialog::createOperation(), createTerminalFUPort(), VectorLSGenerator::createVectorLSU(), TTAProgram::CodeGenerator::createWhileLoopBufferInit(), ProGe::NetlistGenerator::findCorrespondingPort(), TTAProgram::TPEFProgramFactory::findFunctionUnit(), MachineInfo::findLockUnits(), TTAProgram::TPEFProgramFactory::findPort(), MachineConnectivityCheck::findPossibleDestinationPorts(), MachineConnectivityCheck::findPossibleSourcePorts(), BasicBlockScheduler::findTrigger(), MinimalOpSetCheck::fix(), MachineResourceManager::functionUnitPortResource(), MachineInfo::getBoundPort(), MachineInfo::getPortBindingsOfOperation(), BasicBlockScheduler::getTriggerOperand(), llvm::LLVMTCEBuilder::hasAmbiguousASpaceRefs(), TTAMachine::Machine::hasOperation(), ProGe::ProcessorGenerator::iMemAddressWidth(), TTAProgram::TPEFResourceUpdater::initCache(), ProgramOperation::isLegalFU(), HDB::HDBManager::isMatchingArchitecture(), ProGe::RV32MicroCodeGenerator::mapFunctionUnit(), MachineInfo::maxLatency(), FUDialog::onAddOperation(), GCUDialog::onAddOperation(), TTAProgram::TPEFResourceUpdater::operand(), UniversalFunctionUnit::operation(), BFLateBypassGuard::operator()(), BFShareOperands::operator()(), BFEarlyGuardBypass::operator()(), BF2Scheduler::preAllocateFunctionUnitsInner(), MachineConnectivityCheck::raConnected(), BF2Scheduler::releasePortForOp(), RegisterCopyAdder::requiredRegisterCopiesForEachFU(), HDB::HDBManager::resolveArchitecturePort(), MachineResourceManager::rFPortOrFUIndexReference(), MachineInfo::supportsBoolRegisterGuardedJumps(), MachineInfo::supportsPortGuardedJump(), MachineInfo::supportsPortGuardedJumps(), TTAProgram::ProgramWriter::terminalResource(), MachineInfo::triggerIndex(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), TDGen::writeHWLoopDef(), and llvm::LLVMTCEIRBuilder::writeMachineFunction().

Here is the call graph for this function:

◆ hasOperationLowercase()

bool TTAMachine::FunctionUnit::hasOperationLowercase ( const std::string &  name) const
virtual

Returns true if the requested operation exists in the function unit.

Parameters
operationName of the operation which MUST be in lowercase.
Returns
True if the requested operation exists in the function unit.

Definition at line 341 of file FunctionUnit.cc.

341 {
342 OperationTable::const_iterator iter = operations_.begin();
343 while (iter != operations_.end()) {
344 if ((*iter)->name() == name) {
345 return true;
346 }
347 iter++;
348 }
349 return false;
350}

References TTAMachine::Component::name(), and operations_.

Referenced by InputFUBroker::allAvailableResources(), MachineConnectivityCheck::busConnectedToFU(), hasOperation(), and ProGe::NetlistGenerator::isLSU().

Here is the call graph for this function:

◆ hasOperationPort()

bool TTAMachine::FunctionUnit::hasOperationPort ( const std::string &  name) const
virtual

Tells whether the function unit has an operation port with the given name.

Parameters
nameName of the port.
Returns
True if the function unit has the operation port, otherwise false.

Definition at line 204 of file FunctionUnit.cc.

204 {
205 if (!hasPort(name)) {
206 return false;
207 } else {
208 Port* port = this->port(name);
209 return dynamic_cast<FUPort*>(port) != NULL;
210 }
211}
virtual bool hasPort(const std::string &name) const
Definition Unit.cc:96
friend class Port
Definition Unit.hh:99

References TTAMachine::Unit::hasPort(), TTAMachine::Component::name(), and port().

Referenced by HDB::HDBManager::addFUImplementation(), TTAProgram::ProgramWriter::createCodeSection(), ProGe::NetlistGenerator::findCorrespondingPort(), TTAMachine::ControlUnit::hasSpecialRegisterPort(), GCUDialog::onEditPort(), and HDB::FUArchitecture::portDirection().

Here is the call graph for this function:

◆ hasPipelineElement()

bool TTAMachine::FunctionUnit::hasPipelineElement ( const std::string &  name) const
virtual

Returns true if the function unit has a pipeline element by the given name.

Returns
True if the function unit has a pipeline element by the given name.

Definition at line 540 of file FunctionUnit.cc.

540 {
541 PipelineElementTable::const_iterator iter = pipelineElements_.begin();
542 while (iter != pipelineElements_.end()) {
543 if ((*iter)->name() == name) {
544 return true;
545 }
546 iter++;
547 }
548 return false;
549}

References TTAMachine::Component::name(), and pipelineElements_.

Referenced by TTAMachine::ExecutionPipeline::addPipelineElement(), addPipelineElement(), cleanup(), isArchitectureEqual(), OperationDialog::onAddResource(), OperationDialog::onResourceLClick(), and TTAMachine::ExecutionPipeline::removeResourceUse().

Here is the call graph for this function:

◆ isArchitectureEqual()

bool TTAMachine::FunctionUnit::isArchitectureEqual ( const FunctionUnit fu,
const bool  checkPortWidths = true 
) const
virtual

Compares two FunctionUnit architectures.

Names are not compared. Port width comparison can be omitted.

Parameters
fuFunction unit to compare with.
checkPortWidthsBoolean for if port widths are matched or not. Defaul is true.
Returns
True if the architectures match otherwise false.

Definition at line 747 of file FunctionUnit.cc.

748 {
749 if (operationCount() != fu->operationCount()) {
750 return false;
751 }
752 int fuPortCount = fu->operationPortCount();
753 if (operationPortCount() != fuPortCount) {
754 return false;
755 }
756 int fuPipelineElementCount = fu->pipelineElementCount();
757 if (pipelineElementCount() != fuPipelineElementCount) {
758 return false;
759 }
760 if (addressSpace() != NULL && fu->addressSpace() != NULL) {
761 if (addressSpace()->name() != fu->addressSpace()->name()) {
762 return false;
763 }
764 } else if ((addressSpace() == NULL && fu->addressSpace() != NULL) ||
765 (addressSpace() != NULL && fu->addressSpace() == NULL)) {
766 return false;
767 }
768 for (int i = 0; i < fuPipelineElementCount; i++) {
769 string element = pipelineElement(i)->name();
770 if (fu->hasPipelineElement(element)) {
771 return false;
772 }
773 }
774 for (int i = 0; i < fuPortCount; i++) {
775 if (checkPortWidths) {
776 if (!operationPort(i)->isArchitectureEqual(fu->operationPort(i))) {
777 return false;
778 }
779 } else {
780 if (operationPort(i)->isTriggering() !=
781 fu->operationPort(i)->isTriggering()) {
782 return false;
783 }
784 if (operationPort(i)->isOpcodeSetting() !=
785 fu->operationPort(i)->isOpcodeSetting()) {
786 return false;
787 }
788 }
789 }
790 if (!(ResourceVectorSet(*this) == ResourceVectorSet(*fu))) {
791 return false;
792 }
793 return true;
794}
virtual bool isTriggering() const
Definition FUPort.cc:182
virtual bool isOpcodeSetting() const
Definition FUPort.cc:195
virtual AddressSpace * addressSpace() const
virtual int pipelineElementCount() const
virtual FUPort * operationPort(const std::string &name) const
virtual int operationPortCount() const
virtual bool isArchitectureEqual(const FunctionUnit *fu, const bool checkPortWidths=true) const
const std::string & name() const

References addressSpace(), hasPipelineElement(), isArchitectureEqual(), TTAMachine::FUPort::isOpcodeSetting(), TTAMachine::FUPort::isTriggering(), TTAMachine::Component::name(), TTAMachine::PipelineElement::name(), operationCount(), operationPort(), operationPortCount(), pipelineElement(), and pipelineElementCount().

Referenced by MachineResourceModifier::analyzeFunctionUnits(), isArchitectureEqual(), and EntryKeyDataFunctionUnit::isEqual().

Here is the call graph for this function:

◆ loadState()

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

Loads its state from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid or if connections to other machine parts cannot be made.

Reimplemented from TTAMachine::Unit.

Reimplemented in TTAMachine::ControlUnit, and UniversalFunctionUnit.

Definition at line 706 of file FunctionUnit.cc.

706 {
707 const string procName = "FunctionUnit::loadState";
708
709 Unit::loadState(state);
711
712 try {
713 // set address space
714 if (state->hasAttribute(OSKEY_AS)) {
715 MOMTextGenerator textGenerator;
718 string asName = state->stringAttribute(OSKEY_AS);
719 if (!isRegistered() || !asNav.hasItem(asName)) {
720 format errorMsg = textGenerator.text(MOMTextGenerator::
721 TXT_FU_REF_LOAD_ERR_AS);
722 errorMsg % asName % name();
724 __FILE__, __LINE__, procName, errorMsg.str());
725 } else {
726 setAddressSpace(asNav.item(asName));
727 }
728 }
729
730 } catch (const Exception& e) {
732 __FILE__, __LINE__, procName, e.errorMessage());
733 }
734}
std::string errorMessage() const
Definition Exception.cc:123
bool hasAttribute(const std::string &name) const
std::string stringAttribute(const std::string &name) const
virtual bool isRegistered() const
virtual void setAddressSpace(AddressSpace *as)
static const std::string OSKEY_AS
ObjectState attribute key for name of the address space.
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition Machine.cc:392
Navigator< AddressSpace > AddressSpaceNavigator
Navigator type for AddressSpaceNavigator.
Definition Machine.hh:219
virtual void loadState(const ObjectState *state)
Definition Unit.cc:309
virtual boost::format text(int textId)

References TTAMachine::Machine::addressSpaceNavigator(), Exception::errorMessage(), ObjectState::hasAttribute(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Component::isRegistered(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Unit::loadState(), loadStateWithoutReferences(), TTAMachine::Component::machine(), TTAMachine::Component::name(), OSKEY_AS, setAddressSpace(), ObjectState::stringAttribute(), and Texts::TextGenerator::text().

Referenced by TTAMachine::ControlUnit::loadState(), TTAMachine::Machine::loadState(), FUDialog::onAddOperation(), and FUDialog::onEditOperation().

Here is the call graph for this function:

◆ loadStateWithoutReferences()

void TTAMachine::FunctionUnit::loadStateWithoutReferences ( const ObjectState fuState)
private

Loads the state of the function unit without references to other components.

Parameters
fuStateThe ObjectState instance from which the state is loaded.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.

Definition at line 872 of file FunctionUnit.cc.

872 {
874 addressSpace_ = NULL;
875
878 }
879
880 try {
881 // load operations
882 for (int i = 0; i < fuState->childCount(); i++) {
883 ObjectState* child = fuState->child(i);
884 if (child->name() == HWOperation::OSNAME_OPERATION) {
885 new HWOperation(child, *this);
886 }
887 }
888 } catch (const Exception& e) {
889 const string procName = "FunctionUnit::loadStateWithoutReferences";
891 __FILE__, __LINE__, procName, e.errorMessage());
892 }
893}
ObjectState * child(int index) const
int intAttribute(const std::string &name) const
std::string name() const
int childCount() const
static const std::string OSKEY_ORDER_NUMBER
ObjectState attribute key for FU order number name.
virtual void setOrderNumber(int)
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.

References addressSpace_, ObjectState::child(), ObjectState::childCount(), deleteAllOperations(), Exception::errorMessage(), ObjectState::hasAttribute(), ObjectState::intAttribute(), ObjectState::name(), OSKEY_ORDER_NUMBER, TTAMachine::HWOperation::OSNAME_OPERATION, and setOrderNumber().

Referenced by FunctionUnit(), and loadState().

Here is the call graph for this function:

◆ maxLatency()

int TTAMachine::FunctionUnit::maxLatency ( ) const
virtual

Returns the maximum latency among the operations of the function unit.

Returns
The maximum latency.

Definition at line 443 of file FunctionUnit.cc.

443 {
444 int max(0);
445 for (int i = 0; i < operationCount(); i++) {
446 if (operation(i)->latency() > max) {
447 max = operation(i)->latency();
448 }
449 }
450 return max;
451}

References TTAMachine::HWOperation::latency(), operation(), and operationCount().

Referenced by CostDatabase::buildFunctionUnits(), ExecutionPipelineBroker::buildResources(), ComponentImplementationSelector::fuArchsByOpSetWithMinLatency(), CompiledSimCodeGenerator::generateAddFUResult(), TTAMachine::Machine::maximumLatency(), and CompiledSimCodeGenerator::updateDeclaredSymbolsList().

Here is the call graph for this function:

◆ needsConflictDetection()

bool TTAMachine::FunctionUnit::needsConflictDetection ( ) const

Checks if all the operations in the FU have the same latency and there are no shared resources.

Returns
True if the FU needs conflict detection

Definition at line 804 of file FunctionUnit.cc.

804 {
805
806 if (operationCount() == 0) {
807 return false;
808 }
809
810 // same latency for all operations?
811 const int latency = operation(0)->latency();
812 for (int i = 1; i < operationCount(); ++i) {
813 if (latency != operation(i)->latency()) {
814 return true;
815 }
816 }
817
818 if (pipelineElementCount() == 0) {
819 return false;
820 }
821
822 return true;
823}

References TTAMachine::HWOperation::latency(), operation(), operationCount(), and pipelineElementCount().

Referenced by MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), ConflictDetectionCodeGenerator::ConflictDetectionCodeGenerator(), and ConflictDetectionCodeGenerator::symbolDeclaration().

Here is the call graph for this function:

◆ operation() [1/2]

HWOperation * TTAMachine::FunctionUnit::operation ( const std::string &  name) const
virtual

Returns operation by the given name.

The requested operation must exist, otherwise assertion fails.

Parameters
nameName of the operation.
Returns
Operation by the given name.
Exceptions
InstanceNotFoundIf an operation is not found by the given name.

Reimplemented in UniversalFunctionUnit.

Definition at line 363 of file FunctionUnit.cc.

363 {
365}
virtual HWOperation * operationLowercase(const std::string &name) const

References TTAMachine::Component::name(), operationLowercase(), and StringTools::stringToLower().

Referenced by AddFUFromHDBDialog::acceptToList(), ProGe::RV32MicroCodeGenerator::addBPorts(), RegisterCopyAdder::addConnectionRegisterCopies(), ProgrammabilityValidator::addConnectionToProgram(), HDB::HDBManager::addFUArchitecture(), HDB::HDBManager::addFUImplementation(), ProGe::RV32MicroCodeGenerator::addIPorts(), addOperation(), ProgrammabilityValidator::addOperationConnections(), HDB::HDBManager::addOperationPipelinesToFUArchitecture(), BEMGenerator::addPortCodes(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), MachineStateBuilder::addPortToFU(), ProGe::RV32MicroCodeGenerator::addR1Ports(), ProGe::RV32MicroCodeGenerator::addR1RPorts(), ProGe::RV32MicroCodeGenerator::addRPorts(), ProGe::RV32MicroCodeGenerator::addSPorts(), ProGe::RV32MicroCodeGenerator::addUJPorts(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), OutputFUBroker::allAvailableResources(), ImmediateAnalyzer::analyzeImmediateCapabilitiesForFU(), InputFUBroker::assign(), OutputFUBroker::assign(), ExecutionPipelineResource::canAssignDestination(), ExecutionPipelineResource::canAssignSource(), AddressSpaceCheck::check(), OperationBindingCheck::check(), ProGeTools::checkForGeneratableFU(), Automagic::checkForGeneratableFU(), ProGeTools::checkForSelectableFU(), Automagic::checkForSelectableFU(), FUGen::checkForValidity(), MachineValidator::checkIMemAddrWidth(), MachineValidator::checkJumpAndCallOperandBindings(), FUValidator::checkOperandBindings(), FUValidator::checkOperations(), MachineValidator::checkProgramCounterPort(), MachineValidator::checkRAPortHasSameWidthAsPCPort(), BEMValidator::checkSocketCodeTable(), cleanup(), TTAMachine::FUPort::cleanupOperandBindings(), FullyConnectedCheck::connectFUPort(), ADFCombiner::connectVectorLSU(), ProGe::RV32MicroCodeGenerator::constructBInstructions(), ProGe::RV32MicroCodeGenerator::constructIInstructions(), ProGe::RV32MicroCodeGenerator::constructR1Instructions(), ProGe::RV32MicroCodeGenerator::constructR1RInstructions(), ProGe::RV32MicroCodeGenerator::constructRInstructions(), ProGe::RV32MicroCodeGenerator::constructSInstructions(), ProGe::RV32MicroCodeGenerator::constructUJInstructions(), TTAProgram::ProgramWriter::createCodeSection(), FUFactory::createEditPart(), GCUFactory::createEditPart(), FUGen::createFUHeaderComment(), POMDisassembler::createFUPort(), llvm::LLVMTCEPOMBuilder::createFUTerminal(), ProgramDependenceGraph::createJump(), FUTestbenchGenerator::createStimulus(), TTAProgram::TPEFProgramFactory::createTerminal(), TTAProgram::CodeGenerator::createTerminalFUPort(), createTerminalFUPort(), deleteOperation(), ConflictDetectionCodeGenerator::detectConflicts(), ProximFUDetailsCmd::Do(), SocketBusConnCmd::Do(), ExecutionPipelineBroker::earliestFromDestination(), ExecutionPipelineBroker::earliestFromSource(), MoveNode::earliestResultReadCycle(), llvm::LLVMTCEBuilder::emitReturn(), InfoProcCommand::execute(), InfoStatsCommand::execute(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), ProGe::NetlistGenerator::findCorrespondingPort(), TTAProgram::TPEFProgramFactory::findGuard(), AlmaIFIntegrator::findMemories(), TTAProgram::TerminalFUPort::findNewOperationIndex(), SimulatorFrontend::findPort(), TTAProgram::TPEFProgramFactory::findPort(), MachineConnectivityCheck::findPossibleDestinationPorts(), MachineConnectivityCheck::findPossibleSourcePorts(), BasicBlockScheduler::findTriggerFromUnit(), ProgramOperation::findTriggerFromUnit(), SimulatorFrontend::finishSimulation(), HDBBrowserWindow::fuArchLabel(), ComponentImplementationSelector::fuArchsByOpSetWithMinLatency(), HDBToHtml::fuArchToHtml(), HDB::HDBManager::fuEntriesByArchitecture(), FUFiniteStateAutomaton::FUFiniteStateAutomaton(), MachineResourceManager::functionUnitPortResource(), FUReservationTableIndex::FUReservationTableIndex(), CompiledSimCodeGenerator::generateConstructorCode(), generateHeader(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), ProGe::RV32MicroCodeGenerator::generateOperationLatencyLogic(), MachineInfo::getBoundPort(), llvm::LLVMTCEBuilder::getHWOperation(), MachineInfo::getOpset(), MachineInfo::getOpset(), getOutputPort(), MachineInfo::getPortBindingsOfOperation(), BasicBlockScheduler::getTriggerOperand(), ProgramOperation::hwopFromOutMove(), ProGe::ProcessorGenerator::iMemAddressWidth(), BFOptimization::immCountPreventsScheduling(), TTAProgram::TPEFResourceUpdater::initCache(), llvm::LLVMTCEBuilder::initDataSections(), HDB::HDBManager::isMatchingArchitecture(), BF2Scheduler::isTrigger(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), MoveNode::latestTriggerWriteCycle(), llvm::LLVMTCEIRBuilder::LLVMTCEIRBuilder(), AddFUFromHDBDialog::loadHDB(), maxLatency(), MachineInfo::maxLatency(), MachineInfo::maxMemoryAlignment(), needsConflictDetection(), ExecutionPipelineResource::nodeOfInputPort(), AddFUFromHDBDialog::onAdd(), FUDialog::onDeleteOperation(), GCUDialog::onDeleteOperation(), FUImplementationDialog::onOK(), FUImplementationDialog::onSetOpcode(), DefaultDecoderGenerator::opcode(), ProGe::NetlistGenerator::opcodePortWidth(), ProGe::NetlistGenerator::opcodePortWidth(), TTAProgram::TPEFResourceUpdater::operand(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandPort(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), ExecutionPipelineResource::operandTooLate(), UniversalFunctionUnit::operation(), DCMFUResourceConflictDetector::operationID(), ReservationTableFUResourceConflictDetector::operationID(), BFShareOperands::operator()(), HDB::FUArchitecture::operator==(), ProgramOperation::outputIndexFromGuard(), PlatformIntegrator::parseDataMemories(), FUGen::parseOperations(), ExecutionPipelineResource::poConflictsWithInputPort(), HDB::FUArchitecture::portDirection(), BF2Scheduler::preAllocateFunctionUnitsInner(), ProgrammabilityValidator::printConnection(), printLatexFunctionUnitDescription(), MachineConnectivityCheck::raConnected(), BF2Scheduler::releasePortForOp(), HDB::HDBManager::resolveArchitecturePort(), TTAMachine::ResourceVectorSet::ResourceVectorSet(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), ExecutionPipelineResource::resultPort(), ExecutionPipelineResource::resultReadyCycle(), MachineResourceManager::rFPortOrFUIndexReference(), BFOptimization::RFReadPortCountPreventsScheduling(), saveState(), BUBasicBlockScheduler::scheduleMove(), FUGen::scheduleOperations(), FUDialog::selectedOperation(), GCUDialog::selectedOperation(), DataDependenceGraph::setMachine(), ExecutionPipelineResource::setOperandsUsed(), ExecutionPipelineResource::setResultWriten(), TTAProgram::ProgramWriter::terminalResource(), ExecutionPipelineResource::testTriggerResult(), EntryKeyDataFunctionUnit::toString(), FUPortImplementationDialog::TransferDataToWindow(), OTAOperationDialog::TransferDataToWindow(), MachineInfo::triggerIndex(), ExecutionPipelineResource::triggerTooEarly(), ExecutionPipelineResource::unsetOperandsUsed(), ExecutionPipelineResource::unsetResultWriten(), FUImplementationDialog::update(), TTAMachine::FUPort::updateBindingString(), FUDialog::updateOperationList(), GCUDialog::updateOperationList(), TDGen::writeBackendCode(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), TDGen::writeInstrInfo(), and TTAMachine::PipelineElement::~PipelineElement().

Here is the call graph for this function:

◆ operation() [2/2]

HWOperation * TTAMachine::FunctionUnit::operation ( int  index) const
virtual

Returns operation by the given index.

The value of given index must be between 0 and the return value of operationCount() - 1.

Parameters
indexIndex.
Returns
Operation by the given index.
Exceptions
OutOfRangeIf the given index is less than zero or greater or equal to the number of operations in the function unit.

Definition at line 405 of file FunctionUnit.cc.

405 {
406 if (index < 0 || index >= operationCount()) {
407 string procName = "FunctionUnit::operation";
408 throw OutOfRange(__FILE__, __LINE__, procName);
409 }
410 return operations_[index];
411}

References operationCount(), and operations_.

Here is the call graph for this function:

◆ operationCount()

int TTAMachine::FunctionUnit::operationCount ( ) const
virtual

Returns the number of operations in the function unit.

Returns
The number of operations in the function unit.

Definition at line 419 of file FunctionUnit.cc.

419 {
420 return operations_.size();
421}

References operations_.

Referenced by AddFUFromHDBDialog::acceptToList(), ProgrammabilityValidator::addConnectionToProgram(), HDB::HDBManager::addFUArchitecture(), HDB::HDBManager::addFUImplementation(), ProGe::NetlistGenerator::addGeneratableFUsToNetlist(), ProgrammabilityValidator::addOperationConnections(), BEMGenerator::addPortCodes(), MachineStateBuilder::addPortToFU(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), ImmediateAnalyzer::analyzeImmediateCapabilitiesForFU(), InputFUBroker::buildResources(), OutputFUBroker::buildResources(), AddressSpaceCheck::check(), OperationBindingCheck::check(), ProGeTools::checkForGeneratableFU(), Automagic::checkForGeneratableFU(), ProGeTools::checkForSelectableFU(), Automagic::checkForSelectableFU(), FUValidator::checkOperandBindings(), FUValidator::checkOperations(), BEMValidator::checkSocketCodeTable(), cleanup(), TTAMachine::FUPort::cleanupOperandBindings(), FullyConnectedCheck::connectFUPort(), ADFCombiner::connectVectorLSU(), TTAProgram::ProgramWriter::createCodeSection(), FUFactory::createEditPart(), GCUFactory::createEditPart(), FUGen::createFUHeaderComment(), FUGen::createMandatoryPorts(), FUTestbenchGenerator::createStimulus(), FUTestbenchGenerator::createStimulusArrays(), FUTestbenchGenerator::createTbCode(), ConflictDetectionCodeGenerator::detectConflicts(), ProximFUDetailsCmd::Do(), SocketBusConnCmd::Do(), InfoProcCommand::execute(), InfoStatsCommand::execute(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), ProGe::NetlistGenerator::findCorrespondingPort(), AlmaIFIntegrator::findMemories(), SimulatorFrontend::finishSimulation(), HDBBrowserWindow::fuArchLabel(), ComponentImplementationSelector::fuArchsByOpSetWithMinLatency(), HDBToHtml::fuArchToHtml(), FUCollisionMatrixIndex::FUCollisionMatrixIndex(), HDB::HDBManager::fuEntriesByArchitecture(), FUFiniteStateAutomaton::FUFiniteStateAutomaton(), FUReservationTableIndex::FUReservationTableIndex(), ProGe::CUOpcodeGenerator::gcuOpcodeWidth(), CompiledSimCodeGenerator::generateConstructorCode(), generateHeader(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), MachineInfo::getOpset(), MachineInfo::getOpset(), llvm::LLVMTCEBuilder::initDataSections(), isArchitectureEqual(), HDB::HDBManager::isMatchingArchitecture(), llvm::LLVMTCEIRBuilder::LLVMTCEIRBuilder(), AddFUFromHDBDialog::loadHDB(), maxLatency(), MachineInfo::maxMemoryAlignment(), needsConflictDetection(), BEMValidator::needsSocketCodeTable(), BEMGenerator::needsSocketCodeTable(), AddFUFromHDBDialog::onAdd(), FUImplementationDialog::onOK(), FUImplementationDialog::onSetOpcode(), DefaultDecoderGenerator::opcode(), ProGe::NetlistGenerator::opcodePortWidth(), ProGe::NetlistGenerator::opcodePortWidth(), DefaultDecoderGenerator::opcodeWidth(), operation(), DCMFUResourceConflictDetector::operationID(), ReservationTableFUResourceConflictDetector::operationID(), HDB::FUArchitecture::operator==(), PlatformIntegrator::parseDataMemories(), HDB::FUArchitecture::portDirection(), ProgrammabilityValidator::printConnection(), printLatexFunctionUnitDescription(), TTAMachine::ResourceVectorSet::ResourceVectorSet(), saveState(), DataDependenceGraph::setMachine(), EntryKeyDataFunctionUnit::toString(), FUPortImplementationDialog::TransferDataToWindow(), OTAOperationDialog::TransferDataToWindow(), FUImplementationDialog::update(), TTAMachine::FUPort::updateBindingString(), FUDialog::updateOperationList(), GCUDialog::updateOperationList(), TDGen::writeBackendCode(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), TDGen::writeInstrInfo(), and TTAMachine::PipelineElement::~PipelineElement().

◆ operationLowercase()

HWOperation * TTAMachine::FunctionUnit::operationLowercase ( const std::string &  name) const
virtual

Returns operation by the given name.

The requested operation must exist, otherwise assertion fails.

Parameters
nameName of the operation.
Returns
Operation by the given name which MUST be in lowercase.
Exceptions
InstanceNotFoundIf an operation is not found by the given name.

Definition at line 378 of file FunctionUnit.cc.

378 {
379 OperationTable::const_iterator iter = operations_.begin();
380 while (iter != operations_.end()) {
381 if ((*iter)->name() == name) {
382 return *iter;
383 }
384 iter++;
385 }
386
387 string procName = "FunctionUnit::operation";
388 throw InstanceNotFound(
389 __FILE__, __LINE__, procName,"Operation not found:" + name );
390}

References TTAMachine::Component::name(), and operations_.

Referenced by InputFUBroker::allAvailableResources(), MachineConnectivityCheck::busConnectedToFU(), and operation().

Here is the call graph for this function:

◆ operationNames()

void TTAMachine::FunctionUnit::operationNames ( TCETools::CIStringSet opNames) const
virtual

Adds FUs operations to the set given as a parameter.

Definition at line 428 of file FunctionUnit.cc.

428 {
429 OperationTable::const_iterator iter = operations_.begin();
430 while (iter != operations_.end()) {
431 opNames.insert((*iter)->name());
432 ++iter;
433 }
434}

References operations_.

Referenced by MinimalOpSetCheck::buildMinimalOpSet(), MinimalOpSetCheck::check(), MinimalOpSetCheck::check(), MinimalOpSetCheck::checkWithIgnore(), and MinimalOpSetCheck::missingOperations().

◆ operationPort() [1/2]

FUPort * TTAMachine::FunctionUnit::operationPort ( const std::string &  name) const
virtual

Returns an operation port by the given name.

Operation port is a port which can be read or written by an operation.

Parameters
nameName of the port.
Returns
The requested port.
Exceptions
InstanceNotFoundIf the requested port does not exist.

Definition at line 224 of file FunctionUnit.cc.

224 {
226 FUPort* fuPort = dynamic_cast<FUPort*>(port);
227 if (fuPort == NULL) {
228 const string procName = "FunctionUnit::operationPort";
229 throw InstanceNotFound(__FILE__, __LINE__, procName);
230 }
231 return fuPort;
232}
virtual Port * port(const std::string &name) const
Definition Unit.cc:116

References TTAMachine::Component::name(), port(), and TTAMachine::Unit::port().

Referenced by HDB::HDBManager::addFUArchitecture(), HDB::HDBManager::addFUImplementation(), VectorLSGenerator::addOperation(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), FullyConnectedCheck::check(), FullyConnectedCheck::check(), OperationBindingCheck::check(), MachineValidator::checkFUConnections(), FullyConnectedCheck::connectControlUnit(), ADFCombiner::connectVectorLSU(), GCUFactory::createEditPart(), POMDisassembler::createFUPort(), OpsetDialog::createOperation(), createTerminalFUPort(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), ProGe::NetlistGenerator::findCorrespondingPort(), FullyConnectedCheck::fix(), MinimalOpSetCheck::fix(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), isArchitectureEqual(), HDB::HDBManager::isMatchingArchitecture(), TTAMachine::PortGuard::loadState(), TTAMachine::HWOperation::loadState(), OperationDialog::onBindOperand(), GCUDialog::onEditPort(), OperationDialog::onOperandSelection(), HDB::FUArchitecture::operator==(), HDB::FUArchitecture::portDirection(), PlatformIntegrator::readLsuParameters(), ReservationTable::ReservationTable(), FUDialog::selectedPort(), FUGuardDialog::selectedPort(), MachineInfo::triggerIndex(), FUImplementationDialog::update(), OperationDialog::updateOperandList(), and FUDialog::updatePortList().

Here is the call graph for this function:

◆ operationPort() [2/2]

FUPort * TTAMachine::FunctionUnit::operationPort ( int  index) const
virtual

Returns an operation port by the given index.

Operation port is a port which can be read or written by an operation.

Parameters
indexThe index.
Returns
The port found by the given index.
Exceptions
OutOfRangeIf the given index is less than 0 or greater or equal to the number of operation ports.

Definition at line 245 of file FunctionUnit.cc.

245 {
246 int portCount = this->portCount();
247 int current(-1);
248
249 for (int i = 0; i < portCount; i++) {
250 Port* port = Unit::port(i);
251 if (dynamic_cast<FUPort*>(port) != NULL) {
252 current++;
253 if (current == index) {
254 return dynamic_cast<FUPort*>(port);
255 }
256 }
257 }
258
259 const string procName = "FunctionUnit::operandPort";
260 throw OutOfRange(__FILE__, __LINE__, procName);
261}
virtual int portCount() const
Definition Unit.cc:135

References port(), TTAMachine::Unit::port(), and TTAMachine::Unit::portCount().

Here is the call graph for this function:

◆ operationPortCount()

int TTAMachine::FunctionUnit::operationPortCount ( ) const
virtual

◆ orderNumber()

int TTAMachine::FunctionUnit::orderNumber ( ) const
virtual

Returns the order number of the FU.

In certain architectures (Cell SPU) the "relative order" of the function units matters when it comes to accessing same register by multiple operations in the same cycle.
This method returns number indicating possition of the FU in the ADF file. Alows putting the FU into the order in the instruction.

Definition at line 915 of file FunctionUnit.cc.

915 {
916 return orderNumber_;
917}

References orderNumber_.

Referenced by saveState().

◆ pipelineElement() [1/2]

PipelineElement * TTAMachine::FunctionUnit::pipelineElement ( const std::string &  name) const
virtual

Returns the pipeline element which has the given name.

Parameters
nameName of the pipeline element.
Returns
The pipeline element which has the given name, or NULL If there is no pipeline element by the given name.

Definition at line 561 of file FunctionUnit.cc.

561 {
562
563 PipelineElementTable::const_iterator iter = pipelineElements_.begin();
564 while (iter != pipelineElements_.end()) {
565 if ((*iter)->name() == name) {
566 return *iter;
567 }
568 iter++;
569 }
570 return NULL;
571}

References TTAMachine::Component::name(), and pipelineElements_.

Here is the call graph for this function:

◆ pipelineElement() [2/2]

PipelineElement * TTAMachine::FunctionUnit::pipelineElement ( int  index) const
virtual

Returns a pipeline element by the given index.

The index must be greater or equal to 0 and less than the number of pipeline elements in the function unit.

Parameters
indexThe index.
Returns
A pipeline element by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Definition at line 523 of file FunctionUnit.cc.

523 {
524 if (index < 0 || index >= pipelineElementCount()) {
525 string procName = "FunctionUnit::pipelineElement";
526 throw OutOfRange(__FILE__, __LINE__, procName);
527 }
528
529 return pipelineElements_[index];
530}

References pipelineElementCount(), and pipelineElements_.

Referenced by HDB::HDBManager::addFUArchitecture(), TTAMachine::ExecutionPipeline::addPipelineElement(), cleanup(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), HDBToHtml::fuArchToHtml(), isArchitectureEqual(), HDB::HDBManager::isMatchingArchitecture(), HDB::FUArchitecture::operator==(), TTAMachine::ExecutionPipeline::pipelineElement(), ReservationTable::ReservationTable(), and OperationDialog::updateResourceGrid().

Here is the call graph for this function:

◆ pipelineElementCount()

int TTAMachine::FunctionUnit::pipelineElementCount ( ) const
virtual

◆ port() [1/2]

BaseFUPort * TTAMachine::FunctionUnit::port ( const std::string &  name) const
virtual

Returns the requested port.

Parameters
nameName of the port.
Returns
The requested port.
Exceptions
InstanceNotFoundIf there is no port by the given name.

Reimplemented from TTAMachine::Unit.

Definition at line 145 of file FunctionUnit.cc.

145 {
146 if (!hasPort(name)) {
147 string procName = "FunctionUnit::port";
148 throw InstanceNotFound(__FILE__, __LINE__, procName);
149 }
150
152 BaseFUPort* fuPort = dynamic_cast<BaseFUPort*>(port);
153 assert(fuPort != NULL);
154 return fuPort;
155}

References assert, TTAMachine::Unit::hasPort(), TTAMachine::Component::name(), port(), and TTAMachine::Unit::port().

Referenced by ProGe::NetlistGenerator::addGCUToNetlist(), ProGe::NetlistGenerator::addGeneratableFUsToNetlist(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), CostDatabase::buildFunctionUnits(), MachineStateBuilder::buildMachineState(), cleanupGuards(), SimulatorFrontend::compareState(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::copyGuards(), FUFactory::createEditPart(), llvm::LLVMTCEPOMBuilder::createFUTerminal(), FUGen::createMandatoryPorts(), FUGen::createOutputPipeline(), FUGen::createPortPipeline(), InterpolatingFUEstimator::createSearch(), FUGen::createShadowRegisters(), FUTestbenchGenerator::createStimulusArrays(), FUTestbenchGenerator::createTbInstantiation(), ProximFUDetailsCmd::Do(), AddFUImplementationCmd::Do(), UniversalFunctionUnit::ensureInputPorts(), UniversalFunctionUnit::ensureOutputPorts(), InfoPortsCommand::execute(), ProgrammabilityValidator::findConnections(), findFUPort(), TTAProgram::TPEFProgramFactory::findGuard(), TTAProgram::TPEFProgramFactory::findPort(), BasicBlockScheduler::findTriggerFromUnit(), ProgramOperation::findTriggerFromUnit(), MachineConnectivityCheck::fromRfConnected(), ComponentImplementationSelector::fuArchsByOpSetWithMinLatency(), HDBToHtml::fuArchToHtml(), MachineResourceManager::functionUnitPortResource(), CompiledSimCodeGenerator::fuOutputPorts(), TTAMachine::FUPort::FUPort(), CompiledSimulation::FUPortValue(), hasOperationPort(), TTAProgram::TPEFResourceUpdater::initCache(), ExecutionPipelineResource::isAvailable(), DefaultICGenerator::isGcuPort(), TTAMachine::FUPort::loadStateWithoutReferences(), MachineAnalysis::MachineAnalysis(), AddFUFromHDBDialog::onAdd(), FUImplementationDialog::onArchPortActivation(), FUImplementationDialog::onEditArchitecturePort(), AddWatchDialog::onFUChoice(), FUGuardDialog::onFUChoice(), FUArchitectureDialog::onOK(), FUPortDialog::onOK(), SRPortDialog::onOK(), operationPort(), operationPort(), operationPortCount(), FUTestbenchGenerator::parseFuPorts(), port(), UniversalFunctionUnit::portCountWithWidth(), UniversalFunctionUnit::portWithWidth(), TTAMachine::ControlUnit::removePort(), GCUDialog::selectedPort(), TTAMachine::ControlUnit::setReturnAddressPort(), TTAMachine::FUPort::setTriggering(), ExecutionPipelineBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), TTAMachine::ControlUnit::specialRegisterPort(), TTAMachine::ControlUnit::specialRegisterPort(), MachineConnectivityCheck::toRfConnected(), FUGuardDialog::TransferDataToWindow(), triggerPort(), ProximPortWindow::update(), FUArchitectureDialog::update(), GCUDialog::updatePortList(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeFUCntrlSignals(), DefaultDecoderGenerator::writeRulesForDestinationControlSignals(), and DefaultDecoderGenerator::writeRulesForSourceControlSignals().

Here is the call graph for this function:

◆ port() [2/2]

BaseFUPort * TTAMachine::FunctionUnit::port ( int  index) const
virtual

Returns port by the given index.

The index must be between 0 and the return value of numberOfPorts() - 1.

Parameters
indexIndex.
Returns
The port found by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Reimplemented from TTAMachine::Unit.

Definition at line 167 of file FunctionUnit.cc.

167 {
168 // the out of range test is already done in Unit::Port,
169 // no need to do it here also.
170 return static_cast<BaseFUPort*>(Unit::port(index));
171}

References TTAMachine::Unit::port().

Here is the call graph for this function:

◆ saveState()

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

Saves the contents to an ObjectState tree.

Returns
The newly created ObjectState tree.

Reimplemented from TTAMachine::Unit.

Reimplemented in TTAMachine::ControlUnit.

Definition at line 677 of file FunctionUnit.cc.

677 {
678
679 ObjectState* fuState = Unit::saveState();
680 fuState->setName(OSNAME_FU);
682 // set address space
683 if (addressSpace_ != NULL) {
685 }
686
687 // add operations
688 for (int i = 0; i < operationCount(); i++) {
689 HWOperation* operation = this->operation(i);
690 fuState->addChild(operation->saveState());
691 }
692
693 return fuState;
694}
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void addChild(ObjectState *child)
virtual int orderNumber() const
static const std::string OSNAME_FU
ObjectState name for function unit.
virtual ObjectState * saveState() const
virtual ObjectState * saveState() const
Definition Unit.cc:285

References ObjectState::addChild(), addressSpace_, TTAMachine::Component::name(), operation(), operationCount(), orderNumber(), OSKEY_AS, OSKEY_ORDER_NUMBER, OSNAME_FU, TTAMachine::HWOperation::saveState(), TTAMachine::Unit::saveState(), ObjectState::setAttribute(), and ObjectState::setName().

Referenced by copy(), AddFUFromHDBDialog::onAdd(), FUDialog::onAddOperation(), FUDialog::onEditOperation(), and TTAMachine::ControlUnit::saveState().

Here is the call graph for this function:

◆ setAddressSpace()

void TTAMachine::FunctionUnit::setAddressSpace ( AddressSpace as)
virtual

Adds an address space which can be accessed by the function unit.

Parameters
asAddress space which can be accessed.
Exceptions
IllegalRegistrationIf the given address space and the function unit are not registrered to the same machine.

Definition at line 594 of file FunctionUnit.cc.

594 {
595 if (as != NULL) {
597 }
598
599 addressSpace_ = as;
600}
virtual void ensureRegistration(const Component &component) const

References addressSpace_, and TTAMachine::Component::ensureRegistration().

Referenced by ADFCombiner::addFunctionUnits(), BlocksGCU::BlocksGCU(), BlocksLSU::BlocksLSU(), UniversalMachine::construct(), PasteComponentCmd::Do(), VectorLSGenerator::explore(), MachineResourceModifier::increaseAllFUsThatDiffersByAmount(), loadState(), GCUDialog::onOK(), FUDialog::onSetAddressSpace(), MachineResourceModifier::percentualFUIncrease(), and TTAMachine::AddressSpace::unsetMachine().

Here is the call graph for this function:

◆ setName()

void TTAMachine::FunctionUnit::setName ( const std::string &  name)
virtual

Sets the name of the function unit.

Parameters
nameName of the function unit.
Exceptions
ComponentAlreadyExistsIf a function unit with the given name is already in the same machine.
InvalidNameIf the given name is not a valid component name.

Reimplemented from TTAMachine::Component.

Definition at line 118 of file FunctionUnit.cc.

118 {
119 if (name == this->name()) {
120 return;
121 }
122
123 if (machine() != NULL) {
124 if (machine()->functionUnitNavigator().hasItem(name) ||
125 (machine()->controlUnit() != NULL &&
126 machine()->controlUnit()->name() == name)) {
127 string procName = "FunctionUnit::setName";
128 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
129 } else {
131 }
132 } else {
134 }
135}
virtual void setName(const std::string &name)

References TTAMachine::Component::machine(), TTAMachine::Component::name(), and TTAMachine::Component::setName().

Referenced by ADFCombiner::addFunctionUnits(), MachineResourceModifier::increaseAllFUsThatDiffersByAmount(), AddFUFromHDBDialog::onAdd(), FUDialog::onOK(), GCUDialog::onOK(), and MachineResourceModifier::percentualFUIncrease().

Here is the call graph for this function:

◆ setOrderNumber()

void TTAMachine::FunctionUnit::setOrderNumber ( int  number)
virtual

Sets order number of the FU.

In certain architectures (Cell SPU) the "relative order" of the function units matters when it comes to accessing same register by multiple operations in the same cycle.
This method sets number indicating possition of the FU in the ADF file.

Definition at line 928 of file FunctionUnit.cc.

928 {
929 orderNumber_ = number;
930}

References orderNumber_.

Referenced by loadStateWithoutReferences().

◆ triggerPort()

BaseFUPort * TTAMachine::FunctionUnit::triggerPort ( ) const
virtual

Returns triggering port if found. Otherwise returns NULL.

Definition at line 267 of file FunctionUnit.cc.

267 {
268 int portc = portCount();
269 for (int i = 0; i < portc; i++) {
270 if (port(i)->isTriggering()) {
271 return port(i);
272 }
273 }
274 return NULL;
275}

References port(), and TTAMachine::Unit::portCount().

Referenced by ProGe::NetlistGenerator::addGCUToNetlist(), DefaultICGenerator::addICToNetlist(), ExecutionPipelineBroker::isMoveTrigger(), DefaultDecoderGenerator::writeControlRegisterMappings(), and DefaultICGenerator::writeInterconnectionNetwork().

Here is the call graph for this function:

◆ unsetMachine()

void TTAMachine::FunctionUnit::unsetMachine ( )
virtual

Removes registration of the function unit from its current machine.

Reimplemented from TTAMachine::Unit.

Reimplemented in TTAMachine::ControlUnit.

Definition at line 648 of file FunctionUnit.cc.

648 {
649
650 if (machine() == NULL) {
651 return;
652 }
653
655 Machine* mach = machine();
657 mach->removeFunctionUnit(*this);
658}

References cleanupGuards(), TTAMachine::Component::machine(), TTAMachine::Machine::removeFunctionUnit(), and unsetMachineDerived().

Referenced by AddFUArchFromADFCmd::Do(), MinimalOpSetCheck::fix(), and ~FunctionUnit().

Here is the call graph for this function:

◆ unsetMachineDerived()

void TTAMachine::FunctionUnit::unsetMachineDerived ( )
protected

Removes function unit part of a derived class from machine.

Definition at line 665 of file FunctionUnit.cc.

665 {
666 addressSpace_ = NULL;
668}
virtual void unsetMachine()
Definition Unit.cc:262

References addressSpace_, and TTAMachine::Unit::unsetMachine().

Referenced by TTAMachine::ControlUnit::unsetMachine(), and unsetMachine().

Here is the call graph for this function:

Member Data Documentation

◆ addressSpace_

AddressSpace* TTAMachine::FunctionUnit::addressSpace_
private

Address space used by the function unit.

Definition at line 145 of file FunctionUnit.hh.

Referenced by addressSpace(), hasAddressSpace(), loadStateWithoutReferences(), saveState(), setAddressSpace(), and unsetMachineDerived().

◆ operations_

OperationTable TTAMachine::FunctionUnit::operations_
private

Contains all the operations of the function unit.

Definition at line 139 of file FunctionUnit.hh.

Referenced by addOperation(), deleteAllOperations(), deleteOperation(), hasOperationLowercase(), operation(), operationCount(), operationLowercase(), and operationNames().

◆ orderNumber_

int TTAMachine::FunctionUnit::orderNumber_
private

Number indicating possition of the FU in the ADF file. Alows putting the FU into the order in the instruction.

Definition at line 149 of file FunctionUnit.hh.

Referenced by orderNumber(), and setOrderNumber().

◆ OSKEY_AS

const string TTAMachine::FunctionUnit::OSKEY_AS = "as"
static

◆ OSKEY_ORDER_NUMBER

const string TTAMachine::FunctionUnit::OSKEY_ORDER_NUMBER = "order_no"
static

ObjectState attribute key for FU order number name.

Definition at line 121 of file FunctionUnit.hh.

Referenced by ADFSerializer::functionUnitToMachine(), loadStateWithoutReferences(), and saveState().

◆ OSNAME_FU

const string TTAMachine::FunctionUnit::OSNAME_FU = "fu"
static

◆ pipelineElements_

PipelineElementTable TTAMachine::FunctionUnit::pipelineElements_
private

Contains all the pipeline elements of the function unit.

Definition at line 142 of file FunctionUnit.hh.

Referenced by addPipelineElement(), deletePipelineElement(), hasPipelineElement(), pipelineElement(), pipelineElement(), and pipelineElementCount().


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