else {\r
implementation = reference->getImplementations().at(0);\r
}\r
+ lengthAP = -1;\r
+ lengthCP = -1;\r
+ lengthIP = -1;\r
+ lengthOP = -1;\r
+ lengthPP = -1;\r
+ delta = -1;\r
}\r
\r
\r
}\r
\r
void FunctionalBlock::createInputPattern() {\r
+ static QString fctName = "FunctionalBlock::createInputPattern())";\r
+#ifdef DEBUG_FCTNAME\r
+ cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+ \r
lengthIP = -1;\r
foreach(AbstractInterface* iface, getControlInputs()) { \r
ConnectedInterface* connIface = AI_TO_CON(iface);\r
}\r
}\r
}\r
- \r
+ // turn all X into 0\r
+ QMapIterator<AbstractInterface*,QList<char>* > iterA(admittance);\r
+ while (iterA.hasNext()) {\r
+ iterA.next();\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
+ }\r
+ }\r
return true;\r
}\r
\r
ok = createAdmittance(nbExec);\r
if (!ok) return false;\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
+ return false;\r
+ }\r
+ \r
+ } \r
+ }\r
return true;\r
}\r
\r
return true;\r
}\r
\r
+bool FunctionalBlock::samePatterns(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, const QMap<AbstractInterface*, QList<char>* >& patternDest, int destCol) {\r
+ \r
+ if (patternSrc.size() != patternDest.size()) return false;\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(patternSrc);\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterDest(patternDest);\r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next();\r
+ iterDest.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ QList<char>* destPat = iterDest.value();\r
+ if (srcCol >= srcPat->size()) return false;\r
+ if (destCol >= destPat->size()) return false;\r
+ if (srcPat->at(srcCol) != destPat->at(destCol)) return false; \r
+ }\r
+ return true;\r
+}\r
+\r
bool FunctionalBlock::canCombinePatterns(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int destCol) {\r
if (patternSrc.size() != patternDest.size()) return false;\r
QMapIterator<AbstractInterface*, QList<char>* > iterSrc(patternSrc);\r