TVGenerator  0.1
All Classes Files Functions Pages
TVGenerator.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * A test vector file generator for hardware designs.
4  * Copyright (C) 2014 ETHZ Zurich, Integrated Systems Laboratory
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  *****************************************************************************/
20 
36 #ifndef TVGENERATOR_H_
37 #define TVGENERATOR_H_
38 
39 #include <string>
40 #include <fstream>
41 #include <vector>
42 
43 #include "SignalDeclaration.h"
44 #include "StdLogicVector.h"
45 #include "TVFileSettings.h"
46 
47 using namespace std;
48 
56 class TVGenerator {
57 
58 private:
59  // **************************************************************************
60  // Members
61  // **************************************************************************
62  bool isSingleFileBased_;
63  int testVectorCount_;
64  int stimuliCount_;
65  int expRspCount_;
66  ofstream tvFile_;
67  ofstream stimFile_;
68  ofstream expRspFile_;
69  TVFileSettings tvFileSettings_;
70  TVFileSettings stimFileSettings_;
71  TVFileSettings expRspFileSettings_;
72 
73  // **************************************************************************
74  // Utility functions
75  // **************************************************************************
76  void WriteTVFileHeader();
77  void WriteTVFileHeader(ofstream & _tvFile, TVFileSettings & _fileSettings);
78  void WriteTVFileHeaderEntry(ofstream & _tvFile, TVFileSettings & _fileSettings,
79  string _prefix, string _entry);
80  int WriteTVLine(ofstream & _tvFile, TVFileSettings & _fileSettings,
81  vector<StdLogicVector> _signalValues, string _comment, int & _tvCount);
82  void WriteArbitraryTVLine(ofstream & _tvFile, TVFileSettings & _tvFileSettings,
83  string _line, string _comment);
84  void WriteTVCommentLine(ofstream & _tvFile, TVFileSettings & _tvFileSettings,
85  string _comment);
86  void WriteSignalCaptions(ofstream & _tvFile, TVFileSettings & _tvFileSettings);
87  string GeneratePreSignalCaptionString(const TVFileSettings & _tvFileSettings,
88  const int _sigIndex);
89 
90 public:
91  // **************************************************************************
92  // Constructors/Destructors
93  // **************************************************************************
94  TVGenerator();
95  virtual ~TVGenerator();
96 
97  // **************************************************************************
98  // Getter/Setter
99  // **************************************************************************
100  int GetTVCount() const { return testVectorCount_; }
101  int GetStimuliCount() const { return stimuliCount_; }
102  int GetExpRspCount() const { return expRspCount_; }
103 
104  // **************************************************************************
105  // Public methods
106  // **************************************************************************
107  void Initialize(TVFileSettings _tvFileSettings);
108  void Initialize(TVFileSettings _stimFileSettings, TVFileSettings _expRespFileSettings);
109  void Finalize();
110 
111  int WriteTestVectorLine(vector<StdLogicVector> _signalValues,
112  string _comment);
113  int WriteStimuliLine(vector<StdLogicVector> & _stimuliValues, string _comment);
114  int WriteExpRspLine(vector<StdLogicVector> & _expRspValues, string _comment);
115 
116  void WriteArbitraryTVLine(string _line);
117  void WriteArbitraryTVLine(string _line, string _comment);
118  void WriteArbitraryStimuliLine(string _line);
119  void WriteArbitraryStimuliLine(string _line, string _comment);
120  void WriteArbitraryExpRspLine(string _line);
121  void WriteArbitraryExpRspLine(string _line, string _comment);
122 
123  void WriteTVCommentLine(string _comment);
124  void WriteStimuliCommentLine(string _comment);
125  void WriteExpRspCommentLine(string _comment);
126 };
127 
128 #endif /* TVGENERATOR_H_ */
A class for setting the properties of a test vector file.
Test vector file settings.
Definition: TVFileSettings.h:49
Test vector file generator for hardware designs.
Definition: TVGenerator.h:56
Contains a class for declaration of signals.