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 void generateVHDL(const QString& path) throw(Exception); // main entry to generate the VHDL code
49 void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure);
52 QString xmlFile; // the xml file from which attributes are initialized.
54 QString descriptionBrief;
55 QString descriptionDetail;
56 QList<int> categories;
57 QList<BlockImplementation *> implementations; // set when implementations are read
59 // loading methods for the different tags in the XML desc.
60 void loadInformations(QDomElement &elt) throw(Exception);
61 void loadParameters(QDomElement &elt) throw(Exception);
62 void loadInterfaces(QDomElement &elt) throw(Exception);
63 void createInterfaceForParameters() throw(Exception);
65 friend QDataStream &operator<<(QDataStream &out, const ReferenceBlock &b);
66 friend QDataStream &operator>>(QDataStream &in, ReferenceBlock &b);
69 void checkInputPatternCompatibility() throw(Exception);
70 void computeOutputPattern(int nbExec = -1) throw(Exception);
71 void computeAdmittanceDelays() throw(Exception);
73 void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from <comments> element
74 void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from <libraries> element
75 void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference
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
80 #endif // __REFERENCEBLOCK_H__