From: stephane Domas Date: Mon, 5 Mar 2018 10:00:46 +0000 (+0100) Subject: after merge X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/c85843afb9bd492b46d6fe87a8287157097483f5?ds=inline;hp=-c after merge --- c85843afb9bd492b46d6fe87a8287157097483f5 diff --combined AbstractBlock.cpp index 90031d9,13adcae..336b677 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@@ -3,17 -3,20 +3,22 @@@ #include #include "AbstractInterface.h" #include "BlockParameter.h" +#include "Parameters.h" + #include "GroupBlock.h" + #include "ConnectedInterface.h" + + AbstractBlock::AbstractBlock() { name = ""; parent = NULL; } + /* AbstractBlock::AbstractBlock(const QString& _name) { - name = normalizeName(_name); + name = Parameters::normalizeName(_name); parent = NULL; } + */ AbstractBlock::~AbstractBlock() { @@@ -26,7 -29,7 +31,7 @@@ } void AbstractBlock::setName(const QString& str) { - name = normalizeName(str); + name = Parameters::normalizeName(str); } void AbstractBlock::setParent(AbstractBlock* _parent) { @@@ -236,6 -239,56 +241,51 @@@ QList AbstractBlock:: return lst; } -QString AbstractBlock::normalizeName(const QString &name) { - QString s = name; - s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_"); - s.replace(QRegularExpression("[_]+"),"_"); - return s; -} + + void AbstractBlock::connectClkReset() throw(Exception) { + + GroupBlock* parentBlock = AB_TO_GRP(parent); + + cout << "connecting clk/rst for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl; + + QList lstClk = getInterfaces(AbstractInterface::Input,AbstractInterface::Clock); + QList lstRst = getInterfaces(AbstractInterface::Input,AbstractInterface::Reset); + + if ((lstClk.isEmpty()) || (lstRst.isEmpty())) { + throw(Exception(IFACE_GROUP_NOCLKRST,this)); + } + + ConnectedInterface* toClk = AI_TO_CON(lstClk.at(0)); + ConnectedInterface* toRst = AI_TO_CON(lstRst.at(0)); + + ConnectedInterface* fromClk = NULL; + ConnectedInterface* fromRst = NULL; + + if (parentBlock->isTop()) { + AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName("clkrstgen"); + if (clkrstgen == NULL) { + throw(Exception(IFACE_TOP_NOCLKRSTGEN,this)); + } + else { + fromClk = AI_TO_CON(clkrstgen->getIfaceFromName("clk")); + fromRst = AI_TO_CON(clkrstgen->getIfaceFromName("reset")); + } + } + else { + fromClk = AI_TO_CON(parentBlock->getIfaceFromName("clk")); + fromRst = AI_TO_CON(parentBlock->getIfaceFromName("reset")); + } + if ((fromClk == NULL) || (fromRst == NULL)) { + throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock)); + } + else { + fromClk->connectTo(toClk); + fromRst->connectTo(toRst); + } + + + } + + diff --combined AbstractBlock.h index ebb1560,616682d..3e811e9 --- a/AbstractBlock.h +++ b/AbstractBlock.h @@@ -21,7 -21,7 +21,7 @@@ class AbstractBlock public: AbstractBlock(); - AbstractBlock(const QString& _name); + //AbstractBlock(const QString& _name); virtual ~AbstractBlock(); // getters @@@ -30,7 -30,7 +30,7 @@@ inline QList getParameters() { return params; } inline QList getInputs() { return inputs; } inline QList getOutputs() { return outputs; } - inline QList getBidirs() { return bidirs; } + inline QList getBidirs() { return bidirs; } QList getUserParameters(); QList getGenericParameters(); QList getPortParameters(); @@@ -56,7 -56,9 +56,9 @@@ bool isWBConfigurable(); // others - static QString normalizeName(const QString& name); + void connectClkReset() throw(Exception); + + virtual void parametersValidation(QList* checkedBlocks, QList* blocksToConfigure) = 0; // ugly but usefull void addParameter(BlockParameter *param); diff --combined GroupBlock.cpp index 0ba203d,4746a74..6cd76b9 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@@ -5,7 -5,6 +5,7 @@@ #include "GroupInterface.h" #include "string.h" #include +#include "Parameters.h" int GroupBlock::counter = 1; @@@ -32,20 -31,21 +32,21 @@@ GroupBlock::GroupBlock(GroupBlock *_par rst = new GroupInterface(this,"ext_reset", AbstractInterface::Input, AbstractInterface::Reset); addInterface(clk); addInterface(rst); - // creating clkrstgen block : done in Dispatcher since this has no access to library + // creating clkrstgen block and connecting it to this: done in Dispatcher since this has no access to library } parent = _parent; + if (_parent != NULL) { - // adding this to the child blocks of parent - _parent->addBlock(this); - // connect clk/rst ifaces to parent clk/rst or to clkrstgen if parent is top group - if (_parent->isTop()) { - + try { + connectClkReset(); } - else { - + catch(Exception e) { + AbstractBlock* source = (AbstractBlock *)(e.getSource()); + cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl; + throw(e); } } + } GroupBlock::~GroupBlock() { @@@ -269,7 -269,7 +270,7 @@@ void GroupBlock::generateVHDL(const QSt QString coreFile = ""; coreFile = path; - coreFile.append(normalizeName(name)); + coreFile.append(Parameters::normalizeName(name)); coreFile.append(".vhd"); QFile vhdlCore(coreFile); diff --combined blast.creator.user index 2d89560,f58f194..0000000 deleted file mode 100755,100755 --- a/blast.creator.user +++ /dev/null @@@ -1,198 -1,198 +1,0 @@@ -- -- - - -- -- -- EnvironmentId - {94112477-caab-4897-8f75-5f412f2c883a} - {c8006d66-d34f-42be-ad10-d0207752286d} -- -- -- 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} - {2c9bf876-3476-44eb-8065-1f0844704dda} -- 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 --combined lib/implementations/impls.bmf index 1d8c695,8384e85..0000000 deleted file mode 100644,100644 Binary files differ diff --combined lib/references/references.bmf index 2c93c03,a34f592..0000000 deleted file mode 100644,100644 Binary files differ