1 #ifndef __BLOCKIMPLEMENTATION_H__
\r
2 #define __BLOCKIMPLEMENTATION_H__
\r
10 class ReferenceBlock;
\r
11 class FunctionalBlock;
\r
12 class AbstractInterface;
\r
14 #include "ArithmeticEvaluator.h"
\r
15 class ArithmeticEvaluator;
\r
17 #include "Exception.h"
\r
21 using namespace std;
\r
24 class BlockImplementation {
\r
28 BlockImplementation(const QString& _xmlFile);
\r
29 BlockImplementation(const QString& _xmlFile, const QString& _referenceXml, const QString& _referenceMd5);
\r
32 inline QString getXmlFile() { return xmlFile; }
\r
33 inline QString getReferenceXml() { return referenceXml; }
\r
34 inline QString getReferenceMd5() { return referenceMd5; }
\r
35 inline QString getDelta() { return delta; }
\r
36 inline QHash<QString,QString> getConsumptionPattern() { return consumptionPattern; }
\r
37 inline QHash<QString,QString> getProductionPattern() { return productionPattern; }
\r
38 inline QString getProductionCounter() { return productionCounter; }
\r
41 QString eval(QString line, QTextStream& out);
\r
42 QString evalComplex(QString line, int num);
\r
43 QString evalString(QString s);
\r
44 QList<AbstractInterface*>* evalStringComplex(QString s);
\r
45 QString evalValue(QString s);
\r
46 QString calculateWidth(QString s);
\r
48 inline void setReference(ReferenceBlock* _reference) { reference = _reference; }
\r
50 void loadPatterns(QDomElement &root) throw(Exception);
\r
51 bool checkPatterns();
\r
52 void generateVHDL(FunctionalBlock* _block, const QString& path) throw(Exception); // main entry to generate the VHDL code
\r
57 QString referenceXml;
\r
58 QString referenceMd5;
\r
59 QString nameEnt, line;
\r
60 QMap<QString, int> paramMap;
\r
61 ArithmeticEvaluator* evaluator;
\r
62 ReferenceBlock* reference;
\r
63 FunctionalBlock* block; // the current functional block for which this implementation is used.
\r
65 QHash<QString,QString> consumptionPattern; // key = reference interface name, value = pattern expression
\r
66 QHash<QString,QString> productionPattern; // key = reference interface name, value = pattern expression
\r
67 QString productionCounter;
\r
69 void generateComments(QDomElement &elt,QString coreFile, QTextStream& out) throw(Exception); // generates comments from <comments> element
\r
70 void generateLibraries(QDomElement &elt, QTextStream& out) throw(Exception); // generates libraries from <libraries> element
\r
71 void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference
\r
72 void generateArchitecture(QDomElement &elt, QTextStream& out) throw(Exception); // generate the architecture using <architecture> element
\r
73 void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block
\r
75 QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface
\r
77 friend QDataStream &operator<<(QDataStream &out, const BlockImplementation &impl);
\r
78 friend QDataStream &operator>>(QDataStream &in, BlockImplementation &impl);
\r
81 #endif // __BLOCKIMPLEMENTATION_H__
\r