OpenASIP  2.0
Namespaces | Functions
TTAUnitTester.hh File Reference
#include <string>
#include "ImplementationTester.hh"
Include dependency graph for TTAUnitTester.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 TTAMachine
 
 IDF
 

Functions

TTAMachine::MachinereadAdf (std::string adfName)
 
IDF::MachineImplementationreadIdf (std::string idfName)
 
bool validateIdf (const IDF::MachineImplementation &idf, const TTAMachine::Machine &machine)
 
bool testUnits (const IDF::MachineImplementation &idf, VhdlSim simulator, bool verbose, bool leaveDirty)
 

Detailed Description

Declaration of TTAUnitTester utility program

Author
Otto Esko 2010 (otto.esko-no.spam-tut.fi)
Note
rating: red

Definition in file TTAUnitTester.hh.

Function Documentation

◆ readAdf()

TTAMachine::Machine* readAdf ( std::string  adfName)

Definition at line 116 of file TTAUnitTester.cc.

116  {
117 
118  ADFSerializer reader;
119  reader.setSourceFile(adfName);
120  TTAMachine::Machine* mach = NULL;
121  try {
122  mach = reader.readMachine();
123  } catch (Exception& e) {
124  std::cerr << "Failed to load ADF file " << adfName << ": "
125  << e.errorMessage() << std::endl;
126  return NULL;
127  }
128  return mach;
129 }

References Exception::errorMessage(), ADFSerializer::readMachine(), and XMLSerializer::setSourceFile().

Referenced by main().

Here is the call graph for this function:

◆ readIdf()

IDF::MachineImplementation* readIdf ( std::string  idfName)

Definition at line 133 of file TTAUnitTester.cc.

133  {
134 
135  IDF::IDFSerializer reader;
136  reader.setSourceFile(idfName);
138  try {
140  } catch (Exception& e) {
141  std::cerr << "Failed to load IDF file " << idfName << ": "
142  << e.errorMessage() << std::endl;
143  return NULL;
144  }
145  return implementation;
146 }

References Exception::errorMessage(), implementation, IDF::IDFSerializer::readMachineImplementation(), and XMLSerializer::setSourceFile().

Referenced by main().

Here is the call graph for this function:

◆ testUnits()

bool testUnits ( const IDF::MachineImplementation idf,
VhdlSim  simulator,
bool  verbose,
bool  leaveDirty 
)

Definition at line 167 of file TTAUnitTester.cc.

169  {
170 
171  HDBTester tester(std::cout, std::cerr, simulator, verbose, leaveDirty);
172 
173  bool allPassed = true;
174  for (int i = 0; i < idf.fuImplementationCount(); i++) {
176  string hdb = unit->hdbFile();
177  int entryId = unit->id();
178  if (!tester.testOneFU(hdb, entryId)) {
179  allPassed = false;
180  }
181  }
182 
183  for (int i = 0; i < idf.rfImplementationCount(); i++) {
185  string hdb = unit->hdbFile();
186  int entryId = unit->id();
187  if (!tester.testOneRF(hdb, entryId)) {
188  allPassed = false;
189  }
190  }
191 
192  return allPassed;
193 }

References IDF::MachineImplementation::fuImplementation(), IDF::MachineImplementation::fuImplementationCount(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), IDF::MachineImplementation::rfImplementation(), IDF::MachineImplementation::rfImplementationCount(), HDBTester::testOneFU(), and HDBTester::testOneRF().

Referenced by main().

Here is the call graph for this function:

◆ validateIdf()

bool validateIdf ( const IDF::MachineImplementation idf,
const TTAMachine::Machine machine 
)

Definition at line 150 of file TTAUnitTester.cc.

152  {
153 
154  IDFValidator validator(idf, machine);
155 
156  bool success = validator.validate();
157  if (!success) {
158  for (int i = 0; i < validator.errorCount(); i++) {
159  std::cerr << validator.errorMessage(i) << std::endl;
160  }
161  }
162  return success;
163 }

References IDFValidator::errorCount(), IDFValidator::errorMessage(), machine, and IDFValidator::validate().

Referenced by main().

Here is the call graph for this function:
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
implementation
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:61
IDF::IDFSerializer::readMachineImplementation
MachineImplementation * readMachineImplementation()
Definition: IDFSerializer.cc:148
IDF::MachineImplementation::rfImplementation
RFImplementationLocation & rfImplementation(const std::string &rf) const
Definition: MachineImplementation.cc:377
ADFSerializer
Definition: ADFSerializer.hh:49
IDFValidator
Definition: IDFValidator.hh:52
IDF::MachineImplementation::rfImplementationCount
int rfImplementationCount() const
Definition: MachineImplementation.cc:310
Exception
Definition: Exception.hh:54
HDBTester
Definition: HDBTester.hh:39
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
IDF::MachineImplementation::fuImplementationCount
int fuImplementationCount() const
Definition: MachineImplementation.cc:299
IDF::UnitImplementationLocation::id
virtual int id() const
Definition: UnitImplementationLocation.cc:127
ADFSerializer::readMachine
TTAMachine::Machine * readMachine()
Definition: ADFSerializer.cc:275
IDF::UnitImplementationLocation::hdbFile
virtual std::string hdbFile() const
Definition: UnitImplementationLocation.cc:99
IDF::MachineImplementation::fuImplementation
FUImplementationLocation & fuImplementation(const std::string &fu) const
Definition: MachineImplementation.cc:355
IDF::IDFSerializer
Definition: IDFSerializer.hh:45
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
TTAMachine::Machine
Definition: Machine.hh:73