From c8c1e24dac94abfacb78fb3b661c9a5dbbb0d86a Mon Sep 17 00:00:00 2001 From: domas stephane Date: Mon, 22 May 2017 11:05:22 +0200 Subject: [PATCH] finished compat. computation --- FunctionalBlock.cpp | 53 +++++++++++++++++++++++++++++++-------------- GroupBlock.cpp | 5 +++-- blast.creator.user | 8 +++---- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index 66e89b4..7a4d4ff 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -430,7 +430,12 @@ void FunctionalBlock::createInputPattern() { else { inputPattern.insert(connIface,NULL); } - } + } + // remove null columns at the end of IP + while(! isValidDataGroup(inputPattern,lengthIP-1)) { + removeDataGroup(inputPattern,lengthIP-1); + lengthIP -= 1; + } } bool FunctionalBlock::createAdmittance(int nbExec) { @@ -504,7 +509,9 @@ bool FunctionalBlock::createAdmittance(int nbExec) { QList* pattern = iterA.value(); for(int i=0;isize();i++) { if (pattern->at(i) == -1) pattern->replace(i,0); + cout << (int)(pattern->at(i)); } + cout << endl; } return true; } @@ -524,26 +531,40 @@ bool FunctionalBlock::checkInputPatternCompatibility() { return false; } int nbExec = getNumberOfExecution(); + cout << qPrintable(name) << " will exec. " << nbExec << " times." << endl; + ok = createAdmittance(nbExec); - if (!ok) return false; + + if (!ok) { + cout << "cannot create admittance" << endl; + return false; + } int clock = 0; // index in IP - int i = 0; // index in AP - while (clock < lengthIP) { - if (samePatterns(inputPattern,clock,admittance,i)) { - clock++; - i++; - } - else { - if (isValidDataGroup(admittance,i)) { - - } - else { - // IP and AP are not equal and AP is a valid group -> not compatible + int i = 0; // index in AP + while ((clock < lengthIP) && (i < lengthAP)) { + + // if AP is a valid group, search for the next valid group in IP + if (isValidDataGroup(admittance,i)) { + while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++; + if (clock == lengthIP) { + cerr << "Abnormal case: end of IP has been reached without finding a valid group" << endl; return false; } - } + /* at that point 2 cases of compat : IP(clock) and AP(i) are equal valid group, or + are both null columns + */ + if (! samePatterns(inputPattern,clock,admittance,i)) { + cout << "AP(" << i << ") and IP(" << clock << ") are not equal" << endl; + return false; + } + clock++; + i++; + } + if (clock < lengthIP) { + cerr << "Abnormal case: AP is to short" << endl; + return false; } return true; } @@ -834,7 +855,7 @@ int FunctionalBlock::getNumberOfExecution() { nbExec = 1; int nbGroup = 0; for(int i = offset;i - + EnvironmentId - {1d077e47-e3a1-47fd-8b12-4de650e39df5} + {eddbf04f-e5ee-4f36-bc65-6ab7f2b6d4ec} ProjectExplorer.Project.ActiveTarget @@ -60,12 +60,12 @@ Desktop Desktop - {451ee8a3-56ff-4aba-8a8e-3da882cc142e} + {72d0832a-d73b-473a-b29c-d1c0737451fe} 0 0 0 - /localhome/sdomas/Projet/Blast/code/blast + /home/sdomas/Projet/Blast/code/blast -- 2.39.5