OpenASIP  2.0
ImplementationTester.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ImplementationTester.hh
26  *
27  * Declaration of ImplementationTester
28  *
29  * @author Pekka Jääskeläinen 2006 (pekka.jaaskelainen-no.spam-tut.fi)
30  * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef TTA_IMPLEMENTATION_TESTER_HH
35 #define TTA_IMPLEMENTATION_TESTER_HH
36 
37 #include <string>
38 #include <vector>
39 #include <set>
40 #include "HDBManager.hh"
41 #include "FUEntry.hh"
42 #include "RFEntry.hh"
43 #include "MachineState.hh"
44 #include "HWBlockImplementation.hh"
45 #include "TestbenchGenerator.hh"
46 
47 enum VhdlSim {
50 };
51 
53 public:
55 
56  ImplementationTester(std::string hdbFile, VhdlSim simulator);
57 
59  std::string hdbFile,
60  VhdlSim simulator, bool verbose, bool leaveDirty);
61 
62  virtual ~ImplementationTester();
63 
64  void setVhdlSimulator(VhdlSim simulator);
65 
66  void openHdb(std::string hdbFile);
67 
68  bool canTestFU(const int entryID, std::string& reason);
69 
70  bool canTestRF(const int entryID, std::string& reason);
71 
72  bool validateFU(const int entryID, std::vector<std::string>& errors);
73 
74  bool validateRF(const int entryID, std::vector<std::string>& errors);
75 
76  std::set<int> fuEntryIDs() const;
77 
78  std::set<int> rfEntryIDs() const;
79 
80 private:
81 
82  bool fuHasMemoryAccess(HDB::FUEntry* fuEntry) const;
83 
84  bool fuFullyPipelined(HDB::FUEntry* fuEntry) const;
85 
86  bool fuHasExternalPorts(HDB::FUEntry* fuEntry) const;
87 
88  bool fuHasOnePort(HDB::FUEntry* fuEntry) const;
89 
90  HDB::FUEntry* fuEntryFromHdb(int entryID) const;
91 
92  HDB::RFEntry* rfEntryFromHdb(int entryID) const;
93 
94  bool createTempDir();
95 
96  std::string fuTbName(int id) const;
97 
98  std::string rfTbName(int id) const;
99 
100  void openTbFile(std::ofstream& fileStream, std::string fileName) const;
101 
102  void
104  const HDB::HWBlockImplementation* impl,
105  std::vector<std::string>& files) const;
106 
107  void
108  createTestbench(TestbenchGenerator* tbGen, std::string tbName) const;
109 
110  bool
112  std::string testbench,
114  std::vector<std::string>& errors) const;
115 
116  std::string hdbFile_;
118 
120  bool verbose_;
122 
123  std::string tempDir_;
124 
125 };
126 
127 #endif
HDB::FUEntry
Definition: FUEntry.hh:49
ImplementationTester::canTestRF
bool canTestRF(const int entryID, std::string &reason)
Definition: ImplementationTester.cc:219
ImplementationTester::openHdb
void openHdb(std::string hdbFile)
Definition: ImplementationTester.cc:154
ImplementationTester::ImplementationTester
ImplementationTester()
Definition: ImplementationTester.cc:74
implementation
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:61
ImplementationTester::simulator_
VhdlSim simulator_
Definition: ImplementationTester.hh:119
ImplementationTester::fuFullyPipelined
bool fuFullyPipelined(HDB::FUEntry *fuEntry) const
Definition: ImplementationTester.cc:403
ImplementationTester::tempDir_
std::string tempDir_
Definition: ImplementationTester.hh:123
ImplementationTester::fuTbName
std::string fuTbName(int id) const
Definition: ImplementationTester.cc:467
HDB::RFEntry
Definition: RFEntry.hh:47
ImplementationTester::createTestbench
void createTestbench(TestbenchGenerator *tbGen, std::string tbName) const
Definition: ImplementationTester.cc:566
ImplementationTester
Definition: ImplementationTester.hh:52
ImplementationTester::setVhdlSimulator
void setVhdlSimulator(VhdlSim simulator)
Definition: ImplementationTester.cc:143
ImplementationTester::canTestFU
bool canTestFU(const int entryID, std::string &reason)
Definition: ImplementationTester.cc:175
ImplementationTester::~ImplementationTester
virtual ~ImplementationTester()
Definition: ImplementationTester.cc:120
ImplementationTester::simulateTestbench
bool simulateTestbench(std::string testbench, const HDB::HWBlockImplementation *implementation, std::vector< std::string > &errors) const
Definition: ImplementationTester.cc:536
ImplementationTester::fuHasMemoryAccess
bool fuHasMemoryAccess(HDB::FUEntry *fuEntry) const
Definition: ImplementationTester.cc:395
ImplementationTester::hdbFile_
std::string hdbFile_
Definition: ImplementationTester.hh:116
SIM_GHDL
@ SIM_GHDL
Definition: ImplementationTester.hh:48
FUEntry.hh
HDB::HDBManager
Definition: HDBManager.hh:82
TestbenchGenerator.hh
VhdlSim
VhdlSim
Definition: ImplementationTester.hh:47
ImplementationTester::leaveDirty_
bool leaveDirty_
Definition: ImplementationTester.hh:121
ImplementationTester::createTempDir
bool createTempDir()
Definition: ImplementationTester.cc:453
HDB::HWBlockImplementation
Definition: HWBlockImplementation.hh:49
ImplementationTester::fuHasExternalPorts
bool fuHasExternalPorts(HDB::FUEntry *fuEntry) const
Definition: ImplementationTester.cc:411
ImplementationTester::fuEntryFromHdb
HDB::FUEntry * fuEntryFromHdb(int entryID) const
Definition: ImplementationTester.cc:427
ImplementationTester::hdb_
HDB::HDBManager * hdb_
Definition: ImplementationTester.hh:117
TestbenchGenerator
Definition: TestbenchGenerator.hh:47
ImplementationTester::rfEntryIDs
std::set< int > rfEntryIDs() const
Definition: ImplementationTester.cc:382
ImplementationTester::fuEntryIDs
std::set< int > fuEntryIDs() const
Definition: ImplementationTester.cc:369
ImplementationTester::fuHasOnePort
bool fuHasOnePort(HDB::FUEntry *fuEntry) const
Definition: ImplementationTester.cc:419
MachineState.hh
RFEntry.hh
ImplementationTester::createListOfSimulationFiles
void createListOfSimulationFiles(const HDB::HWBlockImplementation *impl, std::vector< std::string > &files) const
Definition: ImplementationTester.cc:510
SIM_MODELSIM
@ SIM_MODELSIM
Definition: ImplementationTester.hh:49
HDBManager.hh
ImplementationTester::rfTbName
std::string rfTbName(int id) const
Definition: ImplementationTester.cc:482
ImplementationTester::validateFU
bool validateFU(const int entryID, std::vector< std::string > &errors)
Definition: ImplementationTester.cc:263
ImplementationTester::verbose_
bool verbose_
Definition: ImplementationTester.hh:120
ImplementationTester::openTbFile
void openTbFile(std::ofstream &fileStream, std::string fileName) const
Definition: ImplementationTester.cc:492
HWBlockImplementation.hh
ImplementationTester::validateRF
bool validateRF(const int entryID, std::vector< std::string > &errors)
Definition: ImplementationTester.cc:321
ImplementationTester::rfEntryFromHdb
HDB::RFEntry * rfEntryFromHdb(int entryID) const
Definition: ImplementationTester.cc:440