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

Private GIT Repository
pattern comput done
authorstephane Domas <stephane.domas@univ-fcomte.fr>
Sun, 14 May 2017 19:45:38 +0000 (21:45 +0200)
committerstephane Domas <stephane.domas@univ-fcomte.fr>
Sun, 14 May 2017 19:45:38 +0000 (21:45 +0200)
44 files changed:
AbstractBlock.h
AbstractInterface.cpp
AbstractInterface.h
ArithmeticEvaluator.cpp
ArithmeticEvaluator.h
BlockImplementation.cpp
BoxItem.cpp
ConnectedInterface.h
Dispatcher.cpp
Dispatcher.h
FunctionalBlock.cpp
FunctionalBlock.h
FunctionalInterface.cpp
FunctionalInterface.h
Graph.cpp
Graph.h
GroupBlock.cpp
GroupBlock.h
GroupInterface.cpp
GroupItem.cpp
GroupScene.cpp
GroupWidget.cpp
MainWindow.cpp
Parameters.cpp
ParametersWindow.cpp
ReferenceInterface.h
SourceItem.cpp
blast.creator.user
lib/implementations/average-Nx3_impl.xml
lib/implementations/decimator-N_impl.xml [new file with mode: 0644]
lib/implementations/generator-cst_impl.xml
lib/implementations/generator-img_impl.xml [new file with mode: 0644]
lib/implementations/impls.bmf
lib/implementations/rgb216bits_impl.xml [new file with mode: 0644]
lib/implementations/scatter_impl.xml [new file with mode: 0644]
lib/references/average-Nx3.xml
lib/references/decimator-N.xml [new file with mode: 0644]
lib/references/generator-cst.xml
lib/references/generator-img.xml [new file with mode: 0644]
lib/references/references.bmf
lib/references/rgb216bits.xml [new file with mode: 0644]
lib/references/scatter.xml [new file with mode: 0644]
projectfile.xsd
reference.xsd

index 88e4cb91076e0323eeb141263282e629206f5bad..921621204526ba47d575abed2ca2f35eec1bf6d4 100644 (file)
@@ -36,14 +36,11 @@ public:
   QList<BlockParameter *> getPortParameters();\r
   QList<BlockParameter *> getWishboneParameters();\r
   inline AbstractBlock* getParent() { return parent; }\r
-  inline QList<int> getProductionCounter() { return productionCounter; }\r
-  inline int getDelta() { return delta; }\r
+  inline bool getPatternComputed() { return patternComputed; }\r
   \r
   // setters\r
   void setName(const QString& str);\r
   virtual void setParent(AbstractBlock* _parent);\r
-  inline void setProductionCounter(QList<int> pattern) { productionCounter = pattern; }\r
-  inline void setDelta(int _delta) { delta = _delta; }\r
   inline void setPatternComputed(bool state) { patternComputed = state; }\r
 \r
   // testers\r
@@ -90,9 +87,7 @@ protected:
   \r
   // others\r
   \r
-  // patterns\r
-  QList<int> productionCounter; //! only usefull for output interfaces\r
-  int delta;\r
+  // patterns  \r
   bool patternComputed;\r
   \r
   // NB: only GroupBlock and FunctionalBlock have a real parent, except sources that have no parents\r
index f57f78042e922ee1567f571f5384d5ff43f297cd..49a937cc9b09f1424a0e15567acee9e52444a3a6 100644 (file)
@@ -141,10 +141,17 @@ bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) {
 int AbstractInterface::getIntDirection(QString str) {
     if(str == "input") return Input;
     if(str == "output") return Output;
-    if(str == "inOut") return InOut;
+    if(str == "inout") return InOut;
     return -1;
 }
 
+int AbstractInterface::getIntPurpose(QString str) {
+    if(str == "data") return Data;
+    else if(str == "clock") return Clock;
+    else if(str == "reset") return Reset;
+    else if(str == "wishbone") return Wishbone;
+    return -1;
+}
 
 QString AbstractInterface::getTypeString() {
 
index ac47ca9f4ba774445e0b349b7c220622c8bfe693..2c914d482883a4e0b3fa450ce3677f73ad56c3ff 100644 (file)
@@ -14,6 +14,7 @@ class Exception;
 #define AI_TO_REF(ptr) ((ReferenceInterface*)ptr)
 #define AI_TO_FUN(ptr) ((FunctionalInterface*)ptr)
 #define AI_TO_GRP(ptr) ((GroupInterface*)ptr)
+#define AI_TO_CON(ptr) ((ConnectedInterface*)ptr)
 
 using namespace std;
 using namespace Qt;
@@ -29,7 +30,8 @@ public :
   enum IfaceVHDLContext {AnyContext = 0, Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface
   enum IfaceVHDLFlags { NoComma = 1 };
 
-  static int getIntDirection(QString str);  
+  static int getIntDirection(QString str);
+  static int getIntPurpose(QString str);
 
   AbstractInterface(AbstractBlock* _owner);
   AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose);
@@ -50,16 +52,6 @@ public :
 
   double getDoubleWidth() throw(QException);
   
-  inline QList<char> getConsumptionPattern() { return consumptionPattern; }
-  inline QList<char> getProductionPattern() { return productionPattern; }  
-  inline QList<char> getOutputPattern() { return outputPattern; }
-
-  //virtual QList<AbstractInterface*> getConnectedTo() = 0;
-
-  /* NB: only GroupInterface and FunctionalInterface have a connectedFrom, so
-     defining getConnectedFrom as pure virtual is normal, usefull even though it is ugly :-)
-   */
-  virtual AbstractInterface* getConnectedFrom() = 0;
 
   // setters
   inline void setOwner(AbstractBlock* _owner) { owner = _owner; }
@@ -71,28 +63,14 @@ public :
   void setDirection(int _direction);
   bool setAssociatedIface(AbstractInterface* iface);
   
-  inline void setConsumptionPattern(QList<char> pattern) { consumptionPattern = pattern; }
-  inline void setProductionPattern(QList<char> pattern) { productionPattern = pattern; }  
-  inline void setOutputPattern(QList<char> pattern) { outputPattern = pattern; }
-
   // testers
   virtual bool isReferenceInterface();
   virtual bool isFunctionalInterface();
   virtual bool isGroupInterface();
-  //virtual bool isConnectedTo() = 0;
-  //virtual bool isConnectedFrom() = 0;
-  //virtual bool canConnectTo(AbstractInterface* iface) = 0; // returns yes if this can be connected to iface, no if not
-  //virtual bool canConnectFrom(AbstractInterface* iface) = 0; // returns yes if this can be connected from iface, no if not
 
   // others
   virtual AbstractInterface *clone() = 0;
-
-  //virtual bool addConnectedTo(AbstractInterface *inter) = 0;
-  //virtual void removeConnectedTo(AbstractInterface *inter) = 0;
-  //virtual bool setConnectedFrom(AbstractInterface* inter) = 0;
-  //virtual void clearConnectedTo() = 0;
-  //virtual void clearConnections() = 0;
-  //virtual void connectionsValidation(QStack<AbstractInterface*> *interfacetoValidate, QList<AbstractInterface*> *validatedInterfaces) throw(Exception) = 0;
+  
   int typeFromString(const QString &_type);
 
   QString toVHDL(int context, int flags) throw(Exception);
@@ -115,11 +93,7 @@ protected:
    */
   AbstractInterface* associatedIface;
   
-  // patterns
-  QList<char> consumptionPattern; //! only usefull for input interfaces
-  QList<char> productionPattern; //! only usefull for output interfaces
   
-  QList<char> outputPattern; //! only usefull for output interfaces
 };
 
 
index dd8081ea03eccca986313810960688c032ea9af9..54a9596a35b5fb569f6e65f683c439919d6baa30 100644 (file)
@@ -22,13 +22,19 @@ ArithmeticEvaluator::ArithmeticEvaluator() {
      since spaces are removed. Thus, an expression like sin 10 will lead to
      sin10 after spaces removal, and thus becomes invalid.
    */
-  fctMarkers << "sin" << "cos" << "log10" << "log2" << "log" << "ceil" << "floor" << "round";
+  fctMarkers << "sin" << "cos" << "log10" << "log2" << "log" << "ceil" << "floor" << "round";  
 }
 
 ArithmeticEvaluator::ArithmeticEvaluator(const QString& _expression) throw(int) {
   opMarkers = "+-*/";
   varMarkers = "$";
-  fctMarkers << "sin" << "cos" << "log10" << "log2" << "log" << "ceil" << "floor" << "round";
+  expression = QStringList();
+  /* CAUTION : function are mandatory using ( ) to encapsulate the operand
+     since spaces are removed. Thus, an expression like sin 10 will lead to
+     sin10 after spaces removal, and thus becomes invalid.
+   */
+  fctMarkers << "sin" << "cos" << "log10" << "log2" << "log" << "ceil" << "floor" << "round";   
+  
   try {
     setExpression(_expression);
   }
@@ -37,7 +43,10 @@ ArithmeticEvaluator::ArithmeticEvaluator(const QString& _expression) throw(int)
   }
 }
 
