X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/14cd6d834ab531525a51c6a6992583b3e9143e02..e40a5399ec7887c2606f18575c809b0d05b09278:/FunctionalBlock.cpp?ds=sidebyside diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index 449e2ec..ab9611d 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -8,7 +8,7 @@ #include "ArithmeticEvaluator.h" -FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference) throw(Exception) : AbstractBlock() { +FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference, bool createIfaces) throw(Exception) : AbstractBlock() { //if (! _reference->isReferenceBlock()) throw(Exception(BLOCK_INVALID_TYPE)); //if (! _group->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE)); reference = _reference; @@ -30,6 +30,10 @@ FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference delta = -1; evaluator = NULL; + if (createIfaces) { + populate(); + } + } FunctionalBlock::~FunctionalBlock() { @@ -96,7 +100,7 @@ void FunctionalBlock::populate() { 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 + it would be a good idea to make the user choose which one must be connected to defautl clk. Presently, the first encountered is chosen */ @@ -122,18 +126,6 @@ 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() { @@ -441,12 +433,17 @@ QList FunctionalBlock::expandPatternRecur(const QString& patternIn, int *o catch(Exception e) { throw(e); } + if (repeat == 0) { + // remove the last + patternOut.removeLast(); + } + else { // repeat just the last value in currentGroup - char last = patternOut.last(); - //cout << "repeat last char " << repeat << " times : " << (int)last << endl; - - for(int i=1;i<(int)repeat;i++) { - patternOut.append(last); + char last = patternOut.last(); + //cout << "repeat last char " << repeat << " times : " << (int)last << endl; + for(int i=1;i<(int)repeat;i++) { + patternOut.append(last); + } } } *offset += 1; @@ -470,15 +467,21 @@ QList FunctionalBlock::expandPatternRecur(const QString& patternIn, int *o catch(Exception e) { throw(e); } - /* + if (repeat == 0) { + QList voidList; + return voidList; + } + else { + /* cout << "repeat last group " << repeat << " times : "; foreach (char c, currentGroup) cout <<(int)c; - cout << endl; + cout << endl; */ - QList single = patternOut; - for(int i=1;i<(int)repeat;i++) { - patternOut.append(single); - } + QList single = patternOut; + for(int i=1;i<(int)repeat;i++) { + patternOut.append(single); + } + } } return patternOut; }