OpenASIP  2.0
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. More...
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for name of the operation. More...
 
static const std::string OSNAME_OPERAND_BINDING = "binding"
 ObjectState name for an operand binding. More...
 
static const std::string OSKEY_OPERAND = "operand"
 ObjectState attribute key for operand index. More...
 
static const std::string OSKEY_PORT = "port"
 ObjectState attribute key for port name. More...
 

Private Types

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

Private Attributes

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

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 }

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 }

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 }

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 }

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

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

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 
374  return MapTools::keyForValue<int>(operandBinding_, &port);
375 }

References isBound(), 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(), ProgramOperation::findTriggerFromUnit(), BasicBlockScheduler::findTriggerFromUnit(), MachineResourceManager::functionUnitPortResource(), HDB::HDBManager::isMatchingArchitecture(), ExecutionPipelineResource::nodeOfInputPort(), MachineInfo::operandFromPort(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), HDB::FUArchitecture::operator==(), ProgramOperation::outputIndexFromGuard(), TTAProgram::TerminalFUPort::TerminalFUPort(), TTAProgram::ProgramWriter::terminalResource(), FUPortImplementationDialog::TransferDataToWindow(), MachineInfo::triggerIndex(), and FUImplementationDialog::update().

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 }

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(), and ExecutionPipelineResource::unsetResultWriten().

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 }

References bindPort(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), Exception::errorMessage(), ObjectState::intAttribute(), isBound(), TTAMachine::ExecutionPipeline::loadState(), name(), TTAMachine::Port::name(), ObjectState::name(), TTAMachine::Component::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(), OperationBindingCheck::check(), AddressSpaceCheck::check(), FUValidator::checkOperandBindings(), BEMValidator::checkSocketCodeTable(), FUFactory::createEditPart(), GCUFactory::createEditPart(), FUGen::createFUHeaderComment(), POMDisassembler::createFUPort(), FUTestbenchGenerator::createStimulus(), ConflictDetectionCodeGenerator::detectConflicts(), SocketBusConnCmd::Do(), ProximFUDetailsCmd::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(), CompiledSimCodeGenerator::handleJump(), CompiledSimCodeGenerator::handleOperation(), CompiledSimCodeGenerator::handleOperationWithoutDag(), HWOperation(), llvm::LLVMTCEBuilder::initDataSections(), io(), HDB::HDBManager::isMatchingArchitecture(), TTAMachine::ExecutionPipeline::latency(), llvm::LLVMTCEIRBuilder::LLVMTCEIRBuilder(), AddFUFromHDBDialog::loadHDB(), loadState(), TTAMachine::ExecutionPipeline::loadState(), MachineInfo::maxMemoryAlignment(), MultiLatencyOperationExecutor::MultiLatencyOperationExecutor(), AddFUFromHDBDialog::onAdd(), DefaultDecoderGenerator::opcode(), 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::toString(), EntryKeyDataFunctionUnit::toString(), OTAOperationDialog::TransferDataToWindow(), FUPortImplementationDialog::TransferDataToWindow(), FUImplementationDialog::update(), TTAMachine::FUPort::updateBindingString(), 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

◆ 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::addRPorts(), ProGe::RV32MicroCodeGenerator::addSPorts(), ProGe::RV32MicroCodeGenerator::addUJPorts(), OutputFUBroker::allAvailableResources(), InputFUBroker::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(), TTAProgram::TPEFProgramFactory::findPort(), SimulatorFrontend::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(), operandBindingsString(), ExecutionPipelineResource::operandOverwritten(), ExecutionPipelineResource::operandPort(), ExecutionPipelineResource::operandSharePreventsTriggerForScheduledResult(), ExecutionPipelineResource::operandTooLate(), BFShareOperands::operator()(), HDB::FUArchitecture::operator==(), FUGen::parseOperations(), ExecutionPipelineResource::poConflictsWithInputPort(), 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(), 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;
433  ObjectState* bindingState = new ObjectState(OSNAME_OPERAND_BINDING);
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 }

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(), and loadState().

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.

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

Referenced by TTAMachine::FUPort::cleanupOperandBindings().

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(), 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(), 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(), 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(), 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(), 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(), parentUnit(), and ~HWOperation().

◆ pipeline_

ExecutionPipeline* TTAMachine::HWOperation::pipeline_
private

Pipeline of the operation.

Definition at line 99 of file HWOperation.hh.

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


