X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/84eeae848c9d322ea4c935b8ec7338f69becbc10..c8c1e24dac94abfacb78fb3b661c9a5dbbb0d86a:/FunctionalBlock.cpp?ds=inline 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