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
27
28#include <QSharedPointer>
29#include <QHash>
30#include <QString>
31
33{
34
39 {
40 QSharedPointer<BusInterface> endpointBus;
41 QString start;
42 QString range;
43 };
44
49 {
50 std::string name;
51 std::string mode;
52 QString start;
53 QString range;
54 };
55
59 class KACTUS2_API Generator
60 {
61 public:
69
71 ~Generator() = default;
72
79 VLNV generate();
80
90 void generate(ConfigStruct* config,
91 const QHash<QString, QList<QSharedPointer<BusInterface>>>& startingPoints,
92 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endPoints,
93 bool generateRtl);
94
96 Generator(const Generator& other) = delete;
97
99 Generator& operator=(const Generator& other) = delete;
100
101 private:
107 void openDesign(VLNV designVLNV);
108
115 void createInterconComponent(VLNV VLNV);
116
121 void findUnconnectedInterfaces();
122
129 void processStartingPointsAndEndpoints(
130 const QHash<QString, QList<QSharedPointer<BusInterface>>>& startingPoints,
131 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endpoints);
132
141 std::vector<BusInterfaceInfo> processEndpointSide(
142 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endpoints, int& index);
143
152 std::vector<BusInterfaceInfo> processStartingSide(
153 const QHash<QString, QList<QSharedPointer<BusInterface>>>& startingPoints, int& index);
154
166 BusInterfaceInfo createInterfaceForBus(
167 const QString& instanceName, const QSharedPointer<BusInterface>& bus,
168 bool isTop, bool isEndpoint, int& index);
169
177 void createBusInterface(std::string busName, std::string modeString, int index);
178
189 std::string createBusInterface(VLNV busVLNV, std::string busName, std::string modeString, int index);
190
197 void createRstorClkInterface(std::string busName, int index);
198
205 void createPortMaps(std::string modeString, QSharedPointer<BusInterface> busInf);
206
214 void createPhysPorts(QSharedPointer<Component> comp, QString busName, bool isTop = false);
215
221 void finalizeBusInterfaceCustomization(const std::vector<BusInterfaceInfo>& createdBuses);
222
230 void createAddressSpace(std::string spaceName, QString range, QString width = "32");
231
237 void createGlobalAddressSpaceFromEndpoints(
238 const QHash<QString, QList<QSharedPointer<EndpointData>>>& endpoints);
239
243 void createChannel();
244
253 QSharedPointer<ConfigurableVLNVReference> resolveComponentVLNV(
254 const QString& instanceName, bool isTop) const;
255
263 bool isTargetInterface(const QSharedPointer<BusInterface>& bus) const;
264
275 std::string getInterfaceMode(QSharedPointer<BusInterface> bus, bool isTarget, bool isChannel, bool isTop);
276
286 std::string getLogicalPortName(QSharedPointer<Component> comp, QString busName, QString physicalName) const;
287
295 std::pair<QString, QString> getWidthBoundsFromAbstraction(const std::string& logicalName) const;
296
304 std::pair<QString, QString> getMirroredWidthBounds(const QString& physicalName) const;
305
314 quint64 parseIpxactHex(const QString& str, bool* ok);
315
319 void createFileAndFileset();
320
321 //-----------------------------------------------------------------------------
322 // Data.
323 //-----------------------------------------------------------------------------
324
326 MessageMediator* messager_{ nullptr };
327
329 LibraryInterface* library_{ nullptr };
330
332 QSharedPointer<Component> interconComponent_{ nullptr };
333
335 QSharedPointer<Design> design_{ nullptr };
336
338 QSharedPointer<ComponentParameterFinder> parameterFinder_{
339 new ComponentAndInstantiationsParameterFinder(nullptr) };
340
342 QSharedPointer<ExpressionParser> expressionParser_{
343 new IPXactSystemVerilogParser(parameterFinder_) };
344
346 QSharedPointer<ListParameterFinder> absDefParameterFinder_{new ListParameterFinder()};
347
349 QSharedPointer<ExpressionParser> absDefExpressionParser_{new IPXactSystemVerilogParser(absDefParameterFinder_)};
350
352 QSharedPointer<ExpressionFormatter> expressionFormatter_{
353 new ExpressionFormatter(parameterFinder_) };
354
356 BusInterfaceInterface* busInfInterface_{ nullptr };
357
359 QSharedPointer<PortValidator> portValidator_{
360 new PortValidator(expressionParser_,
361 QSharedPointer<QList<QSharedPointer<View>> >()) };
362
364 PortsInterface* portsInterface_{
365 new PortsInterface(portValidator_, expressionParser_, expressionFormatter_) };
366
368 PortAbstractionInterface* portAbsInterface_{
369 new PortAbstractionInterface(expressionParser_, expressionFormatter_) };
370
372 InterconnectionInterface* connectionInterface_{ new InterconnectionInterface() };
373
375 AdHocConnectionInterface* adhocConnectionInterface_{ new AdHocConnectionInterface() };
376
378 ComponentInstanceInterface* instanceInterface_{
379 new ComponentInstanceInterface(connectionInterface_, adhocConnectionInterface_) };
380
382 AbstractionTypeInterface* absTypeInf_{ nullptr };
383
385 ConfigStruct* config_;
386
387
388
390 QList<QSharedPointer<BusInterface>> initiators_;
391
393 QList<QSharedPointer<BusInterface>> targets_;
394
396 QString directory_;
397
399 std::string prefix_;
400
402 std::string globalAddressSpaceName_;
403
405 std::string clockName_;
406
408 std::string rstName_;
409
411 VLNV busDefVLNV_;
412
414 VLNV rstVLNV_;
415
417 VLNV clkVLNV_;
418
420 QString clkPort_;
421
423 QString rstPort_;
424 };
425}
426
427#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.