OpenASIP 2.2
Loading...
Searching...
No Matches
ProGeScriptGenerator.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 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 ProGeScriptGenerator.hh
26 *
27 * Declaration of ProGeScriptGenerator class.
28 *
29 * @author Esa Määttä 2007 (esa.maatta-no.spam-tut.fi)
30 * @author Vinogradov Viacheslav(added Verilog generating) 2012
31 * @note rating: red
32 */
33
34#ifndef TTA_PROGE_SCRIPT_GENERATOR_HH
35#define TTA_PROGE_SCRIPT_GENERATOR_HH
36
37#include <list>
38#include "Exception.hh"
39#include "ProGeTypes.hh"
40
41namespace IDF {
42 class MachineImplementation;
43}
44
45/**
46 * Class for script generating objects.
47 *
48 * Base class for script generating.
49 * simulationRuntime defaults to 52390ns, can be changed in generateprocessor
50 * with a command line parameter, but not in ProDe yet. TODO.
51 */
53public:
55 const ProGe::HDL language,
57 const std::string& dstDir,
58 const std::string& progeOutDir,
59 const std::string& sharedOutDir,
60 const std::string& testBenchDir,
61 const std::string& toplevelEntity,
62 const std::string& simulationRuntime = "52390");
63
64 virtual ~ProGeScriptGenerator();
65
66 void generateAll();
67
69
71 std::string scriptName, std::string tbName,
72 std::vector<std::list<std::string>> filesToCompile,
73 bool clearWorkingDir);
74
76
78
80
83
85
86private:
87 void generateCompileStart(std::ostream& stream);
88 void generateSimulationStart(std::ostream& stream);
89 void createExecutableFile(const std::string& fileName);
91 std::ostream& stream,
92 const std::list<std::string>& files,
93 const std::string& cmdPrefix,
94 const std::string& cmdPostfix);
96 std::ostream& stream,
97 const std::string& file,
98 const std::string& cmdPrefix,
99 const std::string& cmdPostfix);
100 template<typename T>
102 const std::string& perlre,
103 T files,
104 std::list<std::string>& found);
105 template<typename T>
106 void findFiles(const std::string& perlre, T& files);
107 void findText(
108 const std::string& perlre,
109 const unsigned int& matchRegion,
110 const std::string& fileName,
111 std::list<std::string>& found);
112 void getBlockOrder(
113 std::list<std::string>& order);
114 void sortFilesFirst(
115 std::list<std::string>& toSort,
116 std::list<std::string>& acSort);
117 void sortFilesLast(
118 std::list<std::string>& toSort,
119 std::list<std::string>& acSort);
120 template <typename CONT>
122 CONT& files,
123 const std::string& rootDirectory);
124 void prefixStrings(
125 std::list<std::string>& tlist,
126 const std::string& prefix,
127 int start = 0,
128 int end = -1);
129 void fetchFiles();
130 void packageFilesFirst();
131 void prepareFiles();
132
133 // destination directory where scripts are generated.
134 std::string dstDir_;
135 // directory where processor generators output vhdl files are
136 std::string progeOutDir_;
137 // directory where processor generators shared HDL files are
138 std::string sharedOutDir_;
139 // directories where to read test bench vhdl files.
140 std::string testBenchDir_;
141
142 // lists for file names
143 std::list<std::string> vhdlFiles_;
144 std::list<std::string> gcuicFiles_;
145 std::list<std::string> testBenchFiles_;
146 std::list<std::string> platformFiles_;
147
148 // directory used by ghdl/modelsim as work directory when compiling
149 const std::string workDir_;
150 const std::string vhdlDir_;
151 const std::string verDir_;
152 const std::string gcuicDir_;
153 const std::string tbDir_;
154 const std::string platformDir_;
155
156 // file names for scripts to be generated
157 const std::string modsimCompileScriptName_;
158 const std::string ghdlCompileScriptName_;
159 const std::string iverilogCompileScriptName_;
160 const std::string modsimSimulateScriptName_;
161 const std::string ghdlSimulateScriptName_;
164
165 // test bench name
166 const std::string testbenchName_;
167 const std::string platformTestbenchName_;
168 const std::string toplevelEntity_;
171
172 // HDL simulation runtime in nanoseconds
173 const std::string simulationRuntime_;
174};
175
177
178#endif
179
void findFiles(const std::string &perlre, T files, std::list< std::string > &found)
std::list< std::string > gcuicFiles_
void sortFilesFirst(std::list< std::string > &toSort, std::list< std::string > &acSort)
void sortFilesLast(std::list< std::string > &toSort, std::list< std::string > &acSort)
std::list< std::string > testBenchFiles_
const std::string modsimSimulateScriptName_
void createExecutableFile(const std::string &fileName)
void outputScriptCommands(std::ostream &stream, const std::list< std::string > &files, const std::string &cmdPrefix, const std::string &cmdPostfix)
const IDF::MachineImplementation & idf_
const std::string ghdlPlatformCompileScriptName_
void getBlockOrder(std::list< std::string > &order)
void generateCompileStart(std::ostream &stream)
const std::string iverilogSimulateScriptName_
void findText(const std::string &perlre, const unsigned int &matchRegion, const std::string &fileName, std::list< std::string > &found)
const std::string toplevelEntity_
void generatePlatformGhdlSimulate()
void generateGhdlCompile(std::string scriptName, std::string tbName, std::vector< std::list< std::string > > filesToCompile, bool clearWorkingDir)
void outputScriptCommand(std::ostream &stream, const std::string &file, const std::string &cmdPrefix, const std::string &cmdPostfix)
std::list< std::string > vhdlFiles_
void generateSimulationStart(std::ostream &stream)
const std::string ghdlCompileScriptName_
const std::string modsimCompileScriptName_
const std::string simulationRuntime_
const std::string platformDir_
void findFiles(const std::string &perlre, T &files)
const std::string ghdlSimulateScriptName_
void prefixStrings(std::list< std::string > &tlist, const std::string &prefix, int start=0, int end=-1)
std::list< std::string > platformFiles_
void generatePlatformGhdlCompile()
const std::string testbenchName_
void uniqueFileNames(CONT &files, const std::string &rootDirectory)
const std::string iverilogCompileScriptName_
const std::string platformTestbenchName_
HDL
HDLs supported by ProGe.
Definition ProGeTypes.hh:40