From: sdomas Date: Mon, 5 Mar 2018 11:13:49 +0000 (+0100) Subject: moved generate vhdl methods X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/e9f53048b4a0192d95382277e8f40e850998b256?ds=inline;hp=c85843afb9bd492b46d6fe87a8287157097483f5 moved generate vhdl methods --- diff --git a/AbstractBlock.h b/AbstractBlock.h index 3e811e9..37cd35a 100644 --- a/AbstractBlock.h +++ b/AbstractBlock.h @@ -4,6 +4,7 @@ #include #include +#include #include "AbstractInterface.h" class AbstractInterface; @@ -58,6 +59,8 @@ public: // others void connectClkReset() throw(Exception); + virtual void generateVHDL(const QString& path) throw(Exception) = 0; // main entry to generate the VHDL code + virtual void parametersValidation(QList* checkedBlocks, QList* blocksToConfigure) = 0; // ugly but usefull @@ -102,6 +105,11 @@ protected: // NB: only GroupBlock and FunctionalBlock have a real parent, except sources that have no parents AbstractBlock* parent; + virtual void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) = 0; // generates comments from element + virtual void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) = 0; // generates libraries from element + virtual void generateEntity(QTextStream& out, bool hasController=false) throw(Exception) = 0; // generate the entity using reference + virtual void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception) = 0; // generate the architecture using element + virtual void generateController(QTextStream& out) throw(Exception) = 0; // generate the wishbone controller of the block }; diff --git a/BlockImplementation.cpp b/BlockImplementation.cpp index 46c9722..1553ebb 100644 --- a/BlockImplementation.cpp +++ b/BlockImplementation.cpp @@ -182,7 +182,7 @@ void BlockImplementation::generateVHDL(FunctionalBlock* _block, const QString &p } // This function generates the comments part of the VHDL document -void BlockImplementation::generateComments(QDomElement &elt, QString coreFile, QTextStream& out) throw(Exception) { +void BlockImplementation::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) { for(int i = 0; i < 50; i++) { out << "--"; @@ -222,7 +222,7 @@ void BlockImplementation::generateComments(QDomElement &elt, QString coreFile, Q } // This function generates the library part of the VHDL document -void BlockImplementation::generateLibraries(QDomElement &elt, QTextStream& out) throw(Exception) { +void BlockImplementation::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) { QDomNodeList listLib = elt.elementsByTagName("library"); for(int i = 0; i < listLib.length(); i++) { @@ -370,7 +370,7 @@ void BlockImplementation::generateEntity(QTextStream& out, bool hasController) t } // This function generates the architecture part of the VHDL document -void BlockImplementation::generateArchitecture(QDomElement &elt, QTextStream& out) throw(Exception) { +void BlockImplementation::generateArchitecture(QTextStream& out, QDomElement &elt) throw(Exception) { QString expr; QString code = elt.text(); diff --git a/BlockImplementation.h b/BlockImplementation.h index ad50a6a..8bbc297 100644 --- a/BlockImplementation.h +++ b/BlockImplementation.h @@ -70,10 +70,10 @@ private: QHash productionPattern; // key = reference interface name, value = pattern expression QString productionCounter; - void generateComments(QDomElement &elt,QString coreFile, QTextStream& out) throw(Exception); // generates comments from element - void generateLibraries(QDomElement &elt, QTextStream& out) throw(Exception); // generates libraries from element + void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from element + void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from element void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference - void generateArchitecture(QDomElement &elt, QTextStream& out) throw(Exception); // generate the architecture using element + void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception); // generate the architecture using element void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index 8ecd6a3..b54e4e3 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -1312,3 +1312,22 @@ int FunctionalBlock::createTriggers() { } return triggers.size(); } + +void FunctionalBlock::generateVHDL(const QString& path) throw(Exception){ + } + +void FunctionalBlock::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) { + +} + +void FunctionalBlock::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) { + +} + +void FunctionalBlock::generateEntity(QTextStream& out, bool hasController=false) throw(Exception) { + +} + +void FunctionalBlock::generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception) { + +} diff --git a/FunctionalBlock.h b/FunctionalBlock.h index c51ff77..d3bd581 100644 --- a/FunctionalBlock.h +++ b/FunctionalBlock.h @@ -51,6 +51,7 @@ public: // others void populate(); // create parameters and interface from reference block + void generateVHDL(const QString& path) throw(Exception); // main entry to generate the VHDL code void parametersValidation(QList *checkedBlocks, QList* blocksToConfigure); QString getReferenceXmlFile(); @@ -153,6 +154,12 @@ private: */ void shiftRightPattern(const QMap* >& pattern, int offset); + void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from element + void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from element + void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference + void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception); // generate the architecture using element + void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block + QMap* > consumptionPattern; QMap admittanceCyclic; // the admittance expressed as prologue-cyclic part-epilogue, deduced from admittance QMap* > admittance; // the admittance taking into account nb exec. diff --git a/GroupBlock.cpp b/GroupBlock.cpp index 6cd76b9..a3966bd 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -295,11 +295,11 @@ void GroupBlock::generateVHDL(const QString& path) throw(Exception) { } -void GroupBlock::generateComments(QTextStream& out) throw(Exception) { +void GroupBlock::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) { out << " -- VHDL generated automatically for " << name << " --" << endl << endl; } -void GroupBlock::generateLibraries(QTextStream& out) throw(Exception) { +void GroupBlock::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) { out << "library IEEE;" << endl; out << "use IEEE.STD_LOGIC_1164.all;" << endl; @@ -410,7 +410,7 @@ void GroupBlock::generateEntity(QTextStream& out) throw(Exception) { } -void GroupBlock::generateArchitecture(QTextStream& out) throw(Exception) { +void GroupBlock::generateArchitecture(QTextStream& out, QDomElement &elt) throw(Exception) { } diff --git a/GroupBlock.h b/GroupBlock.h index 172803d..bb5e771 100644 --- a/GroupBlock.h +++ b/GroupBlock.h @@ -64,11 +64,12 @@ private: * found by taking the output pattern of the connectedFrom interface. */ void createInputPattern(); - void generateComments(QTextStream& out) throw(Exception); - void generateLibraries(QTextStream& out) throw(Exception); - void generateEntity(QTextStream& out) throw(Exception); - void generateArchitecture(QTextStream& out) throw(Exception); + void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from element + void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from element + void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference + void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception); // generate the architecture using element + void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block bool topGroup; QList blocks; // contains instances of FunctionalBlock or GroupBlock that are children of this group diff --git a/ReferenceBlock.cpp b/ReferenceBlock.cpp index 5137d73..f6fd9c7 100644 --- a/ReferenceBlock.cpp +++ b/ReferenceBlock.cpp @@ -6,6 +6,7 @@ #include "BlockParameterGeneric.h" #include "BlockParameterPort.h" #include "BlockParameterWishbone.h" +#include "Parameters.h" ReferenceBlock::ReferenceBlock(const QString _xmlFile) : AbstractBlock() { xmlFile = _xmlFile; @@ -94,7 +95,7 @@ void ReferenceBlock::loadInformations(QDomElement &elt) throw(Exception) { } else { QDomText txtName = nodeNameTxt.toText(); - name = normalizeName(txtName.data().trimmed()); + name = Parameters::normalizeName(txtName.data().trimmed()); cout<< "block name : " << qPrintable(name) << endl; } @@ -635,3 +636,27 @@ void ReferenceBlock::computeAdmittanceDelays() throw(Exception) { } +void ReferenceBlock::generateVHDL(const QString& path) throw(Exception){ + throw(Exception(INVALID_REFBLOCK_USE)); +} + +void ReferenceBlock::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) { + throw(Exception(INVALID_REFBLOCK_USE)); +} + +void ReferenceBlock::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) { + throw(Exception(INVALID_REFBLOCK_USE)); +} + +void ReferenceBlock::generateEntity(QTextStream& out, bool hasController=false) throw(Exception) { + throw(Exception(INVALID_REFBLOCK_USE)); +} + +void ReferenceBlock::generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception) { + throw(Exception(INVALID_REFBLOCK_USE)); +} + +void ReferenceBlock::generateController(QTextStream& out) throw(Exception) { + throw(Exception(INVALID_REFBLOCK_USE)); +} + diff --git a/ReferenceBlock.h b/ReferenceBlock.h index baa8aaf..79db803 100644 --- a/ReferenceBlock.h +++ b/ReferenceBlock.h @@ -44,6 +44,10 @@ public: void load(QDomElement &elt) throw(Exception); void setHashMd5(); + void generateVHDL(const QString& path) throw(Exception); // main entry to generate the VHDL code + + void parametersValidation(QList* checkedBlocks, QList* blocksToConfigure); + private: QString xmlFile; // the xml file from which attributes are initialized. QString hashMd5; @@ -61,16 +65,16 @@ private: friend QDataStream &operator<<(QDataStream &out, const ReferenceBlock &b); friend QDataStream &operator>>(QDataStream &in, ReferenceBlock &b); - - // AbstractBlock interface -public: - void parametersValidation(QList* checkedBlocks, QList* blocksToConfigure); - -private: // patterns void checkInputPatternCompatibility() throw(Exception); void computeOutputPattern(int nbExec = -1) throw(Exception); void computeAdmittanceDelays() throw(Exception); + + void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from element + void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from element + void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference + void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception); // generate the architecture using element + void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block }; #endif // __REFERENCEBLOCK_H__ diff --git a/blast.creator.user b/blast.creator.user new file mode 100644 index 0000000..37faf88 --- /dev/null +++ b/blast.creator.user @@ -0,0 +1,198 @@ + + + + + + EnvironmentId + {94112477-caab-4897-8f75-5f412f2c883a} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {c934e180-ebc6-41ed-be82-502cc94f41f6} + 0 + 0 + 0 + + /home/sdomas/Projet/Blast/code/blast + + + + all + + false + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Compiler + + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Nettoyer + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Défaut + Défaut + GenericProjectManager.GenericBuildConfiguration + + 1 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Déployer localement + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + + %{buildDir} + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/lib/implementations/impls.bmf b/lib/implementations/impls.bmf new file mode 100644 index 0000000..b69078a Binary files /dev/null and b/lib/implementations/impls.bmf differ diff --git a/lib/references/references.bmf b/lib/references/references.bmf new file mode 100644 index 0000000..a34f592 Binary files /dev/null and b/lib/references/references.bmf differ