OpenASIP
2.0
|
#include <IDFValidator.hh>
Public Member Functions | |
IDFValidator (const IDF::MachineImplementation &idf, const TTAMachine::Machine &machine) | |
virtual | ~IDFValidator () |
bool | validate () |
int | errorCount () const |
std::string | errorMessage (int index) const |
Static Public Member Functions | |
static void | removeUnknownImplementations (IDF::MachineImplementation &idf, const TTAMachine::Machine &machine) |
Private Types | |
typedef std::vector< std::string > | StringVector |
Vector type for string. More... | |
Private Member Functions | |
void | checkFUImplementations () |
void | checkRFImplementations () |
void | checkIUImplementations () |
Private Attributes | |
const TTAMachine::Machine & | machine_ |
The machine. More... | |
const IDF::MachineImplementation & | idf_ |
The implementation definition,. More... | |
StringVector | errorMessages_ |
Vector of error messages. More... | |
Validates IDF files.
Definition at line 52 of file IDFValidator.hh.
|
private |
Vector type for string.
Definition at line 69 of file IDFValidator.hh.
IDFValidator::IDFValidator | ( | const IDF::MachineImplementation & | idf, |
const TTAMachine::Machine & | machine | ||
) |
The constructor.
Definition at line 45 of file IDFValidator.cc.
|
virtual |
|
private |
Checks that the IDF defines an implementation for each FU in the machine.
If errors are found, error messages are inserted to the vector of error messages.
Definition at line 109 of file IDFValidator.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), errorMessages_, IDF::MachineImplementation::fuImplementation(), IDF::MachineImplementation::fuImplementationCount(), TTAMachine::Machine::functionUnitNavigator(), IDF::MachineImplementation::hasFUGeneration(), IDF::MachineImplementation::hasFUImplementation(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), idf_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), and IDF::UnitImplementationLocation::unitName().
Referenced by validate().
|
private |
Checks that the IDF defines an implementation for each IU in the machine.
If errors are found, error messages are inserted to the vector of error messages.
Definition at line 185 of file IDFValidator.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), errorMessages_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), IDF::MachineImplementation::hasIUImplementation(), idf_, TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), IDF::MachineImplementation::iuImplementation(), IDF::MachineImplementation::iuImplementationCount(), machine_, TTAMachine::Component::name(), and IDF::UnitImplementationLocation::unitName().
Referenced by validate().
|
private |
Checks that the IDF defines an implementation for each RF in the machine.
If errors are found, error messages are inserted to the vector of error messages.
Definition at line 148 of file IDFValidator.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), errorMessages_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), IDF::MachineImplementation::hasRFImplementation(), idf_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), TTAMachine::Machine::registerFileNavigator(), IDF::MachineImplementation::rfImplementation(), IDF::MachineImplementation::rfImplementationCount(), and IDF::UnitImplementationLocation::unitName().
Referenced by validate().
int IDFValidator::errorCount | ( | ) | const |
Returns the number of errors found in the last validation.
Definition at line 81 of file IDFValidator.cc.
References errorMessages_.
Referenced by errorMessage(), ProcessorImplementationWindow::onGenerateProcessor(), ProcessorImplementationWindow::onLoadIDF(), validate(), and validateIdf().
std::string IDFValidator::errorMessage | ( | int | index | ) | const |
Returns an error message by the given index.
index | The index. |
OutOfRange | If the index is negative or not smaller than the number of errors. |
Definition at line 94 of file IDFValidator.cc.
References __func__, errorCount(), and errorMessages_.
Referenced by ProGe::ProGeUI::generateProcessor(), ProcessorImplementationWindow::onGenerateProcessor(), ProcessorImplementationWindow::onLoadIDF(), and validateIdf().
|
static |
Static helper function for removing implementations to units that don't exist in the machine.
idf | IDF to remove extraneous implementations from. |
machine | Machine to check the IDF against. |
Definition at line 223 of file IDFValidator.cc.
References IDF::MachineImplementation::fuImplementation(), IDF::MachineImplementation::fuImplementationCount(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::immediateUnitNavigator(), IDF::MachineImplementation::iuImplementation(), IDF::MachineImplementation::iuImplementationCount(), machine, TTAMachine::Machine::registerFileNavigator(), IDF::MachineImplementation::removeFUImplementation(), IDF::MachineImplementation::removeIUImplementation(), IDF::MachineImplementation::removeRFImplementation(), IDF::MachineImplementation::rfImplementation(), IDF::MachineImplementation::rfImplementationCount(), and IDF::UnitImplementationLocation::unitName().
Referenced by ProcessorImplementationWindow::onLoadIDF().
bool IDFValidator::validate | ( | ) |
Validates the IDF by checking that the IDF has an implementation defined for all the units of the machine.
Definition at line 66 of file IDFValidator.cc.
References checkFUImplementations(), checkIUImplementations(), checkRFImplementations(), errorCount(), and errorMessages_.
Referenced by ProGe::ProGeUI::generateProcessor(), ProcessorImplementationWindow::onGenerateProcessor(), ProcessorImplementationWindow::onLoadIDF(), and validateIdf().
|
private |
Vector of error messages.
Definition at line 80 of file IDFValidator.hh.
Referenced by checkFUImplementations(), checkIUImplementations(), checkRFImplementations(), errorCount(), errorMessage(), and validate().
|
private |
The implementation definition,.
Definition at line 78 of file IDFValidator.hh.
Referenced by checkFUImplementations(), checkIUImplementations(), and checkRFImplementations().
|
private |
The machine.
Definition at line 76 of file IDFValidator.hh.
Referenced by checkFUImplementations(), checkIUImplementations(), and checkRFImplementations().