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?hp=77e28a24d444098399304f0175b1aba43c83017f after merge --- diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index 90031d9..336b677 100644 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@ -4,16 +4,21 @@ #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 = Parameters::normalizeName(_name); parent = NULL; } +*/ AbstractBlock::~AbstractBlock() { @@ -238,4 +243,49 @@ QList AbstractBlock::getWishboneParameters() { +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 --git a/AbstractBlock.h b/AbstractBlock.h index ebb1560..3e811e9 100644 --- a/AbstractBlock.h +++ b/AbstractBlock.h @@ -21,7 +21,7 @@ class AbstractBlock { public: AbstractBlock(); - AbstractBlock(const QString& _name); + //AbstractBlock(const QString& _name); virtual ~AbstractBlock(); // getters @@ -30,7 +30,7 @@ public: 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,6 +56,8 @@ public: bool isWBConfigurable(); // others + void connectClkReset() throw(Exception); + virtual void parametersValidation(QList* checkedBlocks, QList* blocksToConfigure) = 0; // ugly but usefull diff --git a/Exception.cpp b/Exception.cpp index 9592e4d..8c59d0d 100644 --- a/Exception.cpp +++ b/Exception.cpp @@ -34,6 +34,9 @@ QString Exception::getDefaultMessage() { case IFACE_NULL : ret = tr("A parameter of type AbstractInterface* has been provided with NULL value."); break; case IFACE_INVALID_TYPE : ret = tr("A parameter of type AbstractInterface* is used with an incorrect instance type."); break; case IFACE_MULTIPLICITY_REACHED : ret = tr("Impossible to create another instance of a GraphInterface: the maximum multiplicity is reached."); break; + case IFACE_BLOCK_NOCLKRST : ret = tr("Cannot find a clk or rst for a block."); break; + case IFACE_GROUP_NOCLKRST : ret = tr("Cannot find a clk or rst for a group."); break; + case IFACE_TOP_NOCLKRSTGEN : ret = tr("Cannot find the clkrstgen block in top group."); break; case BLOCKITEM_NULL : ret = tr("A parameter of type AbstractBlockItem* has been provided with NULL value."); break; case BLOCKITEM_INVALID_TYPE : ret = tr("A parameter of type AbstractBlockItem* is used with an incorrect instance type."); break; case WIDTHS_NOT_EQUALS : ret = tr("Two interfaces are connected but don't have the same widths."); break; diff --git a/Exception.h b/Exception.h index e45e7bb..608bc55 100644 --- a/Exception.h +++ b/Exception.h @@ -44,10 +44,14 @@ supp. infos : saved in UTF-8 [éè] #define BLOCK_NULL 1001 #define BLOCK_INVALID_TYPE 1002 + // exceptions for interfaces manipulations #define IFACE_NULL 2001 #define IFACE_INVALID_TYPE 2002 #define IFACE_MULTIPLICITY_REACHED 2003 +#define IFACE_BLOCK_NOCLKRST 2004 +#define IFACE_GROUP_NOCLKRST 2005 +#define IFACE_TOP_NOCLKRSTGEN 2006 // exceptions for block items manipulations #define BLOCKITEM_NULL 3001 diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index b494784..8ecd6a3 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -29,6 +29,7 @@ FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference lengthPP = -1; delta = -1; evaluator = NULL; + } FunctionalBlock::~FunctionalBlock() { @@ -77,6 +78,8 @@ void FunctionalBlock::populate() { addParameter(p); } + ConnectedInterface* toClk = NULL; + ConnectedInterface* toRst = NULL; // create interfaces from reference block QList lstRef = reference->getInterfaces(); // store relation between functional and reference @@ -90,8 +93,19 @@ void FunctionalBlock::populate() { exit(1); } hashIface.insert(lstRef.at(i),inter); - addInterface(inter); + /* WARNING FOR THE FUTURE : + in case of there are several clock interfaces ofr that block + it would be a godd idea to make the user choose which one + must be connected to defautl clk. + Presently, the first encountered is chosen + */ + if ((toClk == NULL) && (inter->getPurpose() == AbstractInterface::Clock)) { + toClk = AI_TO_CON(inter); + } + if ((toRst == NULL) && (inter->getPurpose() == AbstractInterface::Reset)) { + toRst = AI_TO_CON(inter); + } } AbstractInterface* funCtlIface = NULL; @@ -108,8 +122,19 @@ void FunctionalBlock::populate() { } } } -} + // connect clk and rst to group clk/rst or to clkrstgen + if ((name != "clkrstgen") && (parent != NULL)) { + try { + connectClkReset(); + } + catch(Exception e) { + AbstractBlock* source = (AbstractBlock *)(e.getSource()); + cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl; + throw(e); + } + } +} QString FunctionalBlock::getReferenceXmlFile() { return ((ReferenceBlock *)reference)->getXmlFile(); diff --git a/GroupBlock.cpp b/GroupBlock.cpp index 0ba203d..6cd76b9 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -32,20 +32,21 @@ GroupBlock::GroupBlock(GroupBlock *_parent) throw(Exception) : AbstractBlock() 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() { diff --git a/GroupBlock.h b/GroupBlock.h index 0f0d206..172803d 100644 --- a/GroupBlock.h +++ b/GroupBlock.h @@ -34,7 +34,7 @@ public: inline void addBlock(AbstractBlock* block) { blocks.append(block); } void removeBlock(AbstractBlock* block); AbstractBlock* getFunctionalBlockByName(QString name); - + void removeAllBlocks(); void parametersValidation(QList *checkedBlocks, QList* blocksToConfigure); void addGenericParameter(QString name, QString type, QString value); diff --git a/ReferenceBlock.cpp b/ReferenceBlock.cpp index fbf7828..5137d73 100644 --- a/ReferenceBlock.cpp +++ b/ReferenceBlock.cpp @@ -94,7 +94,7 @@ void ReferenceBlock::loadInformations(QDomElement &elt) throw(Exception) { } else { QDomText txtName = nodeNameTxt.toText(); - name = txtName.data().trimmed(); + name = normalizeName(txtName.data().trimmed()); cout<< "block name : " << qPrintable(name) << endl; } @@ -633,3 +633,5 @@ void ReferenceBlock::computeAdmittanceDelays() throw(Exception) { // does strictly nothing throw(Exception(INVALID_REFBLOCK_USE)); } + + diff --git a/blast.creator.user b/blast.creator.user deleted file mode 100755 index 2d89560..0000000 --- a/blast.creator.user +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 1d8c695..0000000 Binary files a/lib/implementations/impls.bmf and /dev/null differ diff --git a/lib/references/references.bmf b/lib/references/references.bmf deleted file mode 100644 index 2c93c03..0000000 Binary files a/lib/references/references.bmf and /dev/null differ