Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
InterconnectRTLWriter.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// File: InterconnectRTLWriter.h
3//-----------------------------------------------------------------------------
4// Project: Kactus2
5// Author: Teemu Hanhisuanto, Linda Virtanen
6// Date: 07.2025
7//
8// Description:
9// Generates top-level Verilog interconnects for supported bus types utilizing
10// Pulp Platform libraries (https://github.com/pulp-platform).
11//-----------------------------------------------------------------------------
12
13#ifndef INTERCONNECTRTLWRITER_H
14#define INTERCONNECTRTLWRITER_H
15
16#include "ConfigJsonParser.h"
17
18#include <QtCore>
19
20#include <IPXACTmodels/Component/Component.h>
21
29
31{
32
34 {
35 public:
37 InterconnectRTLWriter(QSharedPointer<Component> component, LibraryInterface* library,
38 MessageMediator* messager, QString directory, ConfigStruct* config,
39 QString clk, QString rst);
40
43
46
50
51 private:
52
59 void writeAXI4(QTextStream& stream);
60
61
68 void writeAXI4LITE(QTextStream& stream);
69
70
76 void writeAxiParams(QTextStream& stream);
77
78
86 void writeAxiAddrMap(QTextStream& stream);
87
88
94 void writeAxiXbarCfg(QTextStream& stream);
95
96
103 void writeAxiXbar(QTextStream& stream);
104
105
118 void writeSignalAssignments(QTextStream& stream, QString busName, int index, bool isInit);
119
120
127 void writeTargetAssign(QTextStream& stream);
128
129
136 void writeInitAssign(QTextStream& stream);
137
138
145 void writeObiParams(QTextStream& stream);
146
147
156 void writeObiInterfaces(QTextStream& stream);
157
158
165 void writeObiAddrMap(QTextStream& stream);
166
167
173 void writeObiXbar(QTextStream& stream);
174
175
182 void removeEndmodule(QFile& file);
183
184
191 QString indent(int n = 1);
192
193
203 QString parseAddress(QString original);
204
205
213 QString commentWriter(QString title, QString subtitle = "");
214
215 QSharedPointer<Component> component_{ nullptr };
216
217 MessageMediator* messager_{ nullptr };
218
219 LibraryInterface* library_{ nullptr };
220
222 ConfigStruct* config_;
223
224 QString directory_;
225 QString clkPort_;
226 QString rstPort_;
227
229 QStringList axiPorts_ = {
230 // Write address channel
231 "aw_id", "aw_addr", "aw_len", "aw_size", "aw_burst", "aw_lock", "aw_cache",
232 "aw_prot", "aw_qos", "aw_region", "aw_atop", "aw_user", "aw_writetoken", "aw_readpointer",
233
234 // Write data channel
235 "w_data", "w_strb", "w_last", "w_user", "w_writetoken", "w_readpointer",
236
237 // Write response channel
238 "b_id", "b_resp", "b_user", "b_writetoken", "b_readpointer",
239
240 // Read address channel
241 "ar_id", "ar_addr", "ar_len", "ar_size", "ar_burst", "ar_lock", "ar_cache",
242 "ar_prot", "ar_qos", "ar_region", "ar_user", "ar_writetoken", "ar_readpointer",
243
244 // Read data channel
245 "r_id", "r_data", "r_resp", "r_last", "r_user", "r_writetoken", "r_readpointer"
246 };
247
248
250 QStringList axiLitePorts_ = {
251 // Write address channel
252 "aw_addr", "aw_prot", "aw_valid", "aw_ready",
253
254 // Write data channel
255 "w_data", "w_strb", "w_valid", "w_ready",
256
257 // Write response channel
258 "b_resp", "b_valid", "b_ready",
259
260 // Read address channel
261 "ar_addr", "ar_prot", "ar_valid", "ar_ready",
262
263 // Read data channel
264 "r_data", "r_resp", "r_valid", "r_ready"
265 };
266
267
269 QStringList obiPorts_ = {
270 // Output
271 "req", "reqpar", "gnt", "gntpar", "addr", "we", "be", "wdata", "aid", "a_optional",
272
273 // Input
274 "rvalid", "rvalidpar", "rready", "rreadypar", "rdata", "rid", "err", "r_optional"
275 };
276
277 QStringList supportedInterfaces = { "axi4", "axi4lite", "obi" };
278
279 QString axiTargetBus_ = "_target";
280 QString axiInitBus_ = "_init";
281 QString axiXbar_;
282
283 QString axiTargetParam_ = "AXI_TARGETS";
284 QString axiInitParam_ = "AXI_INITIATORS";
285 QString IdWidthInits_ = "IdWidthInits";
286 QString addrRulesParam_ = "NoAddrRules";
287 QString ruleType_ = "rule_t";
288 QString addrMapXBAR_ = "AddrMapXBAR";
289 QString axiCfg_ = "xbar_cfg";
290
291 QString obiTargetParam_ = "OBI_TARGETS";
292 QString obiInitParam_ = "OBI_INITIATORS";
293 QString obiAddrRule_ = "addr_rule_t";
294 QString obiInitInterface_ = "obi_init_bus";
295 QString obiTargetInterface_ = "obi_target_bus";
296
298 QStringList obiXbarCfgParams_ = {
299 "ADDR_WIDTH",
300 "DATA_WIDTH",
301 IdWidthInits_,
302 "obi_pkg::ObiMinimalOptionalConfig"
303 };
304
305 /*QStringList obiXbarCfgParams_ = {
306 /*"AUSER_WIDTH",
307 "WUSER_WIDTH",
308 "RUSER_WIDTH",
309 "MID_WIDTH",
310 "ACHK_WIDTH",
311 "RCHK_WIDTH"
312 };*/
313 };
314}
315
316#endif // INTERCONNECTRTLWRITER_H
~InterconnectRTLWriter()=default
The destructor.
void generateRTL()
Called externally to generate the interconnect code.
InterconnectRTLWriter & operator=(const InterconnectRTLWriter &other)=delete
InterconnectRTLWriter(QSharedPointer< Component > component, LibraryInterface *library, MessageMediator *messager, QString directory, ConfigStruct *config, QString clk, QString rst)
The constructor.
InterconnectRTLWriter(const InterconnectRTLWriter &other)=delete
No copying. No assignment.
LibraryInterface defines an interface to operate the IP-XACT-library.
Interface for outputting messages to the user.