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

#include <HWOperation.hh>

Inheritance diagram for TTAMachine::HWOperation:
Inheritance graph
Collaboration diagram for TTAMachine::HWOperation:
Collaboration graph

Public Member Functions

 HWOperation (const std::string &name, FunctionUnit &parent)
 
 HWOperation (const ObjectState *state, FunctionUnit &parent)
 
 ~HWOperation ()
 
const std::string & name () const
 
virtual void setName (const std::string &name)
 
FunctionUnitparentUnit () const
 
ExecutionPipelinepipeline () const
 
int latency () const
 
int latency (int output) const
 
int slack (int input) const
 
virtual void bindPort (int operand, const FUPort &port)
 
virtual void unbindPort (const FUPort &port)
 
int operandCount () const
 
virtual FUPortport (int operand) const
 
bool isBound (const FUPort &port) const
 
bool isBound (int operand) const
 
int io (const FUPort &port) const
 
int numberOfInputs () const
 
int numberOfOutputs () const
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_OPERATION = "operation"
 ObjectState name for HWOperation.
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for name of the operation.
 
static const std::string OSNAME_OPERAND_BINDING = "binding"
 ObjectState name for an operand binding.
 
static const std::string OSKEY_OPERAND = "operand"
 ObjectState attribute key for operand index.
 
static const std::string OSKEY_PORT = "port"
 ObjectState attribute key for port name.
 

Private Types

typedef std::map< int, const FUPort * > OperandBindingMap
 Map for mapping operand indexes to FUPorts.
 

Private Attributes

std::string name_
 Name of the operation.
 
ExecutionPipelinepipeline_
 Pipeline of the operation.
 
FunctionUnitparent_
 The parent unit.
 
OperandBindingMap operandBinding_
 Maps operands of operation to particular ports of the parent unit.
 

Additional Inherited Members

- Protected Member Functions inherited from TTAMachine::SubComponent
 SubComponent ()
 
virtual ~SubComponent ()
 
- Protected Member Functions inherited from TTAMachine::MachinePart
 MachinePart ()
 
virtual ~MachinePart ()
 

Detailed Description

Represents an operation of the function unit.

Definition at line 52 of file HWOperation.hh.

Member Typedef Documentation

◆ OperandBindingMap

typedef std::map<int, const FUPort*> TTAMachine::HWOperation::OperandBindingMap
private

Map for mapping operand indexes to FUPorts.

Definition at line 94 of file HWOperation.hh.

Constructor & Destructor Documentation

◆ HWOperation() [1/2]

TTAMachine::HWOperation::HWOperation ( const std::string &  name,
FunctionUnit parent 
)

Constructor.

Parameters
nameName of the operation.
parentThe parent unit.
Exceptions
ComponentAlreadyExistsIf there is already an operation by the same name in the given function unit.
InvalidNameIf the given name is not valid for a component.

Definition at line 67 of file HWOperation.cc.

67 :
68 SubComponent(), name_(name), pipeline_(NULL), parent_(NULL) {
69
71
73 const string procName = "HWOperation::HWOperation";
74 MOMTextGenerator textGen;
75 format errorMsg = textGen.text(MOMTextGenerator::TXT_INVALID_NAME);
76 errorMsg % name;
77 throw InvalidName(__FILE__, __LINE__, procName, errorMsg.str());
78 }
79
80 parent.addOperation(*this);
81 parent_ = &parent;
82 pipeline_ = new ExecutionPipeline(*this);
83}
static bool isValidComponentName(const std::string &name)
static std::string stringToLower(const std::string &source)
std::string name_
Name of the operation.
ExecutionPipeline * pipeline_
Pipeline of the operation.
const std::string & name() const
FunctionUnit * parent_
The parent unit.
virtual boost::format text(int textId)

References TTAMachine::FunctionUnit::addOperation(), MachineTester::isValidComponentName(), name(), name_, parent_, pipeline_, StringTools::stringToLower(), Texts::TextGenerator::text(), and MOMTextGenerator::TXT_INVALID_NAME.

Here is the call graph for this function:

◆ HWOperation() [2/2]

TTAMachine::HWOperation::HWOperation ( const ObjectState state,
FunctionUnit parent 
)

Constructor.

Loads the state of the operation from the given ObjectState instance.

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

Definition at line 95 of file HWOperation.cc.

95 :
96 SubComponent(), name_(""), pipeline_(NULL), parent_(&parent) {
97
98 const string procName = "HWOperation::HWOperation";
99
100 // set name
101 try {
103 } catch (const Exception& exception) {
105 __FILE__, __LINE__, procName, exception.errorMessage());
106 }
107
108 parent_ = NULL;
109
110 // register to parent unit
111 parent.addOperation(*this);
112 parent_ = &parent;
113
114 try {
115 loadState(state);
116 } catch (const ObjectStateLoadingException& e) {
117 if (pipeline_ != NULL) {
118 delete pipeline_;
119 }
120 throw;
121 }
122}
std::string errorMessage() const
Definition Exception.cc:123
std::string stringAttribute(const std::string &name) const
virtual void addOperation(HWOperation &operation)
static const std::string OSKEY_NAME
ObjectState attribute key for name of the operation.
virtual void loadState(const ObjectState *state)
virtual void setName(const std::string &name)

