OpenASIP  2.0
Public Member Functions | List of all members
RFPortCheck Class Reference

#include <RFPortCheck.hh>

Inheritance diagram for RFPortCheck:
Inheritance graph
Collaboration diagram for RFPortCheck:
Collaboration graph

Public Member Functions

 RFPortCheck ()
 
virtual ~RFPortCheck ()
 
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 ()
 

Additional Inherited Members

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

Detailed Description

Checks that the ports of the register files are sensible.

Currently checks only that there is at least one input port in the register file.

Definition at line 44 of file RFPortCheck.hh.

Constructor & Destructor Documentation

◆ RFPortCheck()

RFPortCheck::RFPortCheck ( )

The constructor.

Definition at line 47 of file RFPortCheck.cc.

47  : MachineCheck("Sanity checks for RF ports.") {
48 }

◆ ~RFPortCheck()

RFPortCheck::~RFPortCheck ( )
virtual

The destructor.

Definition at line 53 of file RFPortCheck.cc.

53  {
54 }

Member Function Documentation

◆ check()

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

Sanity checks the RF ports of the target machine.

Parameters
machMachine to be checked.
resultsCheck results.
Returns
True if the check passed
Todo:
Check if there is no read ports and the register file has at least one register which is not a predicate reg (read by GCU).

Implements MachineCheck.

Definition at line 64 of file RFPortCheck.cc.

66  {
67 
68  bool checksOk = true;
70  for (int i = 0; i < RFs.count(); i++) {
71  const TTAMachine::RegisterFile& rf = *RFs.item(i);
72  int inputPorts = 0;
73  const int ports = rf.portCount();
74  for (int p = 0; p < ports; ++p) {
75  const TTAMachine::RFPort* port = rf.port(p);
76  if (port->isInput()) {
77  ++inputPorts;
78  break;
79  }
80  }
81  if (inputPorts == 0) {
82  results.addError(
83  *this,
84  (boost::format(
85  "Register file '%s' does not have any input ports.").
86  str()));
87  checksOk = false;
88  }
89  }
90 
91  /// @todo Check if there is no read ports and the register file has
92  /// at least one register which is not a predicate reg (read by GCU).
93 
94  return checksOk;
95 }

References MachineCheckResults::addError(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Port::isInput(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), and TTAMachine::Machine::registerFileNavigator().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
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::Machine::Navigator::count
int count() const
TTAMachine::RFPort
Definition: RFPort.hh:45
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
TTAMachine::Port::isInput
virtual bool isInput() const
Definition: Port.cc:298
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
TTAMachine::Machine::Navigator
Definition: Machine.hh:186