]> AND Private Git Repository - blast.git/blobdiff - SpecialBlock.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
changed sources to stimulis
[blast.git] / SpecialBlock.cpp
index 8edff6f9adc6a448add3220bafaacc15f16faafd..8c7cc1025ed0ea1887d594f3e41173838aeaa9f5 100644 (file)
@@ -1,20 +1,30 @@
 #include "SpecialBlock.h"\r
 #include "SpecialBlock.h"\r
+#include "FunctionalInterface.h"\r
 \r
 \r
-SpecialBlock::SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) {\r
-  type = _type;  \r
+SpecialBlock::SpecialBlock(int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) {\r
+  specialType = _type;\r
 }\r
 \r
 SpecialBlock::~SpecialBlock() {\r
 }\r
 \r
 }\r
 \r
 SpecialBlock::~SpecialBlock() {\r
 }\r
 \r
+bool SpecialBlock::isSpecialBlock() {\r
+  return true;\r
+}\r
+\r
 void SpecialBlock::checkInputPatternCompatibility() throw(Exception) {\r
   try {\r
 void SpecialBlock::checkInputPatternCompatibility() throw(Exception) {\r
   try {\r
-    switch(type) {\r
-    case ClockConvert :\r
+    switch(specialType) {\r
+    case Source :\r
+      checkInputPatternCompatibilitySource();\r
+      break;\r
+    case Sink :\r
+      checkInputPatternCompatibilitySink();\r
+      break;\r
+    case ClkConvert :\r
       checkInputPatternCompatibilityClockConvert();\r
       break;\r
       checkInputPatternCompatibilityClockConvert();\r
       break;\r
-    case ClkRstGen:\r
-      checkInputPatternCompatibilityClkRstGen();\r
+    default:\r
       break;\r
     }\r
   }\r
       break;\r
     }\r
   }\r
@@ -25,12 +35,17 @@ void SpecialBlock::checkInputPatternCompatibility() throw(Exception) {
 \r
 void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) {\r
   try {\r
 \r
 void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) {\r
   try {\r
-    switch(type) {\r
-    case ClockConvert :\r
-      computeOutputPatternClockConvert(nbExec);\r
+    switch(specialType) {\r
+    case Source :\r
+      computeOutputPatternSource(nbExec);\r
       break;\r
       break;\r
-    case ClkRstGen:\r
-      computeOutputPatternClkRstGen(nbExec);\r
+    case Sink :\r
+      computeOutputPatternSink(nbExec);\r
+      break;\r
+    case ClkConvert :\r
+      computeOutputPatternClockConvert(nbExec);\r
+      break;    \r
+    default:\r
       break;\r
     }\r
   }\r
       break;\r
     }\r
   }\r
@@ -39,13 +54,33 @@ void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) {
   }\r
 }\r
 \r
   }\r
 }\r
 \r
-void SpecialBlock::checkInputPatternCompatibilityClockConvert() throw(Exception) {\r
+void SpecialBlock::checkInputPatternCompatibilitySource() throw(Exception) {\r
 }\r
 }\r
-void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) {\r
+void SpecialBlock::computeOutputPatternSource(int nbExec) throw(Exception) {\r
+\r
+  cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl;\r
+  foreach(AbstractInterface* iface, getControlOutputs()) {\r
+    FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+    // create output pattern\r
+    QList<char>* pp = productionPattern.value(connIface);\r
+    QList<char>* pattern = new QList<char>(*pp);\r
+    for(int i=1;i<nbExec;i++) pattern->append(*pp);\r
+    // assign pattern to interface\r
+    connIface->setOutputPattern(pattern);\r
+    // store it in QMap\r
+    outputPattern.insert(connIface,pattern);\r
+  }\r
+  setOutputPatternComputed(true);\r
 }\r
 \r
 }\r
 \r
+void SpecialBlock::checkInputPatternCompatibilitySink() throw(Exception) {\r
+}\r
+void SpecialBlock::computeOutputPatternSink(int nbExec) throw(Exception) {\r
+}\r
 \r
 \r
-void SpecialBlock::checkInputPatternCompatibilityClkRstGen() throw(Exception) {\r
+void SpecialBlock::checkInputPatternCompatibilityClockConvert() throw(Exception) {\r
 }\r
 }\r
-void SpecialBlock::computeOutputPatternClkRstGen(int nbExec) throw(Exception) {\r
+void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) {\r
 }\r
 }\r
+\r
+\r