OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
AddressSpaceCheck Class Reference

#include <AddressSpaceCheck.hh>

Inheritance diagram for AddressSpaceCheck:
Inheritance graph
Collaboration diagram for AddressSpaceCheck:
Collaboration graph

Public Member Functions

 AddressSpaceCheck (OperationPool &operationPool)
 
virtual ~AddressSpaceCheck ()
 
virtual bool check (const TTAMachine::Machine &mach, MachineCheckResults &results) const
 
- Public Member Functions inherited from MachineCheck
virtual std::string shortDescription () const
 
virtual std::string description () const
 
virtual bool canFix (const TTAMachine::Machine &mach) const
 
virtual std::string fix (TTAMachine::Machine &mach) const
 
virtual ~MachineCheck ()
 

Private Attributes

OperationPooloperationPool_
 

Additional Inherited Members

- Protected Member Functions inherited from MachineCheck
 MachineCheck (const std::string &shortDesc_)
 

Detailed Description

MachineCheck to check if the FUs' operations access memory and there is a memory address space available for them.

Definition at line 50 of file AddressSpaceCheck.hh.

Constructor & Destructor Documentation

◆ AddressSpaceCheck()

AddressSpaceCheck::AddressSpaceCheck ( OperationPool operationPool)

The constructor.

Parameters
operationPooloperation pool to search the operations for

Definition at line 51 of file AddressSpaceCheck.cc.

51  :
52  MachineCheck("Address space check."),
53  operationPool_(operationPool) {
54 }

◆ ~AddressSpaceCheck()

AddressSpaceCheck::~AddressSpaceCheck ( )
virtual

The destructor.

Definition at line 59 of file AddressSpaceCheck.cc.

59  {
60 }

Member Function Documentation

◆ check()

bool AddressSpaceCheck::check ( const TTAMachine::Machine mach,
MachineCheckResults results 
) const
virtual

Checks that if the FUs' operations access memory, there is a memory address space available for them.

Parameters
machMachine to be checked.
resultsCheck results.
Returns
True if the check passed

Implements MachineCheck.

Definition at line 71 of file AddressSpaceCheck.cc.

73  {
74 
76  for (int i = 0; i < FUs.count(); i++) {
77  FunctionUnit* unit = FUs.item(i);
78 
79  if (unit->addressSpace() != NULL) {
80  continue;
81  }
82 
83  for (int j = 0; j < unit->operationCount(); ++j) {
84  Operation& op =
85  operationPool_.operation(unit->operation(j)->name().c_str());
86 
87  // skip any Nulloperations because the check is done elsewhere
88  if (&op == &NullOperation::instance()) {
89  continue;
90  }
91 
92  if (op.usesMemory() && unit->addressSpace() == NULL) {
93  results.addError(*this,
94  std::string("operation ") + op.name() + " accesses memory" +
95  " but the memory address space was not set.");
96  return false;
97  }
98  }
99  } // end for all FUs
100 
101  return true;
102 }

References MachineCheckResults::addError(), TTAMachine::FunctionUnit::addressSpace(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), NullOperation::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::HWOperation::name(), Operation::name(), OperationPool::operation(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), operationPool_, and Operation::usesMemory().

Referenced by MachineStateBuilder::buildMachineState().

Here is the call graph for this function:

Member Data Documentation

◆ operationPool_

OperationPool& AddressSpaceCheck::operationPool_
private

Definition at line 59 of file AddressSpaceCheck.hh.

Referenced by check().


The documentation for this class was generated from the following files:
OperationPool::operation
Operation & operation(const char *name)
Definition: OperationPool.cc:99
MachineCheck::MachineCheck
MachineCheck(const std::string &shortDesc_)
Definition: MachineCheck.cc:41
MachineCheckResults::addError
void addError(const MachineCheck &check, const std::string &errorMsg)
Definition: MachineCheckResults.cc:85
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
TTAMachine::Machine::Navigator::count
int count() const
NullOperation::instance
static NullOperation & instance()
Operation::name
virtual TCEString name() const
Definition: Operation.cc:93
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
AddressSpaceCheck::operationPool_
OperationPool & operationPool_
Definition: AddressSpaceCheck.hh:59
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
Operation
Definition: Operation.hh:59
Operation::usesMemory
virtual bool usesMemory() const
Definition: Operation.cc:232
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAMachine::Machine::Navigator
Definition: Machine.hh:186