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 assignPatterns(FunctionalBlock* _block) throw(Exception); // called during output pattern computation
\r
44 void generateVHDL(FunctionalBlock* _block, const QString& path) throw(Exception); // main entry to generate the VHDL code
\r
49 QString referenceXml;
\r
50 QString referenceMd5;
\r
51 QString nameEnt, line;
\r
52 QMap<QString, int> paramMap;
\r
53 ArithmeticEvaluator* evaluator;
\r
54 ReferenceBlock* reference;
\r
55 FunctionalBlock* block; // the current functional block for which this implementation is used.
\r
57 void generateComments(QDomElement &elt,QString coreFile, QTextStream& out) throw(Exception); // generates comments from <comments> element
\r
58 void generateLibraries(QDomElement &elt, QTextStream& out) throw(Exception); // generates libraries from <libraries> element
\r
59 void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference
\r
60 void generateArchitecture(QDomElement &elt, QTextStream& out) throw(Exception); // generate the architecture using <architecture> element
\r
61 void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block
\r
63 QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface
\r
65 friend QDataStream &operator<<(QDataStream &out, const BlockImplementation &impl);
\r
66 friend QDataStream &operator>>(QDataStream &in, BlockImplementation &impl);
\r
69 #endif // __BLOCKIMPLEMENTATION_H__
\r