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
31 inline QString getXmlFile() { return xmlFile; }
\r
32 inline QString getReferenceXml() { return referenceXml; }
\r
33 inline QString getReferenceMd5() { return referenceMd5; }
\r
34 QString eval(QString line, QTextStream& out);
\r
35 QString evalComplex(QString line, int num);
\r
36 QString evalString(QString s);
\r
37 QList<AbstractInterface*>* evalStringComplex(QString s);
\r
38 QString evalValue(QString s);
\r
39 QString calculateWidth(QString s);
\r
41 inline void setReference(ReferenceBlock* _reference) { reference = _reference; }
\r
43 void generateVHDL(FunctionalBlock* _block, const QString& path) throw(Exception); // main entry to generate the VHDL code
\r
47 QString referenceXml;
\r
48 QString referenceMd5;
\r
49 QString nameEnt, line;
\r
50 QMap<QString, int> paramMap;
\r
51 ArithmeticEvaluator* evaluator;
\r
52 ReferenceBlock* reference;
\r
53 FunctionalBlock* block; // the current functional block for which this implementation is used.
\r
55 void generateComments(QDomElement &elt,QString coreFile, QTextStream& out) throw(Exception); // generates comments from <comments> element
\r
56 void generateLibraries(QDomElement &elt, QTextStream& out) throw(Exception); // generates libraries from <libraries> element
\r
57 void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference
\r
58 void generateArchitecture(QDomElement &elt, QTextStream& out) throw(Exception); // generate the architecture using <architecture> element
\r
59 void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block
\r
61 QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface
\r
63 friend QDataStream &operator<<(QDataStream &out, const BlockImplementation &impl);
\r
64 friend QDataStream &operator>>(QDataStream &in, BlockImplementation &impl);
\r
67 #endif // __BLOCKIMPLEMENTATION_H__
\r