OpenASIP 2.2
Loading...
Searching...
No Matches
MemoryGenerator.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 MemoryGenerator.hh
26 *
27 * Declaration of MemoryGenerator class.
28 *
29 * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_MEMORY_GENERATOR_HH
34#define TTA_MEMORY_GENERATOR_HH
35
36#include <iostream>
37#include <vector>
38#include <map>
39#include "Netlist.hh"
40#include "Parameter.hh"
41#include "TCEString.hh"
42
43class HDLPort;
45
46namespace HDB {
47 class FUEntry;
48 class FUArchitecture;
49 class FUImplementation;
50 class FUExternalPort;
51}
52
53namespace TTAMachine {
54 class FunctionUnit;
55}
56
65
66// structure for memory information
67struct MemInfo {
71 int portAddrw; //< port address width = port width - bytemask bits
72 int asAddrw; //< address width from ADF address space
76};
77
78namespace ProGe {
79 class NetlistBlock;
80 class VirtualNetlistBlock;
81 class NetlistPort;
82 class Parameter;
83}
84
86public:
87
89 int memMauWidth,
90 int widthInMaus,
91 int addrWidth,
92 TCEString initFile,
93 const PlatformIntegrator* integrator,
94 std::ostream& warningStream,
95 std::ostream& errorStream);
96
97 virtual ~MemoryGenerator();
98
99 /**
100 * Tests that the memory generator is compatible with TTA core.
101 * If incompatible, reasons are appended to the reasons vector
102 *
103 * @param ttaCore TTA toplevel
104 * @param coreId The core ID number
105 * @param reasons Reasons why incompatible
106 * @return is memory generator compatible with the TTA core
107 */
108 virtual bool isCompatible(
109 const ProGe::NetlistBlock& ttaCore,
110 int coreId,
111 std::vector<TCEString>& reasons) const;
112
113 virtual void addMemory(
114 const ProGe::NetlistBlock& ttaCore,
115 ProGe::NetlistBlock& integratorBlock,
116 int memIndex,
117 int coreId);
118
119 virtual bool generatesComponentHdlFile() const = 0;
120
121 virtual std::vector<TCEString>
123
124 int memoryTotalWidth() const;
125
126 int memoryMauSize() const;
127
128 int memoryWidthInMaus() const;
129
130 int memoryAddrWidth() const;
131
133
134 /**
135 * For data memories
136 */
137 void addLsu(
139 std::vector<std::string> lsuPorts);
140
141 protected:
142
143 // Key: LSU port name
144 // Value: pointer to corresponding memory component/controller port
145 typedef std::multimap<TCEString, HDLPort*> PortMap;
146
147 typedef std::pair<ProGe::NetlistBlock*, ProGe::VirtualNetlistBlock*>
149
150 virtual bool checkFuPort(
151 const std::string fuPort,
152 std::vector<TCEString>& reasons) const;
153
154 virtual void connectPorts(
155 ProGe::NetlistBlock& netlistBlock,
156 const ProGe::NetlistPort& memPort,
157 const ProGe::NetlistPort& corePort,
158 bool inverted,
159 int coreId);
160
163 ProGe::NetlistBlock& integratorBlock,
164 int memIndex,
165 int coreId);
166
168
169 std::ostream& warningStream();
170
171 std::ostream& errorStream();
172
173 int portCount() const;
174
175 const HDLPort* port(int index) const;
176
177 const HDLPort* portByKeyName(TCEString name) const;
178
179 TCEString portKeyName(const HDLPort* port) const;
180
181 void addPort(const TCEString& name, HDLPort* port);
182
183 int parameterCount() const;
184
185 const ProGe::Parameter& parameter(int index) const;
186
187 void addParameter(const ProGe::Parameter& add);
188
189 TCEString ttaCoreName() const;
190
191 virtual TCEString moduleName() const = 0;
192
193 virtual TCEString instanceName(int coreId, int memIndex) const = 0;
194
195 TCEString memoryIndexString(int coreId, int memIndex) const;
196
197 /**
198 * Returns base path to template files.
199 */
200 TCEString templatePath() const;
201
203 const TCEString& inFile,
204 const TCEString& outFile,
205 const TCEString& entity) const;
206
207 bool hasLSUArchitecture() const;
208
210
211 TCEString corePortName(const TCEString& portBaseName, int coreId) const;
212
213private:
214
215 typedef std::vector<ProGe::Parameter> ParameterList;
216
220
222
224
225 std::ostream& warningStream_;
226 std::ostream& errorStream_;
227
230
232 std::vector<std::string> lsuPorts_;
233
234 static const TCEString CLOCK_PORT;
235 static const TCEString RESET_PORT;
236};
237
238#endif
@ VHDL_ARRAY
@ ONCHIP
@ UNKNOWN
@ SRAM
@ NONE
@ DRAM
TCEString memoryIndexString(int coreId, int memIndex) const
int memoryWidthInMaus() const
TCEString initializationFile() const
const HDLPort * portByKeyName(TCEString name) const
const TTAMachine::FunctionUnit & lsuArchitecture() const
TCEString portKeyName(const HDLPort *port) const
static const TCEString RESET_PORT
virtual std::vector< TCEString > generateComponentFile(TCEString outputPath)=0
TTAMachine::FunctionUnit * lsuArch_
static const TCEString CLOCK_PORT
ParameterList params_
const ProGe::Parameter & parameter(int index) const
std::ostream & warningStream()
void addLsu(TTAMachine::FunctionUnit &lsuArch, std::vector< std::string > lsuPorts)
virtual TCEString instanceName(int coreId, int memIndex) const =0
virtual TCEString moduleName() const =0
std::multimap< TCEString, HDLPort * > PortMap
const PlatformIntegrator * platformIntegrator() const
const HDLPort * port(int index) const
virtual bool generatesComponentHdlFile() const =0
virtual bool checkFuPort(const std::string fuPort, std::vector< TCEString > &reasons) const
void addParameter(const ProGe::Parameter &add)
std::pair< ProGe::NetlistBlock *, ProGe::VirtualNetlistBlock * > BlockPair
void addPort(const TCEString &name, HDLPort *port)
std::ostream & errorStream_
int memoryTotalWidth() const
virtual void addMemory(const ProGe::NetlistBlock &ttaCore, ProGe::NetlistBlock &integratorBlock, int memIndex, int coreId)
std::vector< std::string > lsuPorts_
bool hasLSUArchitecture() const
const PlatformIntegrator * integrator_
int parameterCount() const
std::ostream & warningStream_
std::ostream & errorStream()
virtual bool isCompatible(const ProGe::NetlistBlock &ttaCore, int coreId, std::vector< TCEString > &reasons) const
int memoryAddrWidth() const
virtual void connectPorts(ProGe::NetlistBlock &netlistBlock, const ProGe::NetlistPort &memPort, const ProGe::NetlistPort &corePort, bool inverted, int coreId)
virtual ~MemoryGenerator()
int memoryMauSize() const
TCEString corePortName(const TCEString &portBaseName, int coreId) const
TCEString templatePath() const
std::vector< ProGe::Parameter > ParameterList
int portCount() const
void instantiateTemplate(const TCEString &inFile, const TCEString &outFile, const TCEString &entity) const
virtual MemoryGenerator::BlockPair createMemoryNetlistBlock(ProGe::NetlistBlock &integratorBlock, int memIndex, int coreId)
TCEString ttaCoreName() const
Definition FUGen.hh:54
MemType type
TCEString lsuName
TCEString asName