The documentation for this class was generated from the following files:
TTAMachine::HWOperation::OSKEY_OPERAND
static const std::string OSKEY_OPERAND
ObjectState attribute key for operand index.
Definition: HWOperation.hh:88
TTAMachine::HWOperation::OSNAME_OPERATION
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.
Definition: HWOperation.hh:82
TTAMachine::ExecutionPipeline::saveState
ObjectState * saveState() const
Definition: ExecutionPipeline.cc:551
TTAMachine::HWOperation::loadState
virtual void loadState(const ObjectState *state)
Definition: HWOperation.cc:454
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
TTAMachine::HWOperation::OSKEY_NAME
static const std::string OSKEY_NAME
ObjectState attribute key for name of the operation.
Definition: HWOperation.hh:84
ObjectStateLoadingException
Definition: Exception.hh:551
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
TTAMachine::HWOperation::bindPort
virtual void bindPort(int operand, const FUPort &port)
Definition: HWOperation.cc:269
OutOfRange
Definition: Exception.hh:320
TTAMachine::SubComponent::SubComponent
SubComponent()
Definition: MachinePart.cc:237
TTAMachine::ExecutionPipeline::OSNAME_PIPELINE
static const std::string OSNAME_PIPELINE
ObjectState name for ExecutionPipeline.
Definition: ExecutionPipeline.hh:97
ObjectState
Definition: ObjectState.hh:59
MOMTextGenerator::TXT_INVALID_NAME
@ TXT_INVALID_NAME
Definition: MOMTextGenerator.hh:84
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
TTAMachine::FUPort::updateBindingString
void updateBindingString() const
Definition: FUPort.cc:294
ObjectState::childByName
ObjectState * childByName(const std::string &name) const
Definition: ObjectState.cc:443
MapTools::removeItemsByValue
static bool removeItemsByValue(MapType &aMap, const ValueType &aValue)
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
TTAMachine::HWOperation::OSKEY_PORT
static const std::string OSKEY_PORT
ObjectState attribute key for port name.
Definition: HWOperation.hh:90
TTAMachine::ExecutionPipeline::slack
int slack(int input) const
Definition: ExecutionPipeline.cc:528
InvalidName
Definition: Exception.hh:827
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
MOMTextGenerator::TXT_OPERATION_REF_LOAD_ERR_PORT
@ TXT_OPERATION_REF_LOAD_ERR_PORT
Definition: MOMTextGenerator.hh:76
THROW_EXCEPTION
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition: Exception.hh:39
TTAMachine::HWOperation::name_
std::string name_
Name of the operation.
Definition: HWOperation.hh:97
TTAMachine::HWOperation::isBound
bool isBound(const FUPort &port) const
Definition: HWOperation.cc:338
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
ObjectState::childCount
int childCount() const
Exception
Definition: Exception.hh:54
TTAMachine::HWOperation::OSNAME_OPERAND_BINDING
static const std::string OSNAME_OPERAND_BINDING
ObjectState name for an operand binding.
Definition: HWOperation.hh:86
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
ObjectState::name
std::string name() const
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAMachine::HWOperation::pipeline_
ExecutionPipeline * pipeline_
Pipeline of the operation.
Definition: HWOperation.hh:99
IllegalRegistration
Definition: Exception.hh:532
TTAMachine::HWOperation::operandCount
int operandCount() const
Definition: HWOperation.cc:306
MOMTextGenerator::TXT_OPERAND_ALREADY_BOUND
@ TXT_OPERAND_ALREADY_BOUND
Definition: MOMTextGenerator.hh:79
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
TTAMachine::FunctionUnit::addOperation
virtual void addOperation(HWOperation &operation)
Definition: FunctionUnit.cc:286
MapTools::containsValue
static bool containsValue(const MapType &aMap, const ValueType &aValue)
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
MOMTextGenerator
Definition: MOMTextGenerator.hh:40
TTAMachine::HWOperation::parentUnit
FunctionUnit * parentUnit() const
Definition: HWOperation.cc:190
TTAMachine::HWOperation::parent_
FunctionUnit * parent_
The parent unit.
Definition: HWOperation.hh:101
ComponentAlreadyExists
Definition: Exception.hh:510
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
TTAMachine::FunctionUnit::operationPort
virtual FUPort * operationPort(const std::string &name) const
Definition: FunctionUnit.cc:224
MOMTextGenerator::TXT_OPERAND_BOUND_TO_PORT
@ TXT_OPERAND_BOUND_TO_PORT
Definition: MOMTextGenerator.hh:78
TTAMachine::HWOperation::operandBinding_
OperandBindingMap operandBinding_
Maps operands of operation to particular ports of the parent unit.
Definition: HWOperation.hh:103
TTAMachine::ExecutionPipeline::latency
int latency() const
Definition: ExecutionPipeline.cc:482
TTAMachine::FunctionUnit::deleteOperation
virtual void deleteOperation(HWOperation &operation)
Definition: FunctionUnit.cc:309
TTAMachine::ExecutionPipeline::loadState
void loadState(const ObjectState *state)
Definition: ExecutionPipeline.cc:611
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
TTAMachine::HWOperation::setName
virtual void setName(const std::string &name)
Definition: HWOperation.cc:155
InstanceNotFound
Definition: Exception.hh:304
MOMTextGenerator::TXT_OPERATION_EXISTS_BY_SAME_NAME
@ TXT_OPERATION_EXISTS_BY_SAME_NAME
Definition: MOMTextGenerator.hh:77