OpenASIP 2.2
Loading...
Searching...
No Matches
PlatformIntegrator.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 PlatformIntegerator.hh
26 *
27 * Declaration of PlatformIntegrator class.
28 *
29 * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_PLATFORM_INTEGRATOR_HH
34#define TTA_PLATFORM_INTEGRATOR_HH
35
36#include <iostream>
37#include <string>
38#include <vector>
39#include <map>
40#include "MemoryGenerator.hh"
41#include "ProGeTypes.hh"
42
43namespace ProGe {
44 class Netlist;
45 class NetlistBlock;
46 class NetlistPort;
47}
48
49namespace TTAMachine {
50 class Machine;
51 class FunctionUnit;
52 class AddressSpace;
53}
54
55namespace IDF {
56 class MachineImplementation;
57}
58
59namespace HDB {
60 class FUEntry;
61}
62
64
66public:
67
69
73 ProGe::HDL hdl,
74 TCEString progeOutputDir,
76 TCEString outputDir,
78 int targetClockFreq,
79 std::ostream& warningStream,
80 std::ostream& errorStream,
81 const MemInfo& imem,
82 MemType dmemType);
83
84 virtual ~PlatformIntegrator();
85
86 /**
87 * Integrates the TTA core(s) generated by ProGe
88 *
89 * @param progeBlock The toplevel netlist block created by ProGe
90 */
91 virtual void integrateProcessor(
93
94 /**
95 * Returns the FPGA device family
96 */
97 virtual TCEString deviceFamily() const = 0;
98
99 /**
100 * Set the FPGA device family.
101 *
102 * Intended for TTA IP integration. Integrator can device whether this
103 * overrides the default device family.
104 */
105 virtual void setDeviceFamily(TCEString devFamily) = 0;
106
107 /**
108 * Set or get the FPGA device name.
109 *
110 * This is used for synthesis scripts by AlmaIFIntegrator
111 * and QuartusProjectGenerator.
112 */
113 void setDeviceName(TCEString devName) { deviceName_ = devName; }
114 TCEString deviceName() const { return deviceName_; }
115
116
117 /**
118 * Returns the device package name
119 */
120 virtual TCEString devicePackage() const = 0;
121
122 /**
123 * Returns the device speed class
124 */
125 virtual TCEString deviceSpeedClass() const = 0;
126
127
128 /**
129 * Returns the target clock frequency in MHz
130 */
131 virtual int targetClockFrequency() const;
132
133 /**
134 * Prints information about the platform
135 */
136 virtual void printInfo(std::ostream& stream) const = 0;
137
138
139 /**
140 * Returns the netlist block created by ProGe which contains the tta cores
141 */
142 const ProGe::NetlistBlock& progeBlock() const;
143
144 /**
145 * Returns the platform integration toplevel netlist block
146 */
147 const ProGe::NetlistBlock& toplevelBlock() const;
148
149 /**
150 * Set proge share output directory if it differs from ProGe output dir
151 */
152 void setSharedOutputDir(const TCEString& sharedDir);
153
154 /**
155 * Returns the platform integrator output path string. Might not exist.
156 *
157 * @return Platform Integrator output path
158 */
159 TCEString outputPath() const;
160
161 /**
162 * Returns string to the platform integrator output path of the fileName
163 *
164 * @param filename Name of file
165 * @param absolute Return absolute path
166 * @return Path to file
167 */
168 TCEString outputFilePath(TCEString fileName, bool absolute = false)
169 const;
170
171 /**
172 * Return TTA core entity name
173 */
175
176 const TTAMachine::Machine* machine() const;
177
178 const IDF::MachineImplementation* idf() const;
179
180 const MemInfo& imemInfo() const;
181
182 const MemInfo& dmemInfo(TTAMachine::AddressSpace* as) const;
183
184 const MemInfo& dmemInfo(int index) const;
185
186 int dmemCount() const;
187
189
191
192protected:
193
195
196 /**
197 * Initializes the platform integrator netlist
198 *
199 * Copies a TTA core to a new netlist, adds clock and reset ports to
200 * the new netlist.
201 *
202 * @param progeBlock The toplevel netlist block created by ProGe
203 */
205
206 /**
207 * Integrates a single TTA core
208 *
209 *
210 * @param cores NetlistBlock containing the core(s)
211 * @param coreId Index of the core to be integrated
212 */
213 virtual bool integrateCore(const ProGe::NetlistBlock& cores, int coreId);
214
215 virtual void exportUnconnectedPorts(int coreId);
216
217 virtual void connectToplevelPort(const ProGe::NetlistPort& corePort,
218 const TCEString signalPrefix = "");
219
220 virtual TCEString pinTag() const = 0;
221
222 virtual bool chopTaggedSignals() const = 0;
223
224 virtual bool hasPinTag(const TCEString& signal) const;
225
226 /**
227 * Copies the ProGe generated toplevel block (i.e. tta core(s)) to a
228 * new netlist.
229 *
230 * @param progeBlock The toplevel netlist block created by ProGe
231 */
233
234 virtual bool createMemories(int coreId);
235
236 virtual bool generateMemory(
237 MemoryGenerator& memGen,
238 std::vector<TCEString>& generatedFiles,
239 int memIndex,
240 int coreId);
241
242 virtual MemoryGenerator& imemInstance(MemInfo imem, int coreId) = 0;
243
245 MemInfo dmem,
247 std::vector<std::string> lsuPorts) = 0;
248
249 virtual void writeNewToplevel();
250
252
253 void addProGeFiles() const;
254
255 /**
256 * Returns the scheduled program name without .tpef ending
257 */
258 TCEString programName() const;
259
260 /**
261 * Returns string to the proge-output path of the fileName
262 *
263 * @param filename Name of file
264 * @param absolute Return absolute path
265 * @return Path to file
266 */
268 progeFilePath(TCEString fileName, bool absolute = false) const;
269
270 /**
271 * Returns string to the tb-output path of the fileName
272 *
273 * @param filename Name of file
274 * @param absolute Return absolute path
275 * @return Path to file
276 */
277 TCEString tbFilePath(TCEString fileName, bool absolute = false) const;
278
279 /**
280 * Utility function for processing vhdl signals.
281 *
282 * Signal name format is fu_name_<TAG>_name : <dir> <type> {);}
283 * This function chops the signal name in such way that the name starts
284 * from <TAG> i.e. returns <TAG>_name : <dir> <type> {);}
285 *
286 * @param original Original signal name
287 * @param tag Starting tag
288 * @return Chopped string
289 */
291 const TCEString& original, const TCEString& tag) const;
292
293 /**
294 * Appends all the vhdl files from ProGe output directory's vhdl and
295 * gcu_ic subdirectories to the given vector.
296 *
297 * @param files Vector where the filenames are appended to.
298 */
299 void progeOutputHdlFiles(std::vector<TCEString>& files) const;
300
301 std::ostream& warningStream() const;
302
303 std::ostream& errorStream() const;
304
306
307 void parseDataMemories();
308 void clearDataMemories();
309
311
314
315private:
316
317 void createOutputDir();
318
319 std::vector<std::string> loadFUExternalPorts(
320 TTAMachine::FunctionUnit& fu) const;
321
323
325
327
329
337
338 std::ostream& warningStream_;
339 std::ostream& errorStream_;
340
342
345 std::map<TTAMachine::AddressSpace*, MemInfo> dmem_;
346
347 std::vector<TTAMachine::FunctionUnit*> lsus_;
348
351
352 std::multimap<TCEString, const ProGe::NetlistPort*>* unconnectedPorts_;
353};
354#endif
ProGe::NetlistPort * resetPort() const
TCEString deviceName() const
virtual void initPlatformNetlist(const ProGe::NetlistBlock *progeBlock)
virtual MemoryGenerator & imemInstance(MemInfo imem, int coreId)=0
const ProGe::NetlistBlock & toplevelBlock() const
virtual void integrateProcessor(const ProGe::NetlistBlock *progeBlock)=0
const MemInfo & dmemInfo(TTAMachine::AddressSpace *as) const
ProGe::NetlistPort * clockPort() const
virtual void exportUnconnectedPorts(int coreId)
TCEString platformEntityName() const
ProGe::NetlistBlock * integratorBlock_
virtual bool chopTaggedSignals() const =0
const TTAMachine::Machine * machine() const
TCEString chopSignalToTag(const TCEString &original, const TCEString &tag) const
virtual void setDeviceFamily(TCEString devFamily)=0
static const TCEString TTA_CORE_CLK
std::ostream & warningStream_
std::ostream & warningStream() const
virtual void connectToplevelPort(const ProGe::NetlistPort &corePort, const TCEString signalPrefix="")
ProGe::NetlistBlock * ttaCores_
const IDF::MachineImplementation * idf() const
std::ostream & errorStream_
virtual int targetClockFrequency() const
TCEString tbFilePath(TCEString fileName, bool absolute=false) const
virtual TCEString deviceSpeedClass() const =0
const IDF::MachineImplementation * idf_
ProGe::NetlistPort * clkPort_
MemInfo readLsuParameters(const TTAMachine::FunctionUnit &lsu)
static const TCEString TTA_CORE_RSTX
TCEString programName() const
virtual void printInfo(std::ostream &stream) const =0
const MemInfo & imemInfo() const
void setSharedOutputDir(const TCEString &sharedDir)
std::ostream & errorStream() const
ProGe::NetlistBlock * integratorBlock()
virtual bool integrateCore(const ProGe::NetlistBlock &cores, int coreId)
std::multimap< TCEString, const ProGe::NetlistPort * > * unconnectedPorts_
void copyProgeBlockToNetlist(const ProGe::NetlistBlock *progeBlock)
const TTAMachine::Machine * machine_
const ProGe::NetlistBlock & progeBlock() const
virtual TCEString pinTag() const =0
virtual bool createMemories(int coreId)
TCEString progeFilePath(TCEString fileName, bool absolute=false) const
void setDeviceName(TCEString devName)
virtual MemoryGenerator & dmemInstance(MemInfo dmem, TTAMachine::FunctionUnit &lsuArch, std::vector< std::string > lsuPorts)=0
TCEString outputPath() const
virtual void writeNewToplevel()
TCEString outputFilePath(TCEString fileName, bool absolute=false) const
virtual ProjectFileGenerator * projectFileGenerator() const =0
virtual TCEString devicePackage() const =0
std::vector< std::string > loadFUExternalPorts(TTAMachine::FunctionUnit &fu) const
ProGe::NetlistPort * resetPort_
TCEString coreEntityName() const
std::vector< TTAMachine::FunctionUnit * > lsus_
virtual bool hasPinTag(const TCEString &signal) const
void progeOutputHdlFiles(std::vector< TCEString > &files) const
virtual bool generateMemory(MemoryGenerator &memGen, std::vector< TCEString > &generatedFiles, int memIndex, int coreId)
virtual TCEString deviceFamily() const =0
std::map< TTAMachine::AddressSpace *, MemInfo > dmem_
Definition FUGen.hh:54
HDL
HDLs supported by ProGe.
Definition ProGeTypes.hh:40