OpenASIP  2.0
Static Public Member Functions | Private Member Functions | List of all members
FUValidator Class Reference

#include <FUValidator.hh>

Collaboration diagram for FUValidator:
Collaboration graph

Static Public Member Functions

static void checkOperandBindings (const TTAMachine::FunctionUnit &fu, MachineValidatorResults &results)
 
static void checkOperations (const TTAMachine::FunctionUnit &fu, MachineValidatorResults &results)
 

Private Member Functions

 FUValidator ()
 

Detailed Description

Validator for function units.

Definition at line 45 of file FUValidator.hh.

Constructor & Destructor Documentation

◆ FUValidator()

FUValidator::FUValidator ( )
private

Member Function Documentation

◆ checkOperandBindings()

void FUValidator::checkOperandBindings ( const TTAMachine::FunctionUnit fu,
MachineValidatorResults results 
)
static

Checks that the operands used in the operations of the given FU are bound to some port.

Parameters
fuThe function unit.
resultsResults of the validation are added to the given instance.

Definition at line 54 of file FUValidator.cc.

56  {
57 
58  for (int i = 0; i < fu.operationCount(); i++) {
59  HWOperation* operation = fu.operation(i);
60  ExecutionPipeline* pLine = operation->pipeline();
61  ExecutionPipeline::OperandSet usedOperands;
62  for (int i = 0; i < pLine->latency(); i++) {
63  ExecutionPipeline::OperandSet readOperands =
64  pLine->readOperands(i);
65  ExecutionPipeline::OperandSet writtenOperands =
66  pLine->writtenOperands(i);
67  usedOperands.insert(
68  readOperands.begin(), readOperands.end());
69  usedOperands.insert(
70  writtenOperands.begin(), writtenOperands.end());
71  }
72 
73 
74  for (ExecutionPipeline::OperandSet::const_iterator iter =
75  usedOperands.begin();
76  iter != usedOperands.end(); iter++) {
77  int io = *iter;
78  FUPort* port = operation->port(io);
79  if (port == NULL) {
80  boost::format errorMsg(
81  "IO number %1% is not bound to any port in "
82  "operation %2% in FU %3%.");
83  errorMsg % io % operation->name() % fu.name();
84  results.addError(
85  MachineValidator::USED_IO_NOT_BOUND, errorMsg.str());
86  }
87  }
88  }
89 }

References MachineValidatorResults::addError(), TTAMachine::ExecutionPipeline::latency(), TTAMachine::HWOperation::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::HWOperation::pipeline(), TTAMachine::HWOperation::port(), TTAMachine::ExecutionPipeline::readOperands(), MachineValidator::USED_IO_NOT_BOUND, and TTAMachine::ExecutionPipeline::writtenOperands().

Referenced by HDB::HDBManager::addFUArchitecture(), and MachineValidator::checkOperandBindings().

Here is the call graph for this function:

◆ checkOperations()

void FUValidator::checkOperations ( const TTAMachine::FunctionUnit fu,
MachineValidatorResults results 
)
static

Checks that the FU has at least one operation which is valid, i.e. has at least one triggering input port

Parameters
fuThe function unit.
resultsResults of the validation are added to the given instance.

Definition at line 100 of file FUValidator.cc.

102  {
103 
104  for (int i = 0; i < fu.operationCount(); i++) {
105  HWOperation* operation = fu.operation(i);
106  ExecutionPipeline* pLine = operation->pipeline();
107  ExecutionPipeline::OperandSet usedOperands;
108  for (int i = 0; i < pLine->latency(); i++) {
109  ExecutionPipeline::OperandSet readOperands =
110  pLine->readOperands(i);
111  for (ExecutionPipeline::OperandSet::const_iterator iter =
112  readOperands.begin(); iter != readOperands.end(); iter++) {
113  FUPort* port = operation->port(*iter);
114  if (port != NULL && port->isTriggering()) {
115  return;
116  }
117  }
118  }
119  }
120 
121  boost::format errorMsg("FU %1% has no valid operations.");
122  errorMsg % fu.name();
123  results.addError(MachineValidator::FU_NO_VALID_OPERATIONS, errorMsg.str());
124 }

References MachineValidatorResults::addError(), MachineValidator::FU_NO_VALID_OPERATIONS, TTAMachine::FUPort::isTriggering(), TTAMachine::ExecutionPipeline::latency(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::HWOperation::pipeline(), TTAMachine::HWOperation::port(), and TTAMachine::ExecutionPipeline::readOperands().

Referenced by HDB::HDBManager::addFUArchitecture().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::HWOperation
Definition: HWOperation.hh:52
MachineValidator::USED_IO_NOT_BOUND
@ USED_IO_NOT_BOUND
Pipeline uses an IO which is not bound.
Definition: MachineValidator.hh:61
TTAMachine::ExecutionPipeline::writtenOperands
OperandSet writtenOperands(int cycle) const
Definition: ExecutionPipeline.cc:429
TTAMachine::ExecutionPipeline::readOperands
OperandSet readOperands(int cycle) const
Definition: ExecutionPipeline.cc:408
TTAMachine::FUPort::isTriggering
virtual bool isTriggering() const
Definition: FUPort.cc:182
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
MachineValidatorResults::addError
void addError(MachineValidator::ErrorCode code, const std::string &errorMsg)
Definition: MachineValidatorResults.cc:85
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
TTAMachine::ExecutionPipeline::OperandSet
std::set< int > OperandSet
Set for operand indexes.
Definition: ExecutionPipeline.hh:58
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
TTAMachine::ExecutionPipeline
Definition: ExecutionPipeline.hh:55
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAMachine::ExecutionPipeline::latency
int latency() const
Definition: ExecutionPipeline.cc:482
MachineValidator::FU_NO_VALID_OPERATIONS
@ FU_NO_VALID_OPERATIONS
FU has no operations with a trigger.
Definition: MachineValidator.hh:73