OpenASIP  2.0
Functions | Variables
TestHDB.cc File Reference
#include <cstdlib>
#include <iostream>
#include <string>
#include "HDBTester.hh"
#include "TestHDBCmdLineOptions.hh"
Include dependency graph for TestHDB.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Variables

const string GHDL_SIM = "ghdl"
 
const string VSIM_SIM = "modelsim"
 

Detailed Description

HDB tester utility program

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

Definition in file TestHDB.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 43 of file TestHDB.cc.

43  {
44 
46  try {
47  options.parse(argv, argc);
48  } catch (ParserStopRequest) {
49  return EXIT_SUCCESS;
50  } catch (const IllegalCommandLine& exception) {
51  std::cerr << exception.errorMessage() << std::endl;
52  return EXIT_FAILURE;
53  }
54  string hdbFile = "";
55  if (options.numberOfArguments() < 1) {
56  std::cerr << "HDB file was not given" << std::endl;
58  return EXIT_FAILURE;
59  } else if (options.numberOfArguments() > 1) {
60  std::cerr << "Illegal arguments" << std::endl;
62  return EXIT_FAILURE;
63  } else {
64  hdbFile = options.hdbFile();
65  }
66 
67  string simulator = options.vhdlSim();
68  VhdlSim sim = SIM_GHDL;
69  if (simulator == VSIM_SIM) {
70  sim = SIM_MODELSIM;
71  } else if (simulator == GHDL_SIM || simulator.empty()) {
72  sim = SIM_GHDL;
73  } else {
74  std::cerr << "Unknown HDL simulator" << simulator << std::endl;
76  return EXIT_FAILURE;
77  }
78 
79  bool verbose = options.verbose();
80  bool leaveDirty = options.leaveDirty();
81 
82  HDBTester tester(std::cout, std::cerr, sim, verbose, leaveDirty);
83 
84  bool testAll = true;
85  if (options.isFUEntryIDGiven()) {
86  testAll = false;
87  int entryID = options.fuEntryID();
88  if (!tester.testOneFU(hdbFile, entryID)) {
89  return EXIT_FAILURE;
90  }
91  }
92  if (options.isRFEntryIDGiven()) {
93  testAll = false;
94  int entryID = options.rfEntryID();
95  if (!tester.testOneRF(hdbFile, entryID)) {
96  return EXIT_FAILURE;
97  }
98  }
99  if (testAll) {
100  if (!tester.testAllEntries(hdbFile)) {
101  return EXIT_FAILURE;
102  }
103  }
104 
105  return EXIT_SUCCESS;
106 }

References Exception::errorMessage(), GHDL_SIM, CmdLineParser::numberOfArguments(), options, CmdLineOptions::parse(), MachInfoCmdLineOptions::printHelp(), SIM_GHDL, SIM_MODELSIM, HDBTester::testAllEntries(), HDBTester::testOneFU(), HDBTester::testOneRF(), and VSIM_SIM.

Here is the call graph for this function:

Variable Documentation

◆ GHDL_SIM

const string GHDL_SIM = "ghdl"

Definition at line 40 of file TestHDB.cc.

Referenced by main().

◆ VSIM_SIM

const string VSIM_SIM = "modelsim"

Definition at line 41 of file TestHDB.cc.

Referenced by main().

MachInfoCmdLineOptions::printHelp
virtual void printHelp() const
Definition: MachInfoCmdLineOptions.cc:89
ParserStopRequest
Definition: Exception.hh:491
CmdLineParser::numberOfArguments
virtual int numberOfArguments() const
GHDL_SIM
const string GHDL_SIM
Definition: TestHDB.cc:40
IllegalCommandLine
Definition: Exception.hh:438
SIM_GHDL
@ SIM_GHDL
Definition: ImplementationTester.hh:48
VhdlSim
VhdlSim
Definition: ImplementationTester.hh:47
HDBTester
Definition: HDBTester.hh:39
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
CmdLineOptions::parse
void parse(char *argv[], int argc)
Definition: CmdLineOptions.cc:107
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
TestHDBCmdLineOptions
Definition: TestHDBCmdLineOptions.hh:39
VSIM_SIM
const string VSIM_SIM
Definition: TestHDB.cc:41
SIM_MODELSIM
@ SIM_MODELSIM
Definition: ImplementationTester.hh:49