References TTAMachine::FunctionUnit::addOperation(), Exception::errorMessage(), loadState(), OSKEY_NAME, parent_, pipeline_, setName(), and ObjectState::stringAttribute().

Here is the call graph for this function:

◆ ~HWOperation()

TTAMachine::HWOperation::~HWOperation ( )

Destructor.

Definition at line 127 of file HWOperation.cc.

127 {
128 delete pipeline_;
129 FunctionUnit* parent = parentUnit();
130 parent_ = NULL;
131 parent->deleteOperation(*this);
132}
virtual void deleteOperation(HWOperation &operation)
FunctionUnit * parentUnit() const

References TTAMachine::FunctionUnit::deleteOperation(), parent_, parentUnit(), and pipeline_.

Here is the call graph for this function:

Member Function Documentation

◆ bindPort()

void TTAMachine::HWOperation::bindPort ( int  operand,
const FUPort port 
)
virtual

Binds the given operand of the operation to the given port of the function unit.

If the given operand is already bound to another port, the old binding is replaced with the new one.

Parameters
operandIndex of the operand.
portThe port.
Exceptions
IllegalRegistrationIf the given port does not belong to the same function unit as this operation.
ComponentAlreadyExistsIf the given port is already reserved for another operand.
OutOfRangeIf the given operand is less than 1.

Reimplemented in SmartHWOperation.

Definition at line 269 of file HWOperation.cc.

269 {
270
271 const string procName = "HWOperation::bindPort";
272
273 if (operand < 1) {
274 throw OutOfRange(__FILE__, __LINE__, procName);
275 }
276
277 if (port.parentUnit() != parentUnit()) {
278 throw IllegalRegistration(__FILE__, __LINE__, procName);
279 }
280
282 this->HWOperation::port(operand) != &port) {
283 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
284 }
285
286 operandBinding_[operand] = &port;
288}
static bool containsValue(const MapType &aMap, const ValueType &aValue)
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
void updateBindingString() const
Definition FUPort.cc:294
virtual FUPort * port(int operand) const
OperandBindingMap operandBinding_
Maps operands of operation to particular ports of the parent unit.

References MapTools::containsValue(), operandBinding_, TTAMachine::BaseFUPort::parentUnit(), parentUnit(), port(), and TTAMachine::FUPort::updateBindingString().

Referenced by VectorLSGenerator::addOperation(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), OpsetDialog::bindPorts(), BlocksLSU::BindPorts(), BlocksALU::BindPorts(), BlocksGCU::BindPorts(), BlocksMUL::BindPorts(), UniversalMachine::construct(), AddGCUCmd::Do(), CostEstimator::ICDecoderEstimatorPlugin::generateControlUnit(), loadState(), OperationDialog::onBindOperand(), and SmartHWOperation::port().

Here is the call graph for this function:

◆ io()

int TTAMachine::HWOperation::io ( const FUPort port) const

Returns the index of the input or output that is bound to the given port.

Parameters
portThe port.
Returns
The index of the input or output.
Exceptions
InstanceNotFoundIf no io is bound to the given port.

Definition at line 364 of file HWOperation.cc.

364 {
365
366 if (!isBound(port)) {
367 const string procName = "HWOperation::operand";
368 const string msg = string("The port '") + port.name()
369 + "' is not bound to the operation '"
370 + name() + "'.";
371 throw InstanceNotFound(__FILE__, __LINE__, procName, msg);
372 }
373
375}
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
bool isBound(const FUPort &port) const
virtual std::string name() const
Definition Port.cc:141

References isBound(), MapTools::keyForValue(), name(), TTAMachine::Port::name(), operandBinding_, and port().

Referenced by ProgrammabilityValidator::addConnectionToProgram(), HDB::HDBManager::addFUArchitecture(), HDB::HDBManager::addFUImplementation(), TTAProgram::ProgramWriter::createCodeSection(), POMDisassembler::createFUPort(), llvm::LLVMTCEPOMBuilder::createFUTerminal(), createTerminalFUPort(), SocketBusConnCmd::Do(), ProGe::NetlistGenerator::findCorrespondingPort(), TTAProgram::TerminalFUPort::findNewOperationIndex(), BasicBlockScheduler::findTriggerFromUnit(), ProgramOperation::findTriggerFromUnit(), MachineResourceManager::functionUnitPortResource(), HDB::HDBManager::isMatchingArchitecture(), ExecutionPipelineResource::nodeOfInputPort(), OperationDialog::onOperandSelection(), MachineInfo::operandFromPort(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), HDB::FUArchitecture::operator==(), ProgramOperation::outputIndexFromGuard(), TTAProgram::TerminalFUPort::TerminalFUPort(), TTAProgram::ProgramWriter::terminalResource(), FUPortImplementationDialog::TransferDataToWindow(), MachineInfo::triggerIndex(), FUImplementationDialog::update(), and OperationDialog::updateOperandList().