-void ArithmeticEvaluator::setExpression(const QString& _expression) throw(int) {
+void ArithmeticEvaluator::setExpression(const QString& _expression) throw(int) {  
+  
+  setVariableNames(_expression);
+  
   try {
     convert(_expression);
   }
@@ -46,6 +55,28 @@ void ArithmeticEvaluator::setExpression(const QString& _expression) throw(int) {
   }
 }
 
+void ArithmeticEvaluator::setVariablesValue(const QHash<QString,double>& _varValues) { 
+  varValues =  _varValues;
+  /*
+  QHashIterator<QString,double> iterV(varValues);
+  while (iterV.hasNext()) {
+    iterV.next();
+    cout << "var " << qPrintable(iterV.key()) << " = " << iterV.value() << endl;
+  }
+  */
+}
+
+void ArithmeticEvaluator::setVariableNames(const QString& _expression) {
+  varNames.clear();
+  QRegularExpression re("[$][a-zA-Z0-9_]+");
+  QRegularExpressionMatchIterator matcher = re.globalMatch(_expression);
+  while(matcher.hasNext()) {
+    QRegularExpressionMatch m = matcher.next();
+    QString var = m.captured(0);    
+    varNames.append(var);
+  }
+}
+
 void ArithmeticEvaluator::print() {
   foreach(QString elt, expression) {
     cout << qPrintable(elt) << " ";
@@ -84,6 +115,7 @@ double ArithmeticEvaluator::evalFunction(int indexFunc, double value) {
 }
 
 double ArithmeticEvaluator::evaluate() throw(int) {
+  errorMessage = "";
   QStack<double> stack;
   bool ok;
   double value1,value2;
@@ -102,7 +134,11 @@ double ArithmeticEvaluator::evaluate() throw(int) {
       stack.push(evalFunction(idFunc,value1));
     }
     else if (varMarkers.contains(c)) {
-      if (!varValues.contains(elt)) throw(-index);
+      if (!varValues.contains(elt)) {
+        errorMessage = "cannot find value of ";
+        errorMessage += qPrintable(elt);
+        throw(-index);
+      }
       stack.push(varValues.value(elt));
     }
     else if (opMarkers.contains(c)) {
@@ -166,18 +202,14 @@ double ArithmeticEvaluator::evaluate() throw(int) {
 
 void ArithmeticEvaluator::convert(const QString& _expression) throw(int) {
   
-  QString expr = _expression;  
-  cout << "converting " << qPrintable(expr) << endl;
+  QString expr = _expression;    
   QString result="";
-  expr.remove(QChar(' '), Qt::CaseInsensitive);
-  cout << "converting " << qPrintable(expr) << endl;
-  foreach(QString func, fctMarkers) {
-    cout << "for " << qPrintable(func) << endl;
+  expr.remove(QChar(' '), Qt::CaseInsensitive);  
+  foreach(QString func, fctMarkers) {    
     QString rep = QString("\x1b%1").arg(fctMarkers.indexOf(QRegExp(func)));
 
     expr.replace(QRegExp(func),rep);
-  }
-  cout << "packed expr: " << qPrintable(expr) << endl;
+  }  
 
   int offset = 0;
   try {
@@ -379,7 +411,7 @@ QString ArithmeticEvaluator::getVariable(const QString& _expression, int offset,
     *size = 1;
   }
 
-  while ((_expression[i].isLetterOrNumber()) || (_expression[i] == '-') || (_expression[i] == '_')) {
+  while ((_expression[i].isLetterOrNumber()) || (_expression[i] == '_')) {
     number.append(_expression[i]);
     i += 1;
     *size += 1;
index f6d478b9a7f73b496287d84a836be485c6d0f238..67f50a5e8dece5504ac290f8f54c38b72a9b0908 100644 (file)
@@ -30,16 +30,22 @@ public:
   ArithmeticEvaluator();
   ArithmeticEvaluator(const QString& _expression) throw(int);
 
+  //getters
+  inline QList<QString> getVariableNames() { return varNames; }
+  
+  // setters
   void setExpression(const QString& _expression) throw(int);
-  inline void setVariablesValue(const QHash<QString,double>& _varValues) { varValues =  _varValues; }
+  void setVariablesValue(const QHash<QString,double>& _varValues);
   inline void setVariableValue(const QString& var, double value) { varValues.insert(var,value); }
   inline void setVariableMarkers(const QString& _markers) { varMarkers = _markers; }
 
   void print();
   double evaluate() throw(int);
+  inline QString getError() { return errorMessage; }
 
 protected:
   QStringList expression;
+  QList<QString> varNames; // the names of variables that ARE in the expression
   QHash<QString,double> varValues;
   QString varMarkers; // a sequence of symbols that are allowed to start a variable. $ is by default
   QString opMarkers; // a sequence if symbols used as operators. +-*/ is the hard-coded default
@@ -54,6 +60,10 @@ protected:
   bool checkAfterPar(const QString& _expression, int offset);
 
   double evalFunction(int indexFunc, double value);
+  
+  void setVariableNames(const QString &_expression);
+  
+  QString errorMessage;
 
 };
 
index e6b61caa640d6eb10dff9035d11a0998f103d843..b7510217a5cce885b85b5c522d381fa26ab50e39 100644 (file)
@@ -52,8 +52,9 @@ void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) {
   }\r
   \r
   QDomElement eltProd  = eltCons.nextSiblingElement("production");\r
+  \r
   productionCounter = eltProd.attribute("counter","none");\r
-  QDomNodeList listNodeOutput = eltCons.elementsByTagName("output");\r
+  QDomNodeList listNodeOutput = eltProd.elementsByTagName("output");\r
   for(int i=0; i<listNodeOutput.size(); i++) {\r
     QDomNode node = listNodeOutput.at(i);    \r
     QDomElement elt = node.toElement();        \r
@@ -62,6 +63,12 @@ void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) {
     QString patternStr = elt.attribute("pattern","none");    \r
     productionPattern.insert(nameStr,patternStr);    \r
   }\r
+  cout << "patterns summary:" << endl;\r
+  QHashIterator<QString,QString> iterP(productionPattern);\r
+  while (iterP.hasNext()) {\r
+    iterP.next();\r
+    cout << qPrintable(iterP.key()) << " -> " << qPrintable(iterP.value()) << endl;\r
+  }\r
   cout << "impls patterns read correctly" << endl;\r
 }\r
 \r
index 568e946458a69a7b9604901f114479be7d0780fd..c473e6f70060a91d81ad889bde201e6552c1dc29 100644 (file)
@@ -504,6 +504,7 @@ void BoxItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
   QAction* showRstClkIface = NULL;
   QAction* showWishboneIface = NULL;
   QAction* showParameters = NULL;
+  QAction* showPatterns = NULL;
 
   InterfaceItem* ifaceItem = getInterfaceItemFromCursor(event->pos().x(), event->pos().y());
   // menu for interface
@@ -550,6 +551,9 @@ void BoxItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
         }
       }      
     }
+    if ((iface->getAssociatedIface() != NULL) && (iface->getDirection() == AbstractInterface::Output)) {
+      showPatterns = menu.addAction("Show patterns");
+    }
   }
   // menu for blocks (group or func)
   else {
@@ -624,13 +628,12 @@ void BoxItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
   else if(selectedAction == showWishboneIface) {
     dispatcher->showWishboneIface(this);
   }
-  else if(selectedAction == showParameters) {
-    if (refBlock->isFunctionalBlock()) {
-      FunctionalBlock* fun = AB_TO_FUN(refBlock);
-      fun->createDelta();
-    }
+  else if(selectedAction == showParameters) {    
     new ParametersWindow(refBlock, params, NULL);
-  }    
+  }
+  else if(selectedAction == showPatterns) {    
+    dispatcher->showPatterns(ifaceItem);
+  }
 }
 
 void BoxItem::loadFunctional(QDomElement funcElement) throw(Exception) {
@@ -826,7 +829,7 @@ void BoxItem::save(QXmlStreamWriter &writer) {
 
     writer.writeAttribute("id",QString::number(id));
     writer.writeAttribute("inside_group",QString::number(childGroupItem->getId()));
-    QString attrPos = QString::number(pos().x()).append(",").append(QString::number(pos().y()));
+    QString attrPos = QString::number((int)(pos().x())).append(",").append(QString::number((int)(pos().y())));
     writer.writeAttribute("position",attrPos);
     QString attrDim = QString::number(getWidth()).append(",").append(QString::number(getHeight()));
     writer.writeAttribute("dimension",attrDim);
index cfea68ce22eb03ea424a688d01f275ddc669370b..84066a6d74c664e92bcf4b4fab4fe81faed29edc 100644 (file)
@@ -24,11 +24,14 @@ public :
 
   ConnectedInterface(AbstractBlock* _owner);
   ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose);
+  
   // getters
   inline QList<ConnectedInterface*> getConnectedTo() { return connectedTo;}
   inline ConnectedInterface* getConnectedFrom() { return connectedFrom;}
+  inline QList<char> getOutputPattern() { return outputPattern; }  
 
   // setters
+  inline void setOutputPattern(QList<char> pattern) { outputPattern = pattern; }
 
   // testers
   inline bool isConnectedTo(){return connectedTo.length() != 0;}
@@ -66,6 +69,9 @@ protected:
    * this interface. connecteFrom references such an interface if it exists.
    */
   ConnectedInterface* connectedFrom;  
+  
+  // patterns  
+  QList<char> outputPattern; //! only usefull for output interfaces
 };
 
 
index 903518388f1a78828e0fc52b079b471f617c6eeb..4cd112df29a665f9e1dbcdc354353cdeffa6bdb8 100644 (file)
@@ -94,26 +94,12 @@ bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2)
 
   // test the ref1->ref2 connection
   if ((ref1->canConnectTo(ref2)) && (ref2->canConnectFrom(ref1))) {
-    ref1->connectTo(ref2);
-    /*
-    ref2->connectFrom(ref1);
-    if ((asso1 != NULL) && (asso2 != NULL)) {
-      asso1->connectTo(asso2);
-      asso2->connectFrom(asso1);
-    }
-    */
+    ref1->connectTo(ref2);    
     ok1 = true;
   }
   // if the frist one did not work, test ref2->ref1
   if ((ok1 == false) && (ref2->canConnectTo(ref1)) && (ref1->canConnectFrom(ref2))) {  
-    ref2->connectTo(ref1);
-    /*
-    ref1->connectFrom(ref2);
-    if ((asso1 != NULL) && (asso2 != NULL)) {
-      asso1->connectFrom(asso2);
-      asso2->connectTo(asso1);
-    }
-    */
+    ref2->connectTo(ref1);    
     ok2 = true;
   }
   if ((ok1 == true) || (ok2 == true)) {
@@ -122,6 +108,7 @@ bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2)
 
     unselectAllItems();
     params->unsaveModif = true;
+    cout << "created a connection from " << qPrintable(ref1->getName()) << " to " << qPrintable(ref2->getName()) << endl;
     return true;
   }
   return false;
@@ -351,6 +338,18 @@ void Dispatcher::renameInterface(InterfaceItem *item) {
   item->getOwner()->nameChanged();  
 }
 
+void Dispatcher::showPatterns(InterfaceItem *item) {
+  static QString fctName = "Dispatcher::showPatterns()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+  ConnectedInterface* iface = AI_TO_CON(item->refInter->getAssociatedIface());
+  foreach(char c, iface->getOutputPattern()) {
+    cout << (int)c;
+  }
+  cout << endl;
+}
+
 void Dispatcher::duplicateBoxItem(BoxItem *item){
   static QString fctName = "Dispatcher::duplicateBoxItem()";
 #ifdef DEBUG_FCTNAME
index 3181137b44af574faad62a74ba8b8aef42cf5f91..75583d435c768e611990038cc0330cf4dbceaef1 100644 (file)
@@ -112,6 +112,7 @@ public slots:
   void duplicateInterfaceItem(InterfaceItem* item);
   void showProperties(InterfaceItem *inter);
   void renameInterface(InterfaceItem* item);
+  void showPatterns(InterfaceItem* item);
 
   // connection ops
   bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2);    
index 5731794da37211ed6872f1b7c88ca3c703e74a79..0db21c42398801f2097a9cc7c506f6ffb1d51da4 100644 (file)
@@ -5,6 +5,7 @@
 #include "FunctionalInterface.h"\r
 #include "ReferenceInterface.h"\r
 #include "BlockParameter.h"\r
+#include "ArithmeticEvaluator.h"\r
 \r
 \r
 FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference) throw(Exception) :  AbstractBlock() {\r
@@ -114,82 +115,311 @@ QString FunctionalBlock::getReferenceHashMd5() {
 }\r
 \r
 bool FunctionalBlock::createPatterns() {\r
+  static QString fctName = "FunctionalBlock::createPatterns()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
+  cout << "create patterns for block " << qPrintable(name) << endl;\r
   evaluator = new ArithmeticEvaluator();\r
   bool ok = true;\r
   ok = ok & createDelta();\r
-  if (ok) ok = ok & createConsumptionPattern();\r
-  if (ok) ok = ok & createProductionCounter();\r
+  if (! isGeneratorBlock()) {\r
+    if (ok) ok = ok & createConsumptionPattern();\r
+    if (ok) ok = ok & createProductionCounter();\r
+  }\r
   if (ok) ok = ok & createProductionPattern();\r
   delete evaluator;\r
   return ok;\r
 }\r
 \r
 bool FunctionalBlock::createDelta() {\r
-  QString delta = implementation->getDelta();\r
-  cout << "delta for " << qPrintable(name) << " = " << qPrintable(delta) << endl;\r
+  static QString fctName = "FunctionalBlock::createDelta()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif \r
+  \r
+  QString deltaStr = implementation->getDelta();\r
+  cout << "delta for " << qPrintable(name) << " = " << qPrintable(deltaStr) << endl;\r
   \r
   // look for parameter names\r
-  QHash<QString,double> vars;\r
-  QRegularExpression re("[$][a-zA-Z0-9_]+");\r
-  QRegularExpressionMatchIterator matcher = re.globalMatch(delta);\r
-  while(matcher.hasNext()) {\r
-    QRegularExpressionMatch m = matcher.next();\r
-    QString var = m.captured(0);\r
-    cout << qPrintable(var) << endl;\r
-    vars.insert(var,0.0);    \r
-  }\r
-  QHashIterator<QString,double> iterV(vars);\r
-  while (iterV.hasNext()) {\r
-    iterV.next();\r
-    QString var = iterV.key();\r
-    QString paramName = var.remove(0,1);\r
-    BlockParameter* param = reference->getParameterFromName(paramName);\r
-    cout << "param = " << qPrintable(param->getStringValue()) << endl;\r
-    if (param == NULL) {\r
-      cerr << "found an unknown parameter in delta"<< endl;\r
-      return false;\r
-    }\r
-    bool ok;\r
-    int val = param->getIntValue(&ok);\r
-    vars.insert(var,(double)val);\r
-  }\r
-  cout << "set expr " << endl;\r
-  evaluator->setExpression(delta);\r
-  cout << "set vars " << endl;\r
-  evaluator->setVariablesValue(vars);\r
-  double result = evaluator->evaluate();\r
-  cout << "delta = " << result << endl;\r
+  bool ok = true;\r
+  double result = evaluateExpression(deltaStr, &ok);\r
+  if (!ok) return false;\r
+  \r
+  delta = result;\r
+  cout << "delta = " << delta << endl;\r
    \r
   return true;\r
 }\r
 \r
 bool FunctionalBlock::createConsumptionPattern() {\r
+  static QString fctName = "FunctionalBlock::createConsumptionPattern()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
+  bool ok = true; \r
+  QHash<QString,QString> consPattern = implementation->getConsumptionPattern();  \r
+  \r
+  foreach(AbstractInterface* iface, getControlInputs()) {       \r
+    FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+    QString refName = connIface->getReference()->getName();    \r
+    if (! consPattern.contains(refName)) {\r
+      cerr << "no consumption pattern for reference interface " << qPrintable(refName) << endl;\r
+      return false;\r
+    }\r
+    QList<char> pattern = expandPattern(consPattern.value(refName),&ok);    \r
+    \r
+    if (!ok) return false;\r
+    connIface->setConsumptionPattern(pattern);\r
+    cout << qPrintable(refName) << " consumption pattern = ";\r
+    foreach(char c, pattern) {\r
+      cout << (int)c << " ";\r
+    }\r
+    cout << endl;\r
+    \r
+  }        \r
   return true;\r
 }\r
 \r
-bool FunctionalBlock::createProductionPattern() {\r
+bool FunctionalBlock::createProductionPattern() {  \r
+  static QString fctName = "FunctionalBlock::createProductionPattern()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
+  bool ok = true; \r
+  QHash<QString,QString> prodPattern = implementation->getProductionPattern();  \r
+  \r
+  foreach(AbstractInterface* iface, getControlOutputs()) {    \r
+    FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+    QString refName = connIface->getReference()->getName();    \r
+    if (! prodPattern.contains(refName)) {\r
+      cerr << "no production pattern for reference interface " << qPrintable(refName) << endl;\r
+      return false;\r
+    }\r
+    QList<char> pattern = expandPattern(prodPattern.value(refName),&ok);\r
+    if (!ok) return false;\r
+    connIface->setProductionPattern(pattern);\r
+    cout << qPrintable(refName) << " production pattern = ";\r
+    foreach(char c, pattern) {\r
+      cout << (int)c << " ";\r
+    }\r
+    cout << endl;\r
+    \r
+  }    \r
   return true;\r
 }\r
 \r
 bool FunctionalBlock::createProductionCounter() {\r
+  static QString fctName = "FunctionalBlock::createProductionCounter()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
+  QStringList counterParts = implementation->getProductionCounter().split(",");\r
+  foreach(QString s, counterParts) {\r
+    cout << "cont part = " << qPrintable(s) << endl;\r
+    bool ok;\r
+    double val = s.toDouble(&ok);\r
+    if (ok) {\r
+      productionCounter.append(val);\r
+    }\r
+    else if (s.at(0) == '{') {\r
+      s.remove(0,1);\r
+      s.chop(1);\r
+      QStringList gen = s.split(":");\r
+      if (gen.size() != 3) return false;\r
+      int start = 0;\r
+      int nb = 0;\r
+      int step = 0;\r
+      for(int i=0;i<3;i++) {\r
+        bool okVal;\r
+        double result = evaluateExpression(gen.at(i),&okVal);\r
+        if (!okVal) return false;\r
+        if (i==0) start = result;\r
+        else if (i==1) nb = result;\r
+        else if (i==2) step = result;\r
+      }\r
+      for(int j=0;j<nb;j++) {\r
+        productionCounter.append(start+j*step);\r
+      }\r
+    }\r
+    else {\r
+      bool okVal;\r
+      double result = evaluateExpression(s,&okVal);\r
+      \r
+      if (!okVal) return false;\r
+      productionCounter.append(result);      \r
+    }\r
+  }\r
+  foreach(int val, productionCounter) {\r
+    cout << val << ",";\r
+  }\r
+  cout << endl;\r
+  \r
   return true;\r
 }\r
 \r
+QList<char> FunctionalBlock::expandPattern(const QString& pattern, bool* ok) {\r
+  static QString fctName = "FunctionalBlock::expandPattern()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
+  QList<char> lst;\r
+  QString  p = pattern;\r
+  p.append(')');\r
+  int offset = 0;\r
+  lst = expandPatternRecur(p,&offset,ok);   \r
+  return lst;\r
+}\r
+\r
+QList<char> FunctionalBlock::expandPatternRecur(const QString& pattern, int *offset, bool *ok) {\r
+  \r
+  QList<char> currentGroup; \r
+  \r
+  while ((*offset < pattern.size()) && (pattern.at(*offset) != ')')) {\r
+    \r
+    QChar c = pattern.at(*offset);\r
+    if (c == '(') {\r
+      *offset += 1;\r
+      currentGroup += expandPatternRecur(pattern,offset, ok);\r
+      if (!ok) {\r
+        return currentGroup;\r
+      }\r
+    }\r
+    else if (c == '0') {\r
+      currentGroup.append(0);\r
+    }\r
+    else if (c == '1') {\r
+      currentGroup.append(1);\r
+    }\r
+    else if (c == 'X') {\r
+      currentGroup.append(-1);\r
+    }\r
+    else if (c == '{') {\r
+      *offset += 1;\r
+      QString expr = "";      \r
+      while ((*offset < pattern.size()) && (pattern.at(*offset) != '}')) {\r
+        expr += pattern.at(*offset);        \r
+        *offset += 1;\r
+      }\r
+      if (*offset == pattern.size()) {\r
+        *ok = false;\r
+        return currentGroup;\r
+      }\r
+      double repeat = evaluateExpression(expr,ok);\r
+      if (!ok) {\r
+        return currentGroup;      \r
+      }            \r
+      // repeat just the last value in currentGroup\r
+      char last = currentGroup.last();      \r
+      //cout << "repeat last char " << repeat << " times : " << (int)last << endl;\r
+      \r
+      for(int i=1;i<(int)repeat;i++) {\r
+        currentGroup += last;\r
+      }\r
+    }    \r
+    *offset += 1;\r
+  }\r
+  \r
+  // must check if after ), there is a {\r
+  if ((*offset < pattern.size()-1) && (pattern.at(*offset+1) == '{')) {\r
+    *offset += 2;\r
+    QString expr = "";      \r
+    while ((*offset < pattern.size()) && (pattern.at(*offset) != '}')) {\r
+      expr += pattern.at(*offset);        \r
+      *offset += 1;\r
+    }\r
+    if (*offset == pattern.size()) {\r
+      *ok = false;\r
+      return currentGroup;\r
+    }\r
+    double repeat = evaluateExpression(expr,ok);\r
+    if (!ok) {\r
+      return currentGroup;      \r
+    }\r
+    /*\r
+    cout << "repeat last group " << repeat << " times : ";\r
+    foreach (char c, currentGroup) cout <<(int)c;\r
+    cout << endl;  \r
+    */\r
+    QList<char> single = currentGroup;\r
+    for(int i=1;i<(int)repeat;i++) {\r
+      currentGroup += single;\r
+    }    \r
+  }\r
+  //*offset += 1;\r
+  return currentGroup;\r
+}\r
+\r
+double FunctionalBlock::evaluateExpression(const QString& expression, bool* ok) {\r
+  static QString fctName = "FunctionalBlock::evaluateExpression()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
+  *ok = true;\r
+  QHash<QString,double> vars;\r
+  evaluator->setExpression(expression);\r
+  QList<QString> varNames = evaluator->getVariableNames();\r
+  foreach (QString name, varNames) {\r
+    QString paramName = name;\r
+    paramName.remove(0,1);\r
+    BlockParameter* param = reference->getParameterFromName(paramName);    \r
+    if (param == NULL) {\r
+      cerr << "found an unknown parameter in delta"<< endl;\r
+      *ok = false;\r
+      return 0.0;\r
+    }\r
+    bool okVal;\r
+    int val = param->getDoubleValue(&okVal);\r
+    if (!okVal) {\r
+      cerr << "cannot obtain double value of paramter " << qPrintable(paramName) << endl;\r
+      *ok = false;\r
+      return 0.0;\r
+    }\r
+    vars.insert(name,(double)val);    \r
+  }  \r
+  evaluator->setVariablesValue(vars);\r
+  double result;\r
+  try {\r
+    result = evaluator->evaluate();\r
+  }\r
+  catch(int index) {\r
+    cerr << "Error at index " << index << ": " << qPrintable(evaluator->getError()) << endl;\r
+    *ok = false;\r
+    return 0.0;\r
+  }\r
+  return result;\r
+}\r
+\r
 bool FunctionalBlock::computeOutputPattern(int nbExec) {\r
+  static QString fctName = "FunctionalBlock::computeOutputPattern()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
   \r
   /* case 1: the block is a generator for which output pattern\r
      must be computed for a nbExec following executions\r
   */\r
   \r
+  \r
   if (nbExec > 0) {\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
       QList<char> pattern;\r
-      for(int i=0;i<nbExec;i++) pattern += iface->getProductionPattern();\r
-      iface->setOutputPattern(pattern);\r
+      for(int i=0;i<nbExec;i++) pattern += connIface->getProductionPattern();\r
+      connIface->setOutputPattern(pattern);\r
     }    \r
   }\r
   else {\r
-    // initialize consumption and production patterns\r
+    cout << "computing output pattern of " << qPrintable(name) << endl;\r
+    \r
+    // initialize consumption and production patterns    \r
     initConsumptionPattern();\r
     initProductionPattern();\r
     \r
@@ -199,7 +429,8 @@ bool FunctionalBlock::computeOutputPattern(int nbExec) {
     inputPattern = new char*[nbConsumingPorts];\r
     int minLen = -1;\r
     foreach(AbstractInterface* iface, getControlInputs()) {      \r
-      QList<char> in = iface->getConnectedFrom()->getOutputPattern();\r
+      ConnectedInterface* connIface = AI_TO_CON(iface);\r
+      QList<char> in = connIface->getConnectedFrom()->getOutputPattern();\r
       if (minLen == -1) {\r
         minLen = in.size();\r
       }\r
@@ -224,22 +455,26 @@ bool FunctionalBlock::computeOutputPattern(int nbExec) {
       delete [] inputPattern;\r
       return false;\r
     }\r
+    cout << "input pattern array initialized with min. len " << minLen << endl;\r
     // initialize the output pattern    \r
     char** outputPattern = NULL;\r
     outputPattern = new char*[nbProducingPorts];\r
     int lengthOP = 0;\r
     idIface = 0;\r
     foreach(AbstractInterface* iface, getControlOutputs()) {\r
-      lengthOP = minLen+iface->getProductionPattern().size();\r
+      FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+      lengthOP = minLen+connIface->getProductionPattern().size();\r
       outputPattern[idIface] = new char[lengthOP];\r
       memset(outputPattern[idIface],0,lengthOP);\r
       idIface += 1;\r
     }\r
+    cout << "output pattern array initialized" << endl;\r
     \r
     int clock = 0;\r
     nbExec = 0;\r
     // search for the beginning of the first execution.\r
-    while (! isValidDataGroup(inputPattern,nbConsumingPorts,clock)) clock++;\r
+    while ((clock < minLen) && (! isValidDataGroup(inputPattern,nbConsumingPorts,clock))) clock++;\r
+    cout << "found 1st exec clock: " << clock << endl;\r
     \r
     while (clock < minLen) {\r
       // initialize counters for current execution.\r
@@ -274,7 +509,7 @@ bool FunctionalBlock::computeOutputPattern(int nbExec) {
         \r
         // search for PC(m) valid input group in IP\r
         while (ncp < productionCounter.at(m)) {\r
-          if (isValidDataGroup(consumptionPattern,nbConsumingPorts,ccp)) cip += 1;\r
+          if (isValidDataGroup(consumptionPattern,nbConsumingPorts,ccp)) ncp += 1;\r
           ccp += 1;\r
           gap -= 1;\r
         }\r
@@ -300,12 +535,15 @@ bool FunctionalBlock::computeOutputPattern(int nbExec) {
     // find the last valid output data group\r
     while(! isValidDataGroup(outputPattern,nbProducingPorts,lengthOP-1)) lengthOP -= 1;\r
     \r
+    //for(int i=0;i<lengthOP;i++) cout << (int)(outputPattern[0][i]);\r
+    //cout << endl;\r
     // copy back outputPattern info each interface\r
     idIface = 0;\r
     foreach(AbstractInterface* iface, getControlOutputs()) {\r
+      ConnectedInterface* connIface = AI_TO_CON(iface);\r
       QList<char> pattern;\r
       for(int i=0;i<lengthOP;i++) pattern.append(outputPattern[idIface][i]);\r
-      iface->setOutputPattern(pattern);      \r
+      connIface->setOutputPattern(pattern);      \r
       idIface += 1;\r
     }\r
     \r
@@ -358,14 +596,19 @@ void FunctionalBlock::clearProductionPattern() {
 }\r
 \r
 void FunctionalBlock::initConsumptionPattern() {\r
+  static QString fctName = "FunctionalBlock::initConsumptionPattern()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
   if (consumptionPattern != NULL) clearConsumptionPattern();\r
   \r
   nbConsumingPorts = getControlInputs().size();  \r
   int idIface = 0;\r
   consumptionPattern = new char*[nbConsumingPorts];  \r
   foreach(AbstractInterface* iface, getControlInputs()) {\r
-    \r
-    QList<char> in = iface->getConsumptionPattern();\r
+    FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+    QList<char> in = connIface->getConsumptionPattern();\r
     lengthCP = in.size(); // normally, all inputs have the same lenght for CP\r
     consumptionPattern[idIface] = new char[lengthCP];\r
     int i = 0;\r
@@ -375,14 +618,19 @@ void FunctionalBlock::initConsumptionPattern() {
 }\r
 \r
 void FunctionalBlock::initProductionPattern() {\r
+  static QString fctName = "FunctionalBlock::initProductionPattern()";\r
+#ifdef DEBUG_FCTNAME\r
+  cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+  \r
   if (productionPattern != NULL) clearProductionPattern();\r
   \r
   nbProducingPorts = getControlOutputs().size();  \r
   int idIface = 0;\r
   productionPattern = new char*[nbProducingPorts];  \r
   foreach(AbstractInterface* iface, getControlOutputs()) {\r
-    \r
-    QList<char> in = iface->getProductionPattern();\r
+    FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+    QList<char> in = connIface->getProductionPattern();\r
     lengthPP = in.size(); // normally, all inputs have the same lenght for PP\r
     productionPattern[idIface] = new char[lengthPP];\r
     int i = 0;\r
index f8989906f59a839561e09780eefcf7466441bd02..b6ac65f1ee869f3f23c1ecec6ff68bd95b611895 100644 (file)
@@ -30,9 +30,14 @@ public:
 \r
   // getters\r
   inline ReferenceBlock* getReference() { return reference; }\r
-\r
+  inline QList<int> getProductionCounter() { return productionCounter; }\r
+  inline int getDelta() { return delta; }\r
+  \r
   // setters\r
   inline void setImplementation(BlockImplementation* impl) { implementation = impl; }\r
+  inline void setProductionCounter(QList<int> pattern) { productionCounter = pattern; }\r
+  inline void setDelta(int _delta) { delta = _delta; }\r
+  \r
 \r
   // testers\r
   bool isFunctionalBlock();\r
@@ -56,11 +61,14 @@ public:
   void initProductionPattern(); // initialize a char** from patterns defined for each interface\r
   void clearConsumptionPattern();\r
   void clearProductionPattern();\r
+  bool computeOutputPattern(int nbExec = -1);\r
   \r
 private:  \r
-  // patterns\r
-  bool computeOutputPattern(int nbExec = -1);\r
+  // patterns  \r
   bool isValidDataGroup(char** pattern, int nbPorts, int clock);\r
+  double evaluateExpression(const QString& expression, bool* ok);\r
+  QList<char> expandPattern(const QString& pattern, bool* ok);\r
+  QList<char> expandPatternRecur(const QString& pattern, int* offset, bool* ok);\r
   /*!\r
    * \brief combinePatterns\r
    * \param patternSrc the pattern that must be combined with patternDest (patternDest = patternDest OR patternSrc)  \r
@@ -74,6 +82,9 @@ private:
    */\r
   void combinePatterns(char** patternSrc, int srcCol, char** patternDest, int destCol, int nbCols, int nbPorts );\r
 \r
+  QList<int> productionCounter; //! only usefull for output interfaces\r
+  int delta;\r
+  \r
   char** consumptionPattern;\r
   int nbConsumingPorts;\r
   int lengthCP;\r
index 495d60e9b7f31182ed924b7af34d5a4d56a66619..145b86a28dc9fab5f115443402f9a7530827cab3 100644 (file)
@@ -101,7 +101,8 @@ bool FunctionalInterface::canConnectTo(AbstractInterface *iface) {
   */\r
   if (direction == Input) return false;\r
   if (iface->isReferenceInterface()) return false;\r
-  if (iface->getConnectedFrom() != NULL) return false;\r
+  ConnectedInterface* connIface = AI_TO_CON(iface);\r
+  if (connIface->getConnectedFrom() != NULL) return false;\r
   // first case: interface of blocks within the same group\r
   if (getOwner()->getParent() == iface->getOwner()->getParent()) {\r
 \r
index 1dfa726f1d3054c127b3d0c82755beb11ffc0d48..b87e2c79afd64001488ff99696854e91ff8391cc 100644 (file)
@@ -35,8 +35,12 @@ public :
 \r
   // getters\r
   inline ReferenceInterface* getReference() { return reference; }\r
+  inline QList<char> getConsumptionPattern() { return consumptionPattern; }\r
+  inline QList<char> getProductionPattern() { return productionPattern; }  \r
 \r
   // setters\r
+  inline void setConsumptionPattern(QList<char> pattern) { consumptionPattern = pattern; }\r
+  inline void setProductionPattern(QList<char> pattern) { productionPattern = pattern; }  \r
 \r
   // testers\r
   bool isFunctionalInterface();\r
@@ -53,7 +57,10 @@ public :
 private:\r
 \r
   ReferenceInterface* reference;  \r
-\r
+  \r
+  //patterns\r
+  QList<char> consumptionPattern; //! only usefull for input interfaces\r
+  QList<char> productionPattern; //! only usefull for output interfaces  \r
 };\r
 \r
 #endif // __FUNCTIONALINTERFACE_H__\r
index d3fd276d6dc9e6191a5485863cb4e0aae6f0ac9d..999e72aa375fc4d4d2a1c0a7a198057a3646deed 100644 (file)
--- a/Graph.cpp
+++ b/Graph.cpp
@@ -141,3 +141,34 @@ void Graph::resetPatternComputed() {
     }
   }
 }
+
+bool Graph::computeOutputPatterns(int nbExec) {
+  
+  createPatterns();
+  resetPatternComputed();  
+  // search for all block that are generators.
+  QList<FunctionalBlock*> generators;
+  generators.append(sources);
+  foreach(AbstractBlock* block, groups) {    
+    GroupBlock* group = AB_TO_GRP(block);    
+    foreach(AbstractBlock* inBlock, group->getBlocks()) {
+      FunctionalBlock* funBlock = AB_TO_FUN(inBlock);
+      if ((inBlock->isFunctionalBlock()) && (inBlock->isGeneratorBlock())) {
+        generators.append(funBlock);
+      }
+    }    
+  }
+  // search for maximum delta
+  int maxDelta = 0;
+  foreach(FunctionalBlock* block, generators) {    
+    if (block->getDelta() > maxDelta) maxDelta = block->getDelta();
+  }
+  // compute output for generators
+  int maxExecLen = maxDelta*nbExec;
+  foreach(FunctionalBlock* block, generators) {    
+    int d = block->getDelta();
+    block->computeOutputPattern((maxExecLen+d-1)/d);
+  }
+  // compute output for top group
+  topGroup->computeOutputPattern();
+}
diff --git a/Graph.h b/Graph.h
index b2b807833e852a892d4384cf75abca5fda9c53dd..f3e9923ecacd6f391e86c4855c8b45f1266cedb9 100644 (file)
--- a/Graph.h
+++ b/Graph.h
@@ -52,6 +52,7 @@ public:
    */
   bool createPatterns();
   void resetPatternComputed();
+  bool computeOutputPatterns(int nbExec);
   
   
 private:  
index a8a06e641a7156b93de9de6ae52fbbaafb47b78e..474d5dc33afb4b59a68f02fab47ad5e4ed3118c3 100644 (file)
@@ -107,20 +107,29 @@ void GroupBlock::removeGenericParameter(QString name) {
 
 void GroupBlock::initInputPattern() {
   foreach(AbstractInterface* iface, getControlInputs()) {
-    iface->setOutputPattern(iface->getConnectedFrom()->getOutputPattern());    
+    ConnectedInterface* connIface = AI_TO_CON(iface);
+    connIface->setOutputPattern(connIface->getConnectedFrom()->getOutputPattern());    
   }  
 }
 
 bool GroupBlock::computeOutputPattern(int nbExec) {
+
+  static QString fctName = "GroupBlock::computeOutputPattern()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
+  cout << "computing output pattern of group " << qPrintable(name) << endl;
   
   bool canCompute = true;
   // get the input pattern on each inputs
   initInputPattern();
   
+  cout << "Input pattern OK" << endl;
   // find blocks that are connected to that inputs and generators
   QList<AbstractBlock*> fifo;
   foreach(AbstractBlock* block, blocks) {
-    
+        
     bool addIt = false;
     // if a block is a generator and has control outputs, add it
     if (block->isGeneratorBlock()) {
@@ -129,19 +138,27 @@ bool GroupBlock::computeOutputPattern(int nbExec) {
     else {
       // if the block has a control input connected from an intput of the group, add it too
       foreach(AbstractInterface* iface, block->getControlInputs()) {
-        ConnectedInterface* conn = (ConnectedInterface*)iface;
-        ConnectedInterface* groupIface = conn->getConnectionFromParentGroup();
-        if (groupIface != NULL) {
+        //cout << qPrintable(iface->getName()) << " of " << qPrintable(iface->getOwner()->getName()) << " connected to " << endl;       
+        ConnectedInterface* connFrom = ((ConnectedInterface*)iface)->getConnectedFrom();
+        //cout << qPrintable(connFrom->getName()) << " of " << qPrintable(connFrom->getOwner()->getName()) << endl;
+        
+        if (connFrom->getOwner() == this) {
           addIt = true;
           break;
         }
       }
     }
-    if (addIt) fifo.append(block);    
+    if (addIt) {
+      cout << "adding " << qPrintable(block->getName()) << " to initialize the FIFO" << endl;
+      fifo.append(block);    
+    }
   }
+  
   while (!fifo.isEmpty()) {
     AbstractBlock* block = fifo.takeFirst();
-    cout << "computing pattern for " << qPrintable(block->getName()) << endl;
+    
+    if (block->getPatternComputed()) continue; // block has laready been processed
+        
     canCompute = block->computeOutputPattern();
     if (!canCompute) {
       cout << "cannot finalize output pattern computation of " << qPrintable(block->getName()) << endl;
@@ -167,7 +184,8 @@ bool GroupBlock::computeOutputPattern(int nbExec) {
   
   if (canCompute) {
     foreach(AbstractInterface* iface, getControlOutputs()) {
-      iface->setOutputPattern(iface->getConnectedFrom()->getOutputPattern());    
+      ConnectedInterface* connIface = AI_TO_CON(iface);
+      connIface->setOutputPattern(connIface->getConnectedFrom()->getOutputPattern());    
     }
     setPatternComputed(true);
   }
index 547159ef52199424ed410fb72de7275c9be3fad1..593b8541bde4b74008387e7ea68c90f31969ceff 100644 (file)
@@ -42,6 +42,7 @@ public:
   // public attributes
   static int counter;
 
+  bool computeOutputPattern(int nbExec = -1);
   
 private:    
   // patterns  
@@ -52,7 +53,7 @@ private:
    * found by taking the output pattern of the connectedFrom interface.
    */   
   void initInputPattern();
-  bool computeOutputPattern(int nbExec = -1);
+  
   
   bool topGroup;  
   QList<AbstractBlock*> blocks; // contains instances of FunctionalBlock or GroupBlock that are children of this group
index 934ad08d693cc0805a4a8f0cb18706db4b28bb46..ecc6ba72ab6e9235ecc830ec16fa962ac8c1bc95 100644 (file)
@@ -41,7 +41,8 @@ bool GroupInterface::canConnectTo(AbstractInterface *iface) {
 
   */
   if (iface->isReferenceInterface()) return false;
-  if (iface->getConnectedFrom() != NULL) return false;
+  ConnectedInterface* connIface = AI_TO_CON(iface);
+  if (connIface->getConnectedFrom() != NULL) return false;
 
   if (this->getOwner() == iface->getOwner()->getParent()) {
     if ((direction == Input) && (iface->getDirection() == Input)) return true;
index 38d70ebc3bc44b30540fdbded7ee591adf584a3f..3286c14a9ae5e9d74863cab1c4f6e92ea7e05d40 100644 (file)
@@ -22,7 +22,7 @@ GroupItem::GroupItem(BoxItem *_parentItem,
 
   parentItem = _parentItem;
   if (parentItem != NULL) {
-    parentItem->setChildGroupItem(this);
+    parentItem->setChildGroupItem(this);    
   }
 
   /*
@@ -618,7 +618,7 @@ void GroupItem::load(QDomElement groupElement) throw(Exception) {
   if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
 
   QString nameStr = groupElement.attribute("name","none");
-  if(nameStr == "none") throw(Exception(PROJECTFILE_CORRUPTED));
+  if(nameStr == "none") throw(Exception(PROJECTFILE_CORRUPTED));    
 
   QStringList positionStr = groupElement.attribute("position","none").split(",");
   if(positionStr.length() != 2) throw(Exception(PROJECTFILE_CORRUPTED));
@@ -651,6 +651,10 @@ void GroupItem::load(QDomElement groupElement) throw(Exception) {
     QString name = currentInterfaceNode.attribute("name","none");
     if(name == "none") throw(Exception(PROJECTFILE_CORRUPTED));
 
+    QString purposeStr = currentInterfaceNode.attribute("purpose","none");
+    int purpose = AbstractInterface::getIntPurpose(purposeStr);
+    if(purpose == -1) throw(Exception(PROJECTFILE_CORRUPTED));
+    
     QString directionStr = currentInterfaceNode.attribute("direction","none");
     int direction = AbstractInterface::getIntDirection(directionStr);
     if(direction == -1) throw(Exception(PROJECTFILE_CORRUPTED));
@@ -661,13 +665,16 @@ void GroupItem::load(QDomElement groupElement) throw(Exception) {
 
     double position = currentInterfaceNode.attribute("position","none").toDouble(&ok);
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
-
-    GroupInterface *groupInterface = new GroupInterface(groupBlock,name,direction,AbstractInterface::Data);
-
-    InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupInterface,this,params);
+    
+    GroupInterface *groupIface = new GroupInterface(groupBlock,name,direction,purpose);
+    GroupInterface *groupCtlIface = new GroupInterface(groupBlock,name+"_enb",direction,AbstractInterface::Control);
+    groupCtlIface->setAssociatedIface(groupIface);
+    
+    InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupIface,this,params);
     interfaceItem->setId(id);
 
-    groupBlock->addInterface(groupInterface);
+    groupBlock->addInterface(groupIface);
+    groupBlock->addInterface(groupCtlIface);
     addInterfaceItem(interfaceItem, false);
     cout << "interface add to " << groupBlock->getName().toStdString() << endl;
   }
@@ -703,6 +710,7 @@ void GroupItem::save(QXmlStreamWriter &writer) {
 
     writer.writeAttribute("id",QString::number(item->getId()));
     writer.writeAttribute("name",item->getName());    
+    writer.writeAttribute("purpose",QString(item->refInter->getPurposeString()));    
     writer.writeAttribute("direction",QString(item->refInter->getDirectionString()));
     writer.writeAttribute("orientation",item->getStrOrientation());
     writer.writeAttribute("position",QString::number(item->getPositionRatio()));
index 7fddacd90a19894787f291f06bd1287014467b50..48de27e6ff76b81a85c5c035337ad98aa3169564 100644 (file)
@@ -61,6 +61,11 @@ QList<BoxItem *> GroupScene::getSelectedBlocks() {
 int GroupScene::setItemsId(int countInit) {
   int counter = countInit;
   groupItem->setId(counter++);
+  if (isTopScene()) {
+    foreach(SourceItem *item, sourceItems){
+      item->setId(counter++);
+    } 
+  }
   foreach(BoxItem *item, boxItems){
     item->setId(counter++);
   }
@@ -72,6 +77,13 @@ int GroupScene::setInterfacesId(int countInit) {
   foreach(InterfaceItem* inter, groupItem->getInterfaces()){
     inter->setId(counter++);
   }
+  if (isTopScene()) {
+    foreach(SourceItem *item, sourceItems){
+      foreach(InterfaceItem* inter, item->getInterfaces()){
+        inter->setId(counter++);
+      }
+    } 
+  }
   foreach(BoxItem *item, boxItems){
     foreach(InterfaceItem* inter, item->getInterfaces()){
       inter->setId(counter++);
@@ -129,6 +141,9 @@ SourceItem *GroupScene::createSourceItem(AbstractBlock *block) {
 }
 
 void GroupScene::addSourceItem(SourceItem* item) {  
+  // adding item to the scene
+  addItem(item);
+  item->setZValue(1);  
   // add item from the QList
   sourceItems.append(item);  
 }
index 0705632c241d51757658fd6768a23567f79e0607..318e5962e46a286f9ef8c7ddbd8f8c391f783264 100644 (file)
@@ -165,7 +165,7 @@ void GroupWidget::createToolbar() {
   toolbarEditMode->addWidget(butAddConnection);
   toolbarEditMode->addWidget(butEdit);
 
-  toolbarAdd->addAction(copyBlockAct);
+  //toolbarAdd->addAction(copyBlockAct);
   toolbarAdd->addAction(newEmptyGroupAct);
   toolbarAdd->addAction(newGroupAct);
 
index 4be284b68cb1d8d4b738f81f47bf92f1683ffe3b..877e9ac1a10f390ce21d3025f98b7276de5aa944 100644 (file)
@@ -373,7 +373,8 @@ void MainWindow::slotOpenBlockLibrary() {
 
 
 void MainWindow::slotGraphValidation() {
-  params->parametersValidation();
+  params->getGraph()->computeOutputPatterns(5);
+  //params->parametersValidation();
 }
 
 void MainWindow::addTopGroup(GroupWidget *_topGroup) {
index 3cc8c14aa33cae92dba77a39939c80de0d9b8b43..322046d562819e107c937856ef2536e2edf8ba31 100644 (file)
@@ -9,6 +9,7 @@
 #include "GroupScene.h"\r
 #include "GroupItem.h"\r
 #include "BoxItem.h"\r
+#include "SourceItem.h"\r
 #include "InterfaceItem.h"\r
 #include "ConnectionItem.h"\r
 \r
@@ -232,6 +233,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     if (idUpperScene != -1) {\r
       groupWidget->setWindowTitle(groupBlock->getName());\r
       groupWidget->show();\r
+      cout << qPrintable(groupItem->getRefBlock()->getName()) << " has upper box item in " << qPrintable(groupItem->getParentItem()->getScene()->getGroupItem()->getRefBlock()->getName()) << endl;\r
     }    \r
   }\r
   dispatcher->setSceneCounter(maxIdScene+1);\r
@@ -249,7 +251,29 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     GroupScene *currentScene = searchSceneById(idScene,topScene);\r
 \r
     if(currentScene == NULL) throw(Exception(PROJECTFILE_CORRUPTED));\r
-\r
+    /**********************************************************\r
+     2.1 : getting sources if it is top scene\r
+    ***********************************************************/\r
+    if (currentScene->isTopScene()) {\r
+      QDomNodeList sourceNodes = currentSceneNode.elementsByTagName("source_item");\r
+      cout << "top scene has " << sourceNodes.length() << " sources" << endl;\r
+      for(int j=0; j<sourceNodes.length(); j++) {\r
+        QDomElement currentSBNode = sourceNodes.at(j).toElement();      \r
+        SourceItem* sourceItem = new SourceItem(dispatcher,this);\r
+        try {\r
+          sourceItem->load(currentSBNode);\r
+        }\r
+        catch(Exception err) {\r
+          throw(err);\r
+        }\r
+        cout << "source item has been read, add it to the scene" << endl;\r
+        // add the block to the GroupScene\r
+        currentScene->addSourceItem(sourceItem);\r
+      } \r
+    }\r
+    /**********************************************************\r
+     2.2 : getting functional blocks\r
+    ***********************************************************/\r
     QDomNodeList functionalBlockNodes = currentSceneNode.elementsByTagName("bi_functional");\r
 \r
     for(int j=0; j<functionalBlockNodes.length(); j++) {\r
@@ -306,7 +330,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
       // get the GroupItem already created and set at phase 1\r
       GroupItem *insideGroup = searchGroupItemById(idGroup, topScene);\r
       BoxItem* upperItem = NULL;\r
-      if(insideGroup == NULL) cout << "group null" << endl;\r
+      if(insideGroup == NULL) cout << "group null" << endl;      \r
       // now search within the scene which BoxItem has a childItem that is = to insideGroup\r
       QList<BoxItem *> lst = currentScene->getBoxItems();\r
       foreach(BoxItem* item, lst) {\r
@@ -1022,6 +1046,15 @@ InterfaceItem* Parameters::searchInterfaceItemById(int id, GroupScene* scene) {
       return item;\r
     }\r
   }\r
+  if (scene->isTopScene()) {\r
+    foreach(SourceItem *block, scene->getSourceItems()){\r
+      foreach(InterfaceItem *item, block->getInterfaces()){\r
+        if(item->getId() == id){\r
+          return item;\r
+        }\r
+      }\r
+    } \r
+  }\r
   foreach(BoxItem *block, scene->getBoxItems()){\r
     foreach(InterfaceItem *item, block->getInterfaces()){\r
       if(item->getId() == id){\r
index 182460df471d9474427d599f4f715a33ba1137d4..ee988802aeb465c402bd817a967e94eee93222c1 100644 (file)
@@ -60,8 +60,7 @@ void ParametersWindow::updateData()
   type->setText(param->getTypeString());
 }
 
-void ParametersWindow::save()
-{
+void ParametersWindow::save() {
   BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
   param->setValue(value->text());  
 
index 9ea4b23a054f9633c02cdc23a9fbaedf2156a6f1..d5219b625f8875d30c50f4efa748b4cb07f3bb48 100644 (file)
@@ -22,8 +22,7 @@ public :
   ReferenceInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _multiplicity=1) throw (Exception);
 
   // getters
-  inline int getMultiplicity() { return multiplicity; }
-  inline AbstractInterface* getConnectedFrom() { return NULL; }
+  inline int getMultiplicity() { return multiplicity; }  
   // setters
   void setMultiplicity(int _multiplicity);
 
index 27db2a33eea2686df69e493cf2d4d2068b3831ee..ca252c1bde1c4b09a49c8fee051aba8d9bb9fd51 100644 (file)
@@ -603,10 +603,9 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) {
   else {
     reference = referenceMd5;
   }
-  
-  GroupBlock* parentGroupBlock = AB_TO_GRP(((GroupItem *)parentItem())->getRefBlock());
-  FunctionalBlock* functionalBlock = params->getGraph()->createFunctionalBlock(parentGroupBlock, reference);
-  /* NB: addFunctionalBlock creates all interfaces from the reference, which is annoying when
+    
+  FunctionalBlock* functionalBlock = params->getGraph()->createSourceBlock(reference);
+  /* NB: createSourceBlock creates all interfaces from the reference, which is annoying when
     reading bif_iface tags. Thus interface are all removed.
   */
   functionalBlock->setName(name);
@@ -617,7 +616,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) {
   setId(id);
 
 
-  QDomNodeList blockParamNodes = funcElement.elementsByTagName("bif_parameter");
+  QDomNodeList blockParamNodes = funcElement.elementsByTagName("source_parameter");
   // setting parameters value
   for(int i=0; i<blockParamNodes.length(); i++){
     QDomElement currentBlockParamNode = blockParamNodes.at(i).toElement();
@@ -636,7 +635,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) {
 
   // recreate all (non-control) interfaces because of some may have a multiplicity>1 with several examplars
   functionalBlock->removeAllInterfaces();
-  QDomNodeList interfaceNodes = funcElement.elementsByTagName("bif_iface");
+  QDomNodeList interfaceNodes = funcElement.elementsByTagName("source_iface");
   // setting interfaces (user name, and for multiplicity>1 may be create some new ones)
   for(int i=0; i<interfaceNodes.length(); i++) {
 
index a4cb21ce96f379098962fea5345b2e060dff317d..d2134784690d8064acf451969686a4ba6b67d3de 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2017-05-12T16:46:10. -->
+<!-- Written by QtCreator 3.2.1, 2017-05-14T21:44:23. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
-  <value type="QByteArray">{1d077e47-e3a1-47fd-8b12-4de650e39df5}</value>
+  <value type="QByteArray">{c8006d66-d34f-42be-ad10-d0207752286d}</value>
  </data>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
   <valuemap type="QVariantMap">
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
-   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{451ee8a3-56ff-4aba-8a8e-3da882cc142e}</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2c9bf876-3476-44eb-8065-1f0844704dda}</value>
    <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
-    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/localhome/sdomas/Projet/Blast/code/blast</value>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/sdomas/Projet/Blast/code/blast</value>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
      <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
       <valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
index de874d1dddec290d90d3740805943101b1fbeb0b..4c1457d621aa5fe9a037ea4b103d9a565567e512 100644 (file)
   <patterns>
     <delta value="$nb_data" />
     <consumption>
-      <input name="data_i" pattern="(1){$nb_data}" />
+      <input name="data_i_enb" pattern="1{$nb_data}" />
     </consumption>
-    <production counter="{2:$nb_data+2:1}">
-      <output name="data_o" pattern="00{$nb_data}" />
+    <production counter="{2:$nb_data:1}">
+      <output name="data_o_enb" pattern="0001{$nb_data}" />
     </production>
   </patterns>
 </block_impl>
diff --git a/lib/implementations/decimator-N_impl.xml b/lib/implementations/decimator-N_impl.xml
new file mode 100644 (file)
index 0000000..f68c396
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<block_impl ref_name="decimator-N.xml" ref_md5="">
+  <comments>
+    <author firstname="stephane" lastname="Domas" mail="sdomas@univ-fcomte.fr" />
+    <date creation="2015-04-27" />
+    <related_files list=""/>
+    <description>
+      This component is a decimator of N-1 values out of N
+    </description>
+    <notes>
+      No notes
+    </notes>
+  </comments>
+
+  <libraries>
+    <library name="IEEE">
+      <package name="std_logic_1164" use="all"/>
+      <package name="numeric_std" use="all"/>
+    </library>
+  </libraries>
+
+  <architecture>
+    
+  </architecture>
+
+  <patterns>
+    <delta value="$nb_deci+1" />
+    <consumption>
+      <input name="data_i_enb" pattern="1{$nb_deci+1}" />
+    </consumption>
+    <production counter="1">
+      <output name="data_o_enb" pattern="010{$nb_deci}" />
+    </production>
+  </patterns>
+</block_impl>
index 10b42998bbe469ad88338e24baba65f86a08919f..0c94e162f924a0039696a10c4ab73a00dd981388 100644 (file)
@@ -28,7 +28,7 @@
     <consumption>
     </consumption>
     <production counter="">
-      <output name="data_o" pattern="1{$seq_length}X{$idle_length}" />
+      <output name="data_o_enb" pattern="1{$seq_length}X{$idle_length}" />
     </production>
   </patterns>
 </block_impl>
diff --git a/lib/implementations/generator-img_impl.xml b/lib/implementations/generator-img_impl.xml
new file mode 100644 (file)
index 0000000..d5f66f3
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<block_impl ref_name="generator-img.xml" ref_md5="">
+  <comments>
+    <author firstname="stephane" lastname="Domas" mail="sdomas@univ-fcomte.fr" />
+    <date creation="2015-05-10" />
+    <related_files list=""/>
+    <description>
+      This component is a generator of a RGB image, read in a CSV file
+    </description>
+    <notes>
+      No notes
+    </notes>
+  </comments>
+
+  <libraries>
+    <library name="IEEE">
+      <package name="std_logic_1164" use="all"/>
+      <package name="numeric_std" use="all"/>
+    </library>
+  </libraries>
+
+  <architecture>
+    
+  </architecture>
+
+  <patterns>
+    <delta value="($img_width+$row_idle)*$img_height" />
+    <consumption>
+    </consumption>
+    <production counter="1">
+      <output name="r_o_enb" pattern="(1{$img_width}0{$row_idle}){$img_height}" />
+      <output name="g_o_enb" pattern="(1{$img_width}0{$row_idle}){$img_height}" />
+      <output name="b_o_enb" pattern="(1{$img_width}0{$row_idle}){$img_height}" />
+    </production>
+  </patterns>
+</block_impl>
index 15dfac4ea57ccf0c25326ec2f4d067d82a1d427a..d43a935111c63cb5fee4e6a04d0c141242216977 100644 (file)
Binary files a/lib/implementations/impls.bmf and b/lib/implementations/impls.bmf differ
diff --git a/lib/implementations/rgb216bits_impl.xml b/lib/implementations/rgb216bits_impl.xml
new file mode 100644 (file)
index 0000000..d5203d5
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<block_impl ref_name="rgb216bits.xml" ref_md5="">
+  <comments>
+    <author firstname="stephane" lastname="Domas" mail="sdomas@univ-fcomte.fr" />
+    <date creation="2015-04-27" />
+    <related_files list=""/>
+    <description>
+      This component converts a RGB pixel into a 16 bits pixel
+    </description>
+    <notes>
+      No notes
+    </notes>
+  </comments>
+
+  <libraries>
+    <library name="IEEE">
+      <package name="std_logic_1164" use="all"/>
+      <package name="numeric_std" use="all"/>
+    </library>
+  </libraries>
+
+  <architecture>
+    
+  </architecture>
+
+  <patterns>
+    <delta value="1" />
+    <consumption>
+      <input name="r_i_enb" pattern="1" />
+      <input name="g_i_enb" pattern="1" />
+      <input name="b_i_enb" pattern="1" />      
+    </consumption>
+    <production counter="1">
+      <output name="pix_o_enb" pattern="01" />
+    </production>
+  </patterns>
+</block_impl>
diff --git a/lib/implementations/scatter_impl.xml b/lib/implementations/scatter_impl.xml
new file mode 100644 (file)
index 0000000..e214f6a
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<block_impl ref_name="scatter.xml" ref_md5="">
+  <comments>
+    <author firstname="stephane" lastname="Domas" mail="sdomas@univ-fcomte.fr" />
+    <date creation="2015-04-27" />
+    <related_files list=""/>
+    <description>
+      This component scatters an input over X outputs
+    </description>
+    <notes>
+      No notes
+    </notes>
+  </comments>
+
+  <libraries>
+    <library name="IEEE">
+      <package name="std_logic_1164" use="all"/>
+      <package name="numeric_std" use="all"/>
+    </library>
+  </libraries>
+
+  <architecture>   
+  </architecture>
+
+  <patterns>
+    <delta value="1" />
+    <consumption>
+      <input name="data_i_enb" pattern="1" />
+    </consumption>
+    <production counter="1">
+      <output name="data_o_enb" pattern="01" />
+    </production>
+  </patterns>
+
+</block_impl>
index 063ec2a3cb20f116dc244df413e945388b780b7f..24e96a3c9dac2c27afbbec81bb51478cec0ec872 100644 (file)
@@ -16,8 +16,8 @@
   </informations>\r
 \r
   <parameters>\r
-    <parameter name="data_width" type="string" value="0" context="user"/>\r
-    <parameter name="nb_data" type="string" value="20" context="user"/>\r
+    <parameter name="data_width" type="positive" value="8" context="user"/>\r
+    <parameter name="nb_data" type="positive" value="10" context="user"/>\r
   </parameters>\r
 \r
   <interfaces>\r
diff --git a/lib/references/decimator-N.xml b/lib/references/decimator-N.xml
new file mode 100644 (file)
index 0000000..b008aa2
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\r
+<block>\r
+  <informations>\r
+    <name>\r
+      parametrized deicmator\r
+    </name>\r
+    <category ids="4" />  \r
+    <description>\r
+      <brief>\r
+       This block does a decimation of N-1 inputs overs N\r
+      </brief>\r
+      <detailed>\r
+       This block does a decimation of N-1 inputs overs N\r
+      </detailed>     \r
+    </description>    \r
+  </informations>\r
+\r
+  <parameters>\r
+    <parameter name="data_width" type="positive" value="8" context="user"/>\r
+    <parameter name="nb_deci" type="positive" value="1" context="user"/>\r
+  </parameters>\r
+\r
+  <interfaces>\r
+    <inputs>\r
+      <input name="clk" type="boolean" width="1" purpose="clock" />\r
+      <input name="rst" type="boolean" width="1" purpose="reset" />\r
+      <input name="data_i" type="expression" width="$data_width" />\r
+      <control iface="data_i" />\r
+    </inputs>\r
+    <outputs>\r
+      <output name="data_o" type="expression" width="$data_width" multiplicity="1"/>\r
+      <control iface="data_o" />\r
+    </outputs>    \r
+  </interfaces>\r
+\r
+</block>\r
index d67b7ca79a16207ab53c9567632514edc39141de..8522dd165e3582b148e589174d341d8a891c8c60 100644 (file)
@@ -19,6 +19,7 @@
     <parameter name="data_width" type="positive" value="8" context="user"/>
     <parameter name="seq_length" type="positive" value="10" context="user"/>
     <parameter name="idle_length" type="positive" value="5" context="user"/>
+    <parameter name="fixed_value" type="integer" value="666" context="user"/>
   </parameters>
 
   <interfaces>
diff --git a/lib/references/generator-img.xml b/lib/references/generator-img.xml
new file mode 100644 (file)
index 0000000..55a5cee
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<block>
+  <informations>
+    <name>
+      generator-img
+    </name>
+    <category ids="6" />  
+    <description>
+      <brief>
+       generates a RGB image, reading if from a csv file
+      </brief>
+      <detailed>
+       generates a RGB image, reading if from a csv file
+      </detailed>     
+    </description>    
+  </informations>
+
+  <parameters>
+    <parameter name="img_file" type="string" value="nofile.csv" context="user"/>
+    <parameter name="img_width" type="positive" value="8" context="user"/>
+    <parameter name="img_height" type="positive" value="8" context="user"/>
+    <parameter name="row_idle" type="natural" value="2" context="user"/>
+  </parameters>
+
+  <interfaces>
+    <inputs>
+      <input name="clk" width="1" purpose="clock" />
+      <input name="rst" width="1" purpose="reset" />
+    </inputs>
+    <outputs>
+      <output name="r_o" width="8"/>
+      <output name="g_o" width="8"/>
+      <output name="b_o" width="8"/>      
+      <control iface="r_o"/>
+      <control iface="g_o"/>
+      <control iface="b_o"/>
+    </outputs>
+  </interfaces>
+
+</block>
index 60ea24991a6600f046e574563d7088b2a29e4a9e..8ec55062480d44714e46938ae771bd122d6cc2e1 100644 (file)
Binary files a/lib/references/references.bmf and b/lib/references/references.bmf differ
diff --git a/lib/references/rgb216bits.xml b/lib/references/rgb216bits.xml
new file mode 100644 (file)
index 0000000..6898880
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\r
+<block>\r
+  <informations>\r
+    <name>\r
+      RGB to 16 bits\r
+    </name>\r
+    <category ids="4" />  \r
+    <description>\r
+      <brief>\r
+       This block does a conversion of an RGB pixel into a 16 bits value\r
+      </brief>\r
+      <detailed>\r
+       This block does a conversion of an RGB pixel into a 16 bits value       \r
+      </detailed>     \r
+    </description>    \r
+  </informations>\r
+\r
+  <parameters>\r
+  </parameters>\r
+\r
+  <interfaces>\r
+    <inputs>\r
+      <input name="clk" type="boolean" width="1" purpose="clock" />\r
+      <input name="rst" type="boolean" width="1" purpose="reset" />\r
+      <input name="r_i" type="natural" width="8" />\r
+      <input name="g_i" type="natural" width="8" />\r
+      <input name="b_i" type="natural" width="8" />      \r
+      <control iface="r_i" />\r
+      <control iface="g_i" />\r
+      <control iface="b_i" />      \r
+    </inputs>\r
+    <outputs>\r
+      <output name="pix_o" type="natural" width="16" multiplicity="1"/>\r
+      <control iface="pix_o" />\r
+    </outputs>    \r
+  </interfaces>\r
+\r
+</block>\r
diff --git a/lib/references/scatter.xml b/lib/references/scatter.xml
new file mode 100644 (file)
index 0000000..ce9e2ef
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\r
+<block>\r
+  <informations>\r
+    <name>\r
+      scatter\r
+    </name>\r
+    <category ids="1,5" />  \r
+    <description>\r
+      <brief>\r
+       This block replicates the input over X outputs, the outputs being created at will.\r
+      </brief>\r
+      <detailed>\r
+       This block replicates the input over X outputs, the outputs being created at will.\r
+      </detailed>     \r
+    </description>    \r
+  </informations>\r
+\r
+  <parameters>\r
+    <parameter name="data_width" type="positive" value="16" context="user"/>\r
+  </parameters>\r
+\r
+  <interfaces>\r
+    <inputs>\r
+      <input name="clk" type="boolean" width="1" purpose="clock" />\r
+      <input name="rst" type="boolean" width="1" purpose="reset" />      \r
+      <input name="data_i" type="expression" width="$data_width" />\r
+      <control iface="data_i" />\r
+    </inputs>\r
+    <outputs>\r
+      <output name="data_o" type="expression" width="$data_width" multiplicity="*"/>\r
+      <control iface="data_o" />\r
+    </outputs>    \r
+  </interfaces>\r
+\r
+</block>\r
index 8fdab46ca82a675ecc0f801542c79d57c90468fa..811beb2df2235a2e3770ce5b96f6c47430a43c95 100644 (file)
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
 
-    <!-- déclaration des groupes d'attributs -->
-
-    <xs:attributeGroup name="group_itemAttrGroup">
-       <xs:attribute ref="id"/>
-       <xs:attribute ref="name"/>
-       <xs:attribute ref="upper_group"/>
-       <xs:attribute ref="upper_item"/>
-       <xs:attribute ref="position"/>
-       <xs:attribute ref="dimension"/>
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="group_ifaceAttrGroup">
-       <xs:attribute ref="id"/>
-       <xs:attribute ref="name"/>
-       <xs:attribute ref="direction"/>
-       <xs:attribute ref="orientation"/>
-       <xs:attribute ref="position"/>
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="block_itemsAttrGroup">
-       <xs:attribute ref="functional_count" />
-       <xs:attribute ref="group_count" />
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="bi_functionalAttrGroup">
-       <xs:attribute ref="id" />
-       <xs:attribute ref="ref_xml" />
-       <xs:attribute ref="ref_md5" />
-       <xs:attribute ref="name" />
-       <xs:attribute ref="position" />
-       <xs:attribute ref="dimension" />
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="bif_parameterAttrGroup">
-       <xs:attribute ref="name" />
-       <xs:attribute ref="value" />
-       <xs:attribute ref="context" />
-       <xs:attribute ref="type" />
-
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="bif_ifaceAttrGroup">
-       <xs:attribute ref="id" />
-       <xs:attribute ref="name" />
-       <xs:attribute ref="ref_name" />
-       <xs:attribute ref="orientation" />
-       <xs:attribute ref="position" />
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="bi_groupAttrGroup">
-       <xs:attribute ref="id" />
-       <xs:attribute ref="inside_group" />
-       <xs:attribute ref="position" />
-       <xs:attribute ref="dimension" />
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="big_ifaceAttrGroup">
-       <xs:attribute ref="id" />
-       <xs:attribute ref="ref_name" />
-       <xs:attribute ref="orientation" />
-       <xs:attribute ref="position" />
-    </xs:attributeGroup>
-
-    <xs:attributeGroup name="connectionAttrGroup">
-       <xs:attribute ref="from" />
-       <xs:attribute ref="to" />
-    </xs:attributeGroup>
-
-
-    <!-- déclaration des attributs -->
-
-    <xs:attribute name="count">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="id">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="upper_scene">
-       <xs:simpleType>
-           <xs:restriction base="xs:integer">
-               <xs:minInclusive value="-1"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="upper_group">
-       <xs:simpleType>
-           <xs:restriction base="xs:integer">
-               <xs:minInclusive value="-1"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="upper_item">
-       <xs:simpleType>
-           <xs:restriction base="xs:integer">
-               <xs:minInclusive value="-1"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="inside_group">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="functional_count">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="group_count">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="value" type="xs:string"/>
-
-    <xs:attribute name="from">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="to">
-       <xs:simpleType>
-           <xs:restriction base="xs:nonNegativeInteger">
-               <xs:minInclusive value="0"/>
-           </xs:restriction>
-       </xs:simpleType>
-    </xs:attribute>
-
-    <xs:attribute name="position" type="xs:string"/>
-    <xs:attribute name="dimension" type="xs:string"/>
-    <xs:attribute name="direction" type="xs:string"/>
-    <xs:attribute name="orientation" type="xs:string"/>
-    <xs:attribute name="name" type="xs:string"/>
-    <xs:attribute name="ref_name" type="xs:string"/>
-    <xs:attribute name="ref_xml" type="xs:string"/>
-    <xs:attribute name="ref_md5" type="xs:string"/>
-    <xs:attribute name="context" type="xs:string"/>
-    <xs:attribute name="type" type="xs:string"/>
-
-
-    <!-- déclaration des groupes d'éléments -->
-
-    <xs:group name="rootElmtGroup">
-       <xs:sequence>
-           <xs:element ref="scenes"/>
-           <xs:element ref="connections"/>     
-       </xs:sequence>
-    </xs:group>
-
-    <xs:group name="sceneElmtGroup">
-       <xs:sequence>
-           <xs:element ref="group_item"/>
-           <xs:element ref="block_items"/>
-       </xs:sequence>
-    </xs:group>
-
-    <xs:group name="block_itemsElmtGroup">
+  <!-- déclaration des groupes d'attributs -->
+
+  <xs:attributeGroup name="group_itemAttrGroup">
+    <xs:attribute ref="id"/>
+    <xs:attribute ref="name"/>
+    <xs:attribute ref="upper_group"/>
+    <xs:attribute ref="upper_item"/>
+    <xs:attribute ref="position"/>
+    <xs:attribute ref="dimension"/>
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="group_ifaceAttrGroup">
+    <xs:attribute ref="id"/>
+    <xs:attribute ref="name"/>
+    <xs:attribute ref="purpose"/>
+    <xs:attribute ref="direction"/>
+    <xs:attribute ref="orientation"/>
+    <xs:attribute ref="position"/>
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="source_itemsAttrGroup">
+    <xs:attribute ref="count" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="block_itemsAttrGroup">
+    <xs:attribute ref="functional_count" />
+    <xs:attribute ref="group_count" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="source_itemAttrGroup">
+    <xs:attribute ref="id" />
+    <xs:attribute ref="ref_xml" />
+    <xs:attribute ref="ref_md5" />
+    <xs:attribute ref="name" />
+    <xs:attribute ref="position" />
+    <xs:attribute ref="dimension" />
+  </xs:attributeGroup>
+  
+  <xs:attributeGroup name="bi_functionalAttrGroup">
+    <xs:attribute ref="id" />
+    <xs:attribute ref="ref_xml" />
+    <xs:attribute ref="ref_md5" />
+    <xs:attribute ref="name" />
+    <xs:attribute ref="position" />
+    <xs:attribute ref="dimension" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="source_parameterAttrGroup">
+    <xs:attribute ref="name" />
+    <xs:attribute ref="value" />
+    <xs:attribute ref="context" />
+    <xs:attribute ref="type" />
+  </xs:attributeGroup>
+  
+  <xs:attributeGroup name="bif_parameterAttrGroup">
+    <xs:attribute ref="name" />
+    <xs:attribute ref="value" />
+    <xs:attribute ref="context" />
+    <xs:attribute ref="type" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="source_ifaceAttrGroup">
+    <xs:attribute ref="id" />
+    <xs:attribute ref="name" />
+    <xs:attribute ref="ref_name" />
+    <xs:attribute ref="orientation" />
+    <xs:attribute ref="position" />
+  </xs:attributeGroup>
+  
+  <xs:attributeGroup name="bif_ifaceAttrGroup">
+    <xs:attribute ref="id" />
+    <xs:attribute ref="name" />
+    <xs:attribute ref="ref_name" />
+    <xs:attribute ref="orientation" />
+    <xs:attribute ref="position" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="bi_groupAttrGroup">
+    <xs:attribute ref="id" />
+    <xs:attribute ref="inside_group" />
+    <xs:attribute ref="position" />
+    <xs:attribute ref="dimension" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="big_ifaceAttrGroup">
+    <xs:attribute ref="id" />
+    <xs:attribute ref="ref_name" />
+    <xs:attribute ref="orientation" />
+    <xs:attribute ref="position" />
+  </xs:attributeGroup>
+
+  <xs:attributeGroup name="connectionAttrGroup">
+    <xs:attribute ref="from" />
+    <xs:attribute ref="to" />
+  </xs:attributeGroup>
+
+
+  <!-- déclaration des attributs -->
+
+  <xs:attribute name="count">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="id">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="upper_scene">
+    <xs:simpleType>
+      <xs:restriction base="xs:integer">
+       <xs:minInclusive value="-1"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="upper_group">
+    <xs:simpleType>
+      <xs:restriction base="xs:integer">
+       <xs:minInclusive value="-1"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="upper_item">
+    <xs:simpleType>
+      <xs:restriction base="xs:integer">
+       <xs:minInclusive value="-1"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="inside_group">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="functional_count">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="group_count">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="value" type="xs:string"/>
+
+  <xs:attribute name="from">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="to">
+    <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:minInclusive value="0"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="purpose">
+    <xs:simpleType>
+      <xs:restriction base="xs:string">
+       <xs:enumeration value="data"/>
+       <xs:enumeration value="clock"/>
+       <xs:enumeration value="reset"/>
+       <xs:enumeration value="wishbone"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+  
+  <xs:attribute name="direction">
+    <xs:simpleType>
+      <xs:restriction base="xs:string">
+       <xs:enumeration value="input"/>
+       <xs:enumeration value="output"/>
+       <xs:enumeration value="inout"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+
+  <xs:attribute name="orientation">
+    <xs:simpleType>
+      <xs:restriction base="xs:string">
+      <xs:enumeration value="west"/>
+      <xs:enumeration value="east"/>
+      <xs:enumeration value="north"/>
+      <xs:enumeration value="south"/>
+      </xs:restriction>
+    </xs:simpleType>
+  </xs:attribute>
+  
+  <xs:attribute name="position" type="xs:string"/>
+  <xs:attribute name="dimension" type="xs:string"/>
+  <xs:attribute name="name" type="xs:string"/>
+  <xs:attribute name="ref_name" type="xs:string"/>
+  <xs:attribute name="ref_xml" type="xs:string"/>
+  <xs:attribute name="ref_md5" type="xs:string"/>
+  <xs:attribute name="context" type="xs:string"/>
+  <xs:attribute name="type" type="xs:string"/>
+
+
+  <!-- déclaration des groupes d'éléments -->
+
+  <xs:group name="rootElmtGroup">
+    <xs:sequence>
+      <xs:element ref="scenes"/>
+      <xs:element ref="connections"/>  
+    </xs:sequence>
+  </xs:group>
+
+  <xs:group name="sceneElmtGroup">
+    <xs:sequence>
+      <xs:element ref="group_item"/>
+      <xs:element ref="source_items" minOccurs="0" maxOccurs="unbounded"/>       
+      <xs:element ref="block_items"/>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:group name="source_itemsElmtGroup">
+    <xs:sequence>
+      <xs:element ref="source_item" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:group>
+  
+  <xs:group name="block_itemsElmtGroup">
+    <xs:sequence>
+      <xs:element ref="bi_functional" minOccurs="0" maxOccurs="unbounded"/>
+      <xs:element ref="bi_group" minOccurs="0" maxOccurs="unbounded"/>      
+    </xs:sequence>
+  </xs:group>
+
+  <xs:group name="source_itemElmtGroup">
+    <xs:sequence>
+      <xs:element ref="source_parameters"/>
+      <xs:element ref="source_ifaces"/>
+    </xs:sequence>
+  </xs:group>
+  
+  <xs:group name="bi_functionalElmtGroup">
+    <xs:sequence>
+      <xs:element ref="bif_parameters"/>
+      <xs:element ref="bif_ifaces"/>
+    </xs:sequence>
+  </xs:group>
+
+
+  <!-- déclaration des éléments -->
+
+  <xs:element name="scenes">
+    <xs:complexType>
       <xs:sequence>
-       <xs:element ref="bi_group" minOccurs="0" maxOccurs="unbounded"/>
-       <xs:element ref="bi_functional" minOccurs="0" maxOccurs="unbounded"/>
-       </xs:sequence>
-    </xs:group>
-
-    <xs:group name="bi_functionalElmtGroup">
-       <xs:sequence>
-           <xs:element ref="bif_parameters"/>
-           <xs:element ref="bif_ifaces"/>
-       </xs:sequence>
-    </xs:group>
-
-
-    <!-- déclaration des éléments -->
-
-    <xs:element name="scenes">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="scene" maxOccurs="unbounded" />
-           </xs:sequence>
-           <xs:attribute ref="count"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="scene">
-       <xs:complexType>
-           <xs:group ref="sceneElmtGroup"/>
-           <xs:attribute ref="id"/>
-           <xs:attribute ref="upper_scene"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="group_item">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="group_ifaces" maxOccurs="unbounded" />
-           </xs:sequence>      
-           <xs:attributeGroup ref="group_itemAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="group_ifaces">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="group_iface" minOccurs="0" maxOccurs="unbounded"/>
-           </xs:sequence>
-           <xs:attribute ref="count"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="group_iface">
-       <xs:complexType>
-           <xs:attributeGroup ref="group_ifaceAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="block_items">
-       <xs:complexType>
-           <xs:group ref="block_itemsElmtGroup"/>
-           <xs:attributeGroup ref="block_itemsAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="bi_functional">
-       <xs:complexType>
-           <xs:group ref="bi_functionalElmtGroup"/>
-           <xs:attributeGroup ref="bi_functionalAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="bif_parameters">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="bif_parameter" minOccurs="0" maxOccurs="unbounded" />
-           </xs:sequence>
-       </xs:complexType>
-    </xs:element>
-       
-    <xs:element name="bif_parameter">
-       <xs:complexType>
-           <xs:attributeGroup ref="bif_parameterAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="bif_ifaces">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="bif_iface" minOccurs="0" maxOccurs="unbounded" />
-           </xs:sequence>
-           <xs:attribute ref="count"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="bif_iface">
-       <xs:complexType>
-           <xs:attributeGroup ref="bif_ifaceAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="bi_group">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="big_ifaces"/>
-           </xs:sequence>
-           <xs:attributeGroup ref="bi_groupAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="big_ifaces">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="big_iface" minOccurs="0" maxOccurs="unbounded" />
-           </xs:sequence>
-           <xs:attribute ref="count" />
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="big_iface">
-       <xs:complexType>
-           <xs:attributeGroup ref="big_ifaceAttrGroup" />
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="connections">
-       <xs:complexType>
-           <xs:sequence>
-               <xs:element ref="connection" minOccurs="0" maxOccurs="unbounded"/>
-           </xs:sequence>
-           <xs:attribute ref="count" />
-       </xs:complexType>
-    </xs:element>
-
-    <xs:element name="connection">
-       <xs:complexType>
-           <xs:attributeGroup ref="connectionAttrGroup"/>
-       </xs:complexType>
-    </xs:element>
-
-    <!-- racine du document -->
-
-    <xs:element name="blast_project">
-       <xs:complexType>
-           <xs:group ref="rootElmtGroup"/>
-       </xs:complexType>
-    </xs:element>
+       <xs:element ref="scene" maxOccurs="unbounded" />
+      </xs:sequence>
+      <xs:attribute ref="count"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="scene">
+    <xs:complexType>
+      <xs:group ref="sceneElmtGroup"/>
+      <xs:attribute ref="id"/>
+      <xs:attribute ref="upper_scene"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="group_item">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="group_ifaces" maxOccurs="unbounded" />
+      </xs:sequence>   
+      <xs:attributeGroup ref="group_itemAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="group_ifaces">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="group_iface" minOccurs="0" maxOccurs="unbounded"/>
+      </xs:sequence>
+      <xs:attribute ref="count"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="group_iface">
+    <xs:complexType>
+      <xs:attributeGroup ref="group_ifaceAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="source_items">
+    <xs:complexType>
+      <xs:group ref="source_itemsElmtGroup"/>
+      <xs:attributeGroup ref="source_itemsAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="block_items">
+    <xs:complexType>
+      <xs:group ref="block_itemsElmtGroup"/>
+      <xs:attributeGroup ref="block_itemsAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="source_item">
+    <xs:complexType>
+      <xs:group ref="source_itemElmtGroup"/>
+      <xs:attributeGroup ref="source_itemAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="bi_functional">
+    <xs:complexType>
+      <xs:group ref="bi_functionalElmtGroup"/>
+      <xs:attributeGroup ref="bi_functionalAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="source_parameters">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="source_parameter" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="source_parameter">
+    <xs:complexType>
+      <xs:attributeGroup ref="source_parameterAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="bif_parameters">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="bif_parameter" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="bif_parameter">
+    <xs:complexType>
+      <xs:attributeGroup ref="bif_parameterAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="source_ifaces">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="source_iface" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+      <xs:attribute ref="count"/>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="source_iface">
+    <xs:complexType>
+      <xs:attributeGroup ref="source_ifaceAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="bif_ifaces">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="bif_iface" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+      <xs:attribute ref="count"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="bif_iface">
+    <xs:complexType>
+      <xs:attributeGroup ref="bif_ifaceAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="bi_group">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="big_ifaces"/>
+      </xs:sequence>
+      <xs:attributeGroup ref="bi_groupAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="big_ifaces">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="big_iface" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+      <xs:attribute ref="count" />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="big_iface">
+    <xs:complexType>
+      <xs:attributeGroup ref="big_ifaceAttrGroup" />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="connections">
+    <xs:complexType>
+      <xs:sequence>
+       <xs:element ref="connection" minOccurs="0" maxOccurs="unbounded"/>
+      </xs:sequence>
+      <xs:attribute ref="count" />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="connection">
+    <xs:complexType>
+      <xs:attributeGroup ref="connectionAttrGroup"/>
+    </xs:complexType>
+  </xs:element>
+
+  <!-- racine du document -->
+
+  <xs:element name="blast_project">
+    <xs:complexType>
+      <xs:group ref="rootElmtGroup"/>
+    </xs:complexType>
+  </xs:element>
 
 </xs:schema>
index 3fa3faaf4f4119ea85c2e356272e8a62f3ea2040..b219bfaf9aace74b4fee2c01b121388e691ccc6e 100644 (file)
@@ -4,8 +4,8 @@
     <!-- déclaration des groupes d'attributs -->
 
     <xs:attributeGroup name="parameterAttrGroup">
-       <xs:attribute ref="name" use="required"/>
-       <xs:attribute ref="type" use="required"/>
+      <xs:attribute ref="name" use="required"/>
+       <xs:attribute name="type" type="typeparam" use="required"/>
        <xs:attribute ref="wishbone" use="optional"/>
        <xs:attribute ref="value" use="optional"/>
        <xs:attribute ref="iface" use="optional"/>
@@ -16,7 +16,7 @@
     <xs:attributeGroup name="inOutAttrGroup">
        <xs:attribute ref="name" use="required"/>
        <xs:attribute ref="width" use="required"/>
-       <xs:attribute ref="type"/>
+       <xs:attribute name="type" type="typeiface"/>
        <xs:attribute ref="purpose"/>
        <xs:attribute ref="multiplicity"/>
     </xs:attributeGroup>
 
     <xs:attribute name="ids" type="xs:string"/>
     <xs:attribute name="name" type="xs:string"/>
-    <xs:attribute name="type" type="xs:string"/>
+
+    <xs:simpleType name="typeparam">
+      <xs:restriction base="xs:string">
+       <xs:enumeration value="string"/>
+       <xs:enumeration value="expression"/>
+       <xs:enumeration value="boolean"/>
+       <xs:enumeration value="integer"/>
+       <xs:enumeration value="natural"/>
+       <xs:enumeration value="positive"/>
+       <xs:enumeration value="real"/>
+       <xs:enumeration value="time"/>
+      </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="typeiface">
+      <xs:restriction base="xs:string">
+       <xs:enumeration value="expression"/>
+       <xs:enumeration value="boolean"/>
+       <xs:enumeration value="natural"/>
+      </xs:restriction>
+    </xs:simpleType>
+      
     <xs:attribute name="wishbone" type="xs:string"/>
     <xs:attribute name="context" type="xs:string" />
     <xs:attribute name="multiplicity" type="xs:string" />