1 #ifndef __REFERENCEBLOCK_H__
2 #define __REFERENCEBLOCK_H__
11 #include "AbstractBlock.h"
14 #include "BlockImplementation.h"
16 #include "Exception.h"
23 class ReferenceBlock : public AbstractBlock {
27 ReferenceBlock(const QString _xmlFile);
30 inline QString getXmlFile() { return xmlFile; }
31 inline QString getBriefDescription() { return descriptionBrief; }
32 inline QString getDetailedDescription() { return descriptionDetail; }
33 inline QList<int> getCategories() { return categories; }
34 inline QList<BlockImplementation *> getImplementations() { return implementations; }
35 inline QString getHashMd5() { return hashMd5; }
37 inline AbstractBlock* getParent() { return NULL; }
39 void addCategory(int id);
40 void setBriefDescription(const QString& str);
41 void setDetailedDescription(const QString& str);
42 void addImplementation(BlockImplementation* impl);
44 void load(QDomElement &elt) throw(Exception);
47 QList<QString> getExternalResources();
48 void generateVHDL(const QString& path) throw(Exception); // main entry to generate the VHDL code
50 void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure);
53 QString xmlFile; // the xml file from which attributes are initialized.
55 QString descriptionBrief;
56 QString descriptionDetail;
57 QList<int> categories;
58 QList<BlockImplementation *> implementations; // set when implementations are read
60 // loading methods for the different tags in the XML desc.
61 void loadInformations(QDomElement &elt) throw(Exception);
62 void loadParameters(QDomElement &elt) throw(Exception);
63 void loadInterfaces(QDomElement &elt) throw(Exception);
64 void createInterfaceForParameters() throw(Exception);
66 friend QDataStream &operator<<(QDataStream &out, const ReferenceBlock &b);
67 friend QDataStream &operator>>(QDataStream &in, ReferenceBlock &b);
70 void checkInputPatternCompatibility() throw(Exception);
71 void computeOutputPattern(int nbExec = -1) throw(Exception);
72 void computeAdmittanceDelays() throw(Exception);
74 void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from <comments> element
75 void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from <libraries> element
76 void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception); // generate the architecture using <architecture> element
77 void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block
78 void generateEntityOrComponentBody(QTextStream& out, int indentLevel, bool hasController=false) throw(Exception); // generate the entity/compo body using reference
82 #endif // __REFERENCEBLOCK_H__