Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
InterconnectGenerator.h
Go to the documentation of this file.
1#ifndef INTERCONNECTGENERATOR_H
2#define INTERCONNECTGENERATOR_H
3
4#include <IPXACTmodels/Component/validators/PortValidator.h>
5#include <IPXACTmodels/Component/BusInterface.h>
6#include <IPXACTmodels/Component/Component.h>
7#include <IPXACTmodels/Design/Design.h>
8#include <IPXACTmodels/DesignConfiguration/DesignConfiguration.h>
9#include <IPXACTmodels/Component/TransparentBridge.h>
10#include <IPXACTmodels/Component/AddressSpace.h>
11
26
27#include <QSharedPointer>
28#include <QHash>
29#include <QString>
30
32{
33
38 {
39 QSharedPointer<BusInterface> endpointBus;
40 QString start;
41 QString range;
42 };
43
48 {
49 std::string name;
50 std::string mode;
51 QString start;
52 QString range;
53 };
54
58 class KACTUS2_API Generator
59 {
60 public:
68
70 ~Generator() = default;
71
78 VLNV generate();
79
89 void generate(ConfigStruct* config,
90 const QHash<QString, QList<QSharedPointer<BusInterface>>>& startingPoints,
91 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endPoints,
92 bool generateRtl);
93
95 Generator(const Generator& other) = delete;
96
98 Generator& operator=(const Generator& other) = delete;
99
100 private:
106 void openDesign(VLNV designVLNV);
107
114 void createInterconComponent(VLNV VLNV);
115
120 void findUnconnectedInterfaces();
121
128 void processStartingPointsAndEndpoints(
129 const QHash<QString, QList<QSharedPointer<BusInterface>>>& startingPoints,
130 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endpoints);
131
140 std::vector<BusInterfaceInfo> processEndpointSide(
141 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endpoints, int& index);
142
151 std::vector<BusInterfaceInfo> processStartingSide(
152 const QHash<QString, QList<QSharedPointer<BusInterface>>>& startingPoints, int& index);
153
165 BusInterfaceInfo createInterfaceForBus(
166 const QString& instanceName, const QSharedPointer<BusInterface>& bus,
167 bool isTop, bool isEndpoint, int& index);
168
176 void createBusInterface(std::string busName, std::string modeString, int index);
177
188 std::string createBusInterface(VLNV busVLNV, std::string busName, std::string modeString, int index);
189
196 void createRstorClkInterface(std::string busName, int index);
197
204 void createPortMaps(std::string modeString, QSharedPointer<BusInterface> busInf);
205
213 void createPhysPorts(QSharedPointer<Component> comp, QString busName, bool isTop = false);
214
220 void finalizeBusInterfaceCustomization(const std::vector<BusInterfaceInfo>& createdBuses);
221
229 void createAddressSpace(std::string spaceName, QString range, QString width = "32");
230
236 void createGlobalAddressSpaceFromEndpoints(
237 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endpoints);
238
242 void createChannel();
243
252 QSharedPointer<ConfigurableVLNVReference> resolveComponentVLNV(
253 const QString& instanceName, bool isTop) const;
254
262 bool isTargetInterface(const QSharedPointer<BusInterface>& bus) const;
263
274 std::string getInterfaceMode(QSharedPointer<BusInterface> bus, bool isTarget, bool isChannel, bool isTop);
275
285 std::string getLogicalPortName(QSharedPointer<Component> comp, QString busName, QString physicalName) const;
286
294 std::pair<QString, QString> getWidthBoundsFromAbstraction(const std::string& logicalName) const;
295
303 std::pair<QString, QString> getMirroredWidthBounds(const QString& physicalName) const;
304
313 quint64 parseIpxactHex(const QString& str, bool* ok);
314
318 void createFileAndFileset();
319
320 //-----------------------------------------------------------------------------
321 // Data.
322 //-----------------------------------------------------------------------------
323
325 MessageMediator* messager_{ nullptr };
326
328 LibraryInterface* library_{ nullptr };
329
331 QSharedPointer<Component> interconComponent_{ nullptr };
332
334 QSharedPointer<Design> design_{ nullptr };
335
337 QSharedPointer<ComponentParameterFinder> parameterFinder_{
338 new ComponentAndInstantiationsParameterFinder(nullptr) };
339
341 QSharedPointer<ExpressionParser> expressionParser_{
342 new IPXactSystemVerilogParser(parameterFinder_) };
343
345 QSharedPointer<ExpressionFormatter> expressionFormatter_{
346 new ExpressionFormatter(parameterFinder_) };
347
349 BusInterfaceInterface* busInfInterface_{ nullptr };
350
352 QSharedPointer<PortValidator> portValidator_{
353 new PortValidator(expressionParser_,
354 QSharedPointer<QList<QSharedPointer<View>> >()) };
355
357 PortsInterface* portsInterface_{
358 new PortsInterface(portValidator_, expressionParser_, expressionFormatter_) };
359
361 PortAbstractionInterface* portAbsInterface_{
362 new PortAbstractionInterface(expressionParser_, expressionFormatter_) };
363
365 InterconnectionInterface* connectionInterface_{ new InterconnectionInterface() };
366
368 AdHocConnectionInterface* adhocConnectionInterface_{ new AdHocConnectionInterface() };
369
371 ComponentInstanceInterface* instanceInterface_{
372 new ComponentInstanceInterface(connectionInterface_, adhocConnectionInterface_) };
373
375 AbstractionTypeInterface* absTypeInf_{ nullptr };
376
378 ConfigStruct* config_;
379
380
381
383 QList<QSharedPointer<BusInterface>> initiators_;
384
386 QList<QSharedPointer<BusInterface>> targets_;
387
389 QString directory_;
390
392 std::string prefix_;
393
395 std::string globalAddressSpaceName_;
396
398 std::string clockName_;
399
401 std::string rstName_;
402
404 VLNV busDefVLNV_;
405
407 VLNV rstVLNV_;
408
410 VLNV clkVLNV_;
411
413 QString clkPort_;
414
416 QString rstPort_;
417 };
418}
419
420#endif // INTERCONNECTGENERATOR_H
Generator & operator=(const Generator &other)=delete
No assignment.
Generator(LibraryInterface *library, MessageMediator *messager)
Generator(const Generator &other)=delete
No copy constructor.
void generate(ConfigStruct *config, const QHash< QString, QList< QSharedPointer< BusInterface > > > &startingPoints, const QHash< QString, QList< QSharedPointer< EndpointData > > > &endPoints, bool generateRtl)
~Generator()=default
Default destructor.
LibraryInterface defines an interface to operate the IP-XACT-library.
Interface for outputting messages to the user.
std::string mode
Mode of the interface.
std::string name
Name of the bus interface.
QSharedPointer< BusInterface > endpointBus
Endpoint bus interface.