Here is the call graph for this function:

◆ isBound() [1/2]

bool TTAMachine::HWOperation::isBound ( const FUPort port) const

◆ isBound() [2/2]

bool TTAMachine::HWOperation::isBound ( int  operand) const

Checks whetever the given operand is bound to some port.

Parameters
operandThe operand.
Returns
True if bound and otherwise false.

Definition at line 349 of file HWOperation.cc.

349 {
350 if (operand < 1) {
351 THROW_EXCEPTION(OutOfRange, "Operand out of range (must be > 0).");
352 }
353 return MapTools::containsKey(operandBinding_, operand);
354}
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition Exception.hh:39
static bool containsKey(const MapType &aMap, const KeyType &aKey)

References MapTools::containsKey(), operandBinding_, and THROW_EXCEPTION.

Here is the call graph for this function:

◆ latency() [1/2]

int TTAMachine::HWOperation::latency ( ) const

Returns the number of cycles used during execution of the operation.

Different results may have different latencies, thus this is the longest latency of any result produced by the operation. After this latency the operation execution has been finished and no results will be produced.

Returns
The latency of the operation.

Definition at line 216 of file HWOperation.cc.

216 {
217 return pipeline_->latency();
218}

References TTAMachine::ExecutionPipeline::latency(), and pipeline_.

Referenced by AddFUFromHDBDialog::acceptToList(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), MultiLatencyOperationExecutor::advanceClock(), ControlFlowGraph::buildMBBFromBB(), ExecutionPipelineResource::canAssignSource(), FUGen::checkForValidity(), FullyConnectedCheck::connectFUPort(), FUTestbenchGenerator::createStimulus(), ExecutionPipelineBroker::earliestFromDestination(), ExecutionPipelineBroker::earliestFromSource(), MoveNode::earliestResultReadCycle(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), HDBBrowserWindow::fuArchLabel(), HDBToHtml::fuArchToHtml(), CompiledSimCodeGenerator::generateLoadTrigger(), ProGe::RV32MicroCodeGenerator::generateOperationLatencyLogic(), CompiledSimCodeGenerator::generateTriggerCode(), CompiledSimCodeGenerator::handleOperation(), CompiledSimCodeGenerator::handleOperationWithoutDag(), HDB::HDBManager::isMatchingArchitecture(), DataDependenceEdge::latencySt(), ExecutionPipelineBroker::latestFromDestination(), MoveNode::latestTriggerWriteCycle(), ExecutionPipelineResource::latestTriggerWriteCycle(), AddFUFromHDBDialog::loadHDB(), TTAMachine::FunctionUnit::maxLatency(), MultiLatencyOperationExecutor::MultiLatencyOperationExecutor(), TTAMachine::FunctionUnit::needsConflictDetection(), AddFUFromHDBDialog::onAdd(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), HDB::FUArchitecture::operator==(), FUGen::parseOperations(), HDB::FUArchitecture::portDirection(), BF2ScheduleFront::prefResultCycle(), printLatexFunctionUnitDescription(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), ExecutionPipelineResource::resultReadyCycle(), DataDependenceEdge::saveState(), BUBasicBlockScheduler::scheduleMove(), DataDependenceGraph::setMachine(), ExecutionPipelineResource::setResultWriten(), MultiLatencyOperationExecutor::startOperation(), ExecutionPipelineResource::testTriggerResult(), FUPortImplementationDialog::TransferDataToWindow(), ExecutionPipelineResource::unsetResultWriten(), and OperationDialog::updateLatency().

Here is the call graph for this function:

◆ latency() [2/2]

int TTAMachine::HWOperation::latency ( int  output) const

Returns the latency for the given output.

Parameters
outputThe number of the output.
Returns
The latency for the given output.
Exceptions
IllegalParametersIf the given output is not written in the pipeline.

Definition at line 230 of file HWOperation.cc.

230 {
231
232 return pipeline_->latency(output);
233}

References TTAMachine::ExecutionPipeline::latency(), and pipeline_.

Here is the call graph for this function:

◆ loadState()

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

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

Parameters
stateThe ObjectState tree.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.

Implements Serializable.

Reimplemented in SmartHWOperation.

Definition at line 454 of file HWOperation.cc.

454 {
455
456 const string procName = "HWOperation::loadState";
457
458 if (state->name() != OSNAME_OPERATION) {
459 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
460 }
461
462 MOMTextGenerator textGenerator;
463
464 try {
466 } catch (const Exception& exception) {
468 __FILE__, __LINE__, procName, exception.errorMessage());
469 }
470
471 try {
472 // load operand binding map
473 operandBinding_.clear();
474 for (int i = 0; i < state->childCount(); i++) {
475 ObjectState* child = state->child(i);
476 if (child->name() == OSNAME_OPERAND_BINDING) {
477 int operand = child->intAttribute(OSKEY_OPERAND);
478 string portName = child->stringAttribute(OSKEY_PORT);
479
480 if (parentUnit()->hasOperationPort(portName)) {
481 FUPort* port = parentUnit()->operationPort(portName);
482 if (isBound(*port)) {
483 format text = textGenerator.text(
485 text % name() % portName % parentUnit()->name();
487 __FILE__, __LINE__, procName, text.str());
488 } else if (this->port(operand) != NULL) {
489 format text = textGenerator.text(
491 text % operand % portName % name() %
492 parentUnit()->name() %
493 this->port(operand)->name();
495 __FILE__, __LINE__, procName, text.str());
496 } else {
497 bindPort(operand, *port);
498 }
499 } else {
500 format text = textGenerator.text(
502 text % portName % name() % parentUnit()->name();
504 __FILE__, __LINE__, procName, text.str());
505 }
506
507 }
508 }
509
510 // load pipeline
511 if (pipeline_ != NULL) {
512 delete pipeline_;
513 }
514 ObjectState* pipelineState = state->childByName(
516 pipeline_ = new ExecutionPipeline(*this);
517 pipeline()->loadState(pipelineState);
518
519 } catch (const Exception& e) {
521 __FILE__, __LINE__, procName, e.errorMessage());
522 }
523}
ObjectState * childByName(const std::string &name) const
ObjectState * child(int index) const
int intAttribute(const std::string &name) const
std::string name() const
int childCount() const
virtual TCEString name() const
void loadState(const ObjectState *state)
static const std::string OSNAME_PIPELINE
ObjectState name for ExecutionPipeline.
virtual FUPort * operationPort(const std::string &name) const
ExecutionPipeline * pipeline() const
virtual void bindPort(int operand, const FUPort &port)
static const std::string OSKEY_PORT
ObjectState attribute key for port name.
static const std::string OSKEY_OPERAND
ObjectState attribute key for operand index.
static const std::string OSNAME_OPERAND_BINDING
ObjectState name for an operand binding.
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.

References bindPort(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), Exception::errorMessage(), ObjectState::intAttribute(), isBound(), TTAMachine::ExecutionPipeline::loadState(), name(), TTAMachine::Component::name(), TTAMachine::Port::name(), ObjectState::name(), operandBinding_, TTAMachine::FunctionUnit::operationPort(), OSKEY_NAME, OSKEY_OPERAND, OSKEY_PORT, OSNAME_OPERAND_BINDING, OSNAME_OPERATION, TTAMachine::ExecutionPipeline::OSNAME_PIPELINE, parentUnit(), pipeline(), pipeline_, port(), setName(), ObjectState::stringAttribute(), Texts::TextGenerator::text(), MOMTextGenerator::TXT_OPERAND_ALREADY_BOUND, MOMTextGenerator::TXT_OPERAND_BOUND_TO_PORT, and MOMTextGenerator::TXT_OPERATION_REF_LOAD_ERR_PORT.

Referenced by HWOperation().

Here is the call graph for this function:

◆ name()

const string & TTAMachine::HWOperation::name ( ) const

Returns the name of the operation.

Returns
The name of the operation.

Definition at line 141 of file HWOperation.cc.

141 {
142 return name_;
143}

References name_.

Referenced by AddFUFromHDBDialog::acceptToList(), HDB::HDBManager::addFUArchitecture(), HDB::HDBManager::addFUImplementation(), TTAMachine::FunctionUnit::addOperation(), BEMGenerator::addPortCodes(), UniversalFunctionUnit::addSupportedOperation(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), ImmediateAnalyzer::analyzeImmediateCapabilitiesForOperation(), MachineStateBuilder::bindPortsToOperands(), ControlFlowGraph::buildMBBFromBB(), AddressSpaceCheck::check(), OperationBindingCheck::check(), FUValidator::checkOperandBindings(), BEMValidator::checkSocketCodeTable(), FUFactory::createEditPart(), GCUFactory::createEditPart(), FUGen::createFUHeaderComment(), POMDisassembler::createFUPort(), FUTestbenchGenerator::createStimulus(), ConflictDetectionCodeGenerator::detectConflicts(), ProximFUDetailsCmd::Do(), SocketBusConnCmd::Do(), CodeCompressorPlugin::encodeFUTerminal(), InfoProcCommand::execute(), InfoStatsCommand::execute(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), ProGe::NetlistGenerator::findCorrespondingPort(), AlmaIFIntegrator::findMemories(), TTAProgram::TerminalFUPort::findNewOperationIndex(), SimulatorFrontend::finishSimulation(), HDBBrowserWindow::fuArchLabel(), ComponentImplementationSelector::fuArchsByOpSetWithMinLatency(), HDBToHtml::fuArchToHtml(), HDB::HDBManager::fuEntriesByArchitecture(), FUFiniteStateAutomaton::FUFiniteStateAutomaton(), CompiledSimCodeGenerator::generateConstructorCode(), generateHeader(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), CompiledSimCodeGenerator::generateInstruction(), CompiledSimCodeGenerator::generateLoadTrigger(), CompiledSimCodeGenerator::generateStoreTrigger(), CompiledSimCodeGenerator::generateTriggerCode(), MachineInfo::getOpset(), MachineInfo::getOpset(), CompiledSimCodeGenerator::handleJump(), CompiledSimCodeGenerator::handleOperation(), CompiledSimCodeGenerator::handleOperationWithoutDag(), HWOperation(), llvm::LLVMTCEBuilder::initDataSections(), io(), HDB::HDBManager::isMatchingArchitecture(), TTAMachine::ExecutionPipeline::latency(), llvm::LLVMTCEIRBuilder::LLVMTCEIRBuilder(), AddFUFromHDBDialog::loadHDB(), TTAMachine::ExecutionPipeline::loadState(), loadState(), MachineInfo::maxMemoryAlignment(), MultiLatencyOperationExecutor::MultiLatencyOperationExecutor(), AddFUFromHDBDialog::onAdd(), FUImplementationDialog::onOK(), FUImplementationDialog::onSetOpcode(), DefaultDecoderGenerator::opcode(), ProGe::NetlistGenerator::opcodePortWidth(), ProGe::NetlistGenerator::opcodePortWidth(), TTAProgram::TPEFResourceUpdater::operand(), operandBindingsString(), MachineInfo::operandFromPort(), MachineConnectivityCheck::operandWidth(), DCMFUResourceConflictDetector::operationID(), ReservationTableFUResourceConflictDetector::operationID(), HDB::FUArchitecture::operator==(), MachineInfo::osalOperation(), PlatformIntegrator::parseDataMemories(), ProgrammabilityValidator::printConnection(), printLatexFunctionUnitDescription(), TTAMachine::ResourceVectorSet::ResourceVectorSet(), saveState(), DataDependenceGraph::setMachine(), setName(), TTAProgram::TerminalFUPort::setOperation(), TTAMachine::ExecutionPipeline::slack(), TTAProgram::TerminalFUPort::TerminalFUPort(), TTAProgram::TerminalFUPort::TerminalFUPort(), EntryKeyDataFunctionUnit::toString(), TTAProgram::TerminalFUPort::toString(), FUPortImplementationDialog::TransferDataToWindow(), OperationDialog::TransferDataToWindow(), OTAOperationDialog::TransferDataToWindow(), FUImplementationDialog::update(), TTAMachine::FUPort::updateBindingString(), FUDialog::updateOperationList(), GCUDialog::updateOperationList(), TDGen::writeBackendCode(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), and TDGen::writeInstrInfo().

◆ numberOfInputs()

int TTAMachine::HWOperation::numberOfInputs ( ) const

Returns the number of input ports tied to the operation

Returns
Number of input ports

Definition at line 384 of file HWOperation.cc.

384 {
385 int inputs = 0;
386 for (int i = 1; i < operandCount() + 1; i++) {
387 FUPort* p = port(i);
388 if (p == NULL) {
389 continue;
390 } else if (p->isInput()) {
391 inputs++;
392 }
393 }
394 return inputs;
395}

References TTAMachine::Port::isInput(), operandCount(), and port().

Referenced by UniversalFunctionUnit::addSupportedOperation(), and OTAOperationDialog::TransferDataToWindow().

Here is the call graph for this function:

◆ numberOfOutputs()

int TTAMachine::HWOperation::numberOfOutputs ( ) const

Returns the number of output ports tied to the operation

Returns
Number of output ports

Definition at line 404 of file HWOperation.cc.

404 {
405 int outputs = 0;
406 for (int i = 1; i < operandCount() + 1; i++) {
407 FUPort* p = port(i);
408 if (p == NULL) {
409 continue;
410 }
411 if (p->isOutput()) {
412 outputs++;
413 }
414 }
415 return outputs;
416}

References TTAMachine::Port::isOutput(), operandCount(), and port().

Referenced by UniversalFunctionUnit::addSupportedOperation(), and OTAOperationDialog::TransferDataToWindow().

Here is the call graph for this function:

◆ operandCount()

int TTAMachine::HWOperation::operandCount ( ) const

◆ parentUnit()

FunctionUnit * TTAMachine::HWOperation::parentUnit ( ) const

◆ pipeline()

ExecutionPipeline * TTAMachine::HWOperation::pipeline ( ) const

Returns the pipeline used by this operation.

Returns
The pipeline used by this operation.

Definition at line 201 of file HWOperation.cc.

201 {
202 return pipeline_;
203}

References pipeline_.

Referenced by HDB::HDBManager::addFUArchitecture(), VectorLSGenerator::addOperation(), HDB::HDBManager::addOperationPipelinesToFUArchitecture(), MachineStateBuilder::addPortToFU(), OperationBindingCheck::check(), FUValidator::checkOperandBindings(), FUValidator::checkOperations(), TTAMachine::FunctionUnit::cleanup(), FullyConnectedCheck::connectFUPort(), ADFCombiner::connectVectorLSU(), UniversalMachine::construct(), BlocksLSU::CreateHWLoadOp(), BlocksALU::CreateHWOp(), BlocksGCU::CreateHWOp(), BlocksMUL::CreateHWOp(), BlocksLSU::CreateHWStoreOp(), OpsetDialog::createOperation(), AddGCUCmd::Do(), llvm::LLVMTCEBuilder::emitOperationMacro(), TTAMachine::ExecutionPipeline::ExecutionPipeline(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), HDBToHtml::fuArchToHtml(), CostEstimator::ICDecoderEstimatorPlugin::generateControlUnit(), HDB::HDBManager::isMatchingArchitecture(), loadState(), AddFUFromHDBDialog::onAdd(), OperationDialog::onDeleteOperand(), OperationDialog::onDeleteResource(), OperationDialog::onOperandLClick(), OperationDialog::onResourceLClick(), HDB::FUArchitecture::operator==(), HDB::FUArchitecture::portDirection(), ReservationTable::ReservationTable(), TTAMachine::ResourceVectorSet::ResourceVectorSet(), SmartHWOperation::SmartHWOperation(), FUPortImplementationDialog::TransferDataToWindow(), OperationDialog::updateOperandList(), OperationDialog::updateResourceGrid(), OperationDialog::updateUsageGrid(), OperationDialog::warnOnResourcesWithoutUsages(), and TTAMachine::PipelineElement::~PipelineElement().

◆ port()

FUPort * TTAMachine::HWOperation::port ( int  operand) const
virtual

Returns the port of the function unit that is bound to the given operand.

Returns NULL if no port is bound to the given operand.

Parameters
operandIndex of the operand.
Returns
The port or NULL.

Reimplemented in SmartHWOperation.

Definition at line 320 of file HWOperation.cc.

320 {
321 OperandBindingMap::const_iterator iter = operandBinding_.find(operand);
322 if (iter != operandBinding_.end()) {
323 return const_cast<FUPort*>((*iter).second);
324 } else {
325 return NULL;
326 }
327}

References operandBinding_.

Referenced by ProGe::RV32MicroCodeGenerator::addBPorts(), RegisterCopyAdder::addConnectionRegisterCopies(), ProGe::RV32MicroCodeGenerator::addIPorts(), ProGe::RV32MicroCodeGenerator::addR1Ports(), ProGe::RV32MicroCodeGenerator::addR1RPorts(), ProGe::RV32MicroCodeGenerator::addRPorts(), ProGe::RV32MicroCodeGenerator::addSPorts(), ProGe::RV32MicroCodeGenerator::addUJPorts(), InputFUBroker::allAvailableResources(), OutputFUBroker::allAvailableResources(), ImmediateAnalyzer::analyzeImmediateCapabilitiesForOperation(), bindPort(), MachineStateBuilder::bindPortsToOperands(), ControlFlowGraph::buildMBBFromBB(), MachineConnectivityCheck::busConnectedToFU(), ExecutionPipelineResource::canAssignDestination(), ExecutionPipelineResource::canAssignSource(), MachineConnectivityCheck::canBypassOpToDst(), OperationBindingCheck::check(), FUGen::checkForValidity(), MachineValidator::checkIMemAddrWidth(), MachineValidator::checkJumpAndCallOperandBindings(), FUValidator::checkOperandBindings(), FUValidator::checkOperations(), MachineValidator::checkProgramCounterPort(), MachineValidator::checkRAPortHasSameWidthAsPCPort(), ADFCombiner::connectVectorLSU(), MachineConnectivityCheck::copyOpFUs(), ExecutionPipelineBroker::earliestFromSource(), ProGe::NetlistGenerator::findCorrespondingPort(), TTAProgram::TPEFProgramFactory::findGuard(), SimulatorFrontend::findPort(), TTAProgram::TPEFProgramFactory::findPort(), MachineConnectivityCheck::findPossibleDestinationPorts(), MachineConnectivityCheck::findPossibleSourcePorts(), HDBToHtml::fuArchToHtml(), ProGeTestBenchGenerator::generate(), CompiledSimCodeGenerator::generateLoadTrigger(), CompiledSimCodeGenerator::generateStoreTrigger(), CompiledSimCodeGenerator::generateTriggerCode(), MachineInfo::getBoundPort(), getOutputPort(), MachineInfo::getPortBindingsOfOperation(), BasicBlockScheduler::getTriggerOperand(), CompiledSimCodeGenerator::handleJump(), CompiledSimCodeGenerator::handleOperationWithoutDag(), ProGe::ProcessorGenerator::iMemAddressWidth(), BFOptimization::immCountPreventsScheduling(), io(), isBound(), HDB::HDBManager::isMatchingArchitecture(), TTAMachine::ExecutionPipeline::isOperandBound(), BF2Scheduler::isTrigger(), ExecutionPipelineBroker::latestFromSource(), loadState(), numberOfInputs(), numberOfOutputs(), OperationDialog::onBindOperand(), OperationDialog::onDeleteOperand(), operandBindingsString(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandPort(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), ExecutionPipelineResource::operandTooLate(), BFShareOperands::operator()(), HDB::FUArchitecture::operator==(), SmartHWOperation::otherMandatoryInputsBound(), FUGen::parseOperations(), ExecutionPipelineResource::poConflictsWithInputPort(), SmartHWOperation::port(), BF2Scheduler::preAllocateFunctionUnits(), BF2Scheduler::preAllocateFunctionUnits(), MachineConnectivityCheck::raConnected(), BF2Scheduler::releasePortForOp(), HDB::HDBManager::resolveArchitecturePort(), TTAMachine::ResourceVector::ResourceVector(), ExecutionPipelineResource::resultCausesTriggerBetweenOperandSharing(), ExecutionPipelineResource::resultPort(), ExecutionPipelineResource::resultReadyCycle(), MachineResourceManager::rFPortOrFUIndexReference(), BFOptimization::RFReadPortCountPreventsScheduling(), FUGen::scheduleOperations(), ExecutionPipelineResource::setOperandsUsed(), ExecutionPipelineResource::setResultWriten(), ExecutionPipelineResource::testTriggerResult(), ExecutionPipelineResource::triggerAllowedAtCycle(), unbindPort(), ExecutionPipelineResource::unsetOperandsUsed(), ExecutionPipelineResource::unsetResultWriten(), OperationDialog::updateOperandList(), DefaultDecoderGenerator::writeControlRegisterMappings(), and DefaultDecoderGenerator::writeControlRulesOfFUInputPort().

◆ saveState()

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

Saves the contents to an ObjectState tree.

Returns
The newly created ObjectState tree.

Implements Serializable.

Definition at line 424 of file HWOperation.cc.

424 {
425
426 ObjectState* operation = new ObjectState(OSNAME_OPERATION);
427 operation->setAttribute(OSKEY_NAME, name());
428
429 // save operand binding map
430 for (OperandBindingMap::const_iterator iter = operandBinding_.begin();
431 iter != operandBinding_.end(); iter++) {
432 pair<int, const FUPort*> binding = *iter;
434 operation->addChild(bindingState);
435 bindingState->setAttribute(OSKEY_OPERAND, binding.first);
436 bindingState->setAttribute(OSKEY_PORT, binding.second->name());
437 }
438
439 // save pipeline
440 operation->addChild(pipeline_->saveState());
441
442 return operation;
443}
void setAttribute(const std::string &name, const std::string &value)
void addChild(ObjectState *child)

References ObjectState::addChild(), name(), operandBinding_, OSKEY_NAME, OSKEY_OPERAND, OSKEY_PORT, OSNAME_OPERAND_BINDING, OSNAME_OPERATION, pipeline_, TTAMachine::ExecutionPipeline::saveState(), and ObjectState::setAttribute().

Referenced by TTAMachine::FunctionUnit::saveState().

Here is the call graph for this function:

◆ setName()

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

Sets the name of the operation.

Parameters
nameThe new name.
Exceptions
ComponentAlreadyExistsIf another operation exists by the same name in the function unit.
InvalidNameIf the given name is not valid.

Reimplemented in SmartHWOperation.

Definition at line 155 of file HWOperation.cc.

155 {
156
157 string lowerName = StringTools::stringToLower(name);
158
159 if (lowerName == this->name()) {
160 return;
161 }
162
163 const string procName = "HWOperation::setName";
164
165 if (parentUnit()->hasOperation(lowerName)) {
166 MOMTextGenerator textGenerator;
167 format text = textGenerator.text(
169 text % name % parentUnit()->name();
171 __FILE__, __LINE__, procName, text.str());
172 }
173
174 if (!MachineTester::isValidComponentName(lowerName)) {
175 MOMTextGenerator textGen;
176 format errorMsg = textGen.text(MOMTextGenerator::TXT_INVALID_NAME);
177 errorMsg % lowerName;
178 throw InvalidName(__FILE__, __LINE__, procName, errorMsg.str());
179 }
180
181 name_ = lowerName;
182}

References MachineTester::isValidComponentName(), name(), TTAMachine::Component::name(), name_, parentUnit(), StringTools::stringToLower(), Texts::TextGenerator::text(), MOMTextGenerator::TXT_INVALID_NAME, and MOMTextGenerator::TXT_OPERATION_EXISTS_BY_SAME_NAME.

Referenced by HWOperation(), loadState(), and OperationDialog::onOK().

Here is the call graph for this function:

◆ slack()

int TTAMachine::HWOperation::slack ( int  input) const

Returns the slack of the given input.

The slack tells how many cycles AFTER the trigger, opcode-setting move is scheduled, can the operand be scheduled (and still affect correctly the result of the operation).

Parameters
inputThe number of the input.
Returns
The slack of the given input.
Exceptions
IllegalParametersIf the given input is not read in the pipeline.

Definition at line 248 of file HWOperation.cc.

248 {
249
250 return pipeline_->slack(input);
251}

References pipeline_, and TTAMachine::ExecutionPipeline::slack().

Referenced by ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandTooLate(), ExecutionPipelineResource::setOperandsUsed(), ExecutionPipelineResource::triggerTooEarly(), and ExecutionPipelineResource::unsetOperandsUsed().

Here is the call graph for this function:

◆ unbindPort()

void TTAMachine::HWOperation::unbindPort ( const FUPort port)
virtual

Unbinds the operand bound to the given port.

Parameters
portThe port.

Reimplemented in SmartHWOperation.

Definition at line 296 of file HWOperation.cc.

296 {
299}
static bool removeItemsByValue(MapType &aMap, const ValueType &aValue)

References operandBinding_, port(), MapTools::removeItemsByValue(), and TTAMachine::FUPort::updateBindingString().

Referenced by TTAMachine::FUPort::cleanupOperandBindings(), OperationDialog::onBindOperand(), and OperationDialog::onDeleteOperand().

Here is the call graph for this function:

Member Data Documentation

◆ name_

std::string TTAMachine::HWOperation::name_
private

Name of the operation.

Definition at line 97 of file HWOperation.hh.

Referenced by HWOperation(), name(), and setName().

◆ operandBinding_

OperandBindingMap TTAMachine::HWOperation::operandBinding_
private

Maps operands of operation to particular ports of the parent unit.

Definition at line 103 of file HWOperation.hh.

Referenced by bindPort(), io(), isBound(), isBound(), loadState(), operandCount(), port(), saveState(), and unbindPort().

◆ OSKEY_NAME

const string TTAMachine::HWOperation::OSKEY_NAME = "name"
static

ObjectState attribute key for name of the operation.

Definition at line 84 of file HWOperation.hh.

Referenced by HWOperation(), loadState(), ADFSerializer::machineOperation(), ADFSerializer::mdfOperation(), and saveState().

◆ OSKEY_OPERAND

const string TTAMachine::HWOperation::OSKEY_OPERAND = "operand"
static

ObjectState attribute key for operand index.

Definition at line 88 of file HWOperation.hh.

Referenced by loadState(), ADFSerializer::machineOperation(), ADFSerializer::mdfOperation(), and saveState().

◆ OSKEY_PORT

const string TTAMachine::HWOperation::OSKEY_PORT = "port"
static

ObjectState attribute key for port name.

Definition at line 90 of file HWOperation.hh.

Referenced by loadState(), ADFSerializer::machineOperation(), ADFSerializer::mdfOperation(), and saveState().

◆ OSNAME_OPERAND_BINDING

const string TTAMachine::HWOperation::OSNAME_OPERAND_BINDING = "binding"
static

ObjectState name for an operand binding.

Definition at line 86 of file HWOperation.hh.

Referenced by loadState(), ADFSerializer::machineOperation(), ADFSerializer::mdfOperation(), and saveState().

◆ OSNAME_OPERATION

const string TTAMachine::HWOperation::OSNAME_OPERATION = "operation"
static

◆ parent_

FunctionUnit* TTAMachine::HWOperation::parent_
private

The parent unit.

Definition at line 101 of file HWOperation.hh.

Referenced by HWOperation(), HWOperation(), parentUnit(), and ~HWOperation().

◆ pipeline_

ExecutionPipeline* TTAMachine::HWOperation::pipeline_
private

Pipeline of the operation.

Definition at line 99 of file HWOperation.hh.

Referenced by HWOperation(), HWOperation(), latency(), latency(), loadState(), pipeline(), saveState(), slack(), and ~HWOperation().


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