else {\r
inputPattern.insert(connIface,NULL);\r
} \r
- } \r
+ }\r
+ // remove null columns at the end of IP\r
+ while(! isValidDataGroup(inputPattern,lengthIP-1)) {\r
+ removeDataGroup(inputPattern,lengthIP-1);\r
+ lengthIP -= 1;\r
+ }\r
}\r
\r
bool FunctionalBlock::createAdmittance(int nbExec) {\r
QList<char>* pattern = iterA.value();\r
for(int i=0;i<pattern->size();i++) {\r
if (pattern->at(i) == -1) pattern->replace(i,0);\r
+ cout << (int)(pattern->at(i));\r
}\r
+ cout << endl;\r
}\r
return true;\r
}\r
return false;\r
}\r
int nbExec = getNumberOfExecution();\r
+ cout << qPrintable(name) << " will exec. " << nbExec << " times." << endl;\r
+ \r
ok = createAdmittance(nbExec);\r
- if (!ok) return false;\r
+ \r
+ if (!ok) {\r
+ cout << "cannot create admittance" << endl;\r
+ return false;\r
+ }\r
\r
int clock = 0; // index in IP \r
- int i = 0; // index in AP\r
- while (clock < lengthIP) {\r
- if (samePatterns(inputPattern,clock,admittance,i)) {\r
- clock++;\r
- i++;\r
- }\r
- else {\r
- if (isValidDataGroup(admittance,i)) {\r
- \r
- }\r
- else {\r
- // IP and AP are not equal and AP is a valid group -> not compatible\r
+ int i = 0; // index in AP \r
+ while ((clock < lengthIP) && (i < lengthAP)) {\r
+ \r
+ // if AP is a valid group, search for the next valid group in IP\r
+ if (isValidDataGroup(admittance,i)) {\r
+ while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++;\r
+ if (clock == lengthIP) {\r
+ cerr << "Abnormal case: end of IP has been reached without finding a valid group" << endl;\r
return false;\r
}\r
- \r
} \r
+ /* at that point 2 cases of compat : IP(clock) and AP(i) are equal valid group, or\r
+ are both null columns\r
+ */\r
+ if (! samePatterns(inputPattern,clock,admittance,i)) {\r
+ cout << "AP(" << i << ") and IP(" << clock << ") are not equal" << endl;\r
+ return false;\r
+ }\r
+ clock++;\r
+ i++;\r
+ }\r
+ if (clock < lengthIP) {\r
+ cerr << "Abnormal case: AP is to short" << endl;\r
+ return false;\r
}\r
return true;\r
}\r
nbExec = 1;\r
int nbGroup = 0;\r
for(int i = offset;i<lengthIP;i++) {\r
- if (isValidDataGroup(inputPattern,offset)) nbGroup++;\r
+ if (isValidDataGroup(inputPattern,i)) nbGroup++;\r
if (nbGroup == delta+1) {\r
nbExec += 1;\r
nbGroup = 1;\r