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
\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
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() {
#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;
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);
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; }
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);
*/
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
};
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);
}
}
}
-void ArithmeticEvaluator::setExpression(const QString& _expression) throw(int) {
+void ArithmeticEvaluator::setExpression(const QString& _expression) throw(int) {
+
+ setVariableNames(_expression);
+
try {
convert(_expression);
}
}
}
+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) << " ";
}
double ArithmeticEvaluator::evaluate() throw(int) {
+ errorMessage = "";
QStack<double> stack;
bool ok;
double value1,value2;
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)) {
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 {
*size = 1;
}
- while ((_expression[i].isLetterOrNumber()) || (_expression[i] == '-') || (_expression[i] == '_')) {
+ while ((_expression[i].isLetterOrNumber()) || (_expression[i] == '_')) {
number.append(_expression[i]);
i += 1;
*size += 1;
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
bool checkAfterPar(const QString& _expression, int offset);
double evalFunction(int indexFunc, double value);
+
+ void setVariableNames(const QString &_expression);
+
+ QString errorMessage;
};
}\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
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
QAction* showRstClkIface = NULL;
QAction* showWishboneIface = NULL;
QAction* showParameters = NULL;
+ QAction* showPatterns = NULL;
InterfaceItem* ifaceItem = getInterfaceItemFromCursor(event->pos().x(), event->pos().y());
// menu for interface
}
}
}
+ if ((iface->getAssociatedIface() != NULL) && (iface->getDirection() == AbstractInterface::Output)) {
+ showPatterns = menu.addAction("Show patterns");
+ }
}
// menu for blocks (group or func)
else {
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) {
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);
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;}
* this interface. connecteFrom references such an interface if it exists.
*/
ConnectedInterface* connectedFrom;
+
+ // patterns
+ QList<char> outputPattern; //! only usefull for output interfaces
};
// 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)) {
unselectAllItems();
params->unsaveModif = true;
+ cout << "created a connection from " << qPrintable(ref1->getName()) << " to " << qPrintable(ref2->getName()) << endl;
return true;
}
return false;
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
void duplicateInterfaceItem(InterfaceItem* item);
void showProperties(InterfaceItem *inter);
void renameInterface(InterfaceItem* item);
+ void showPatterns(InterfaceItem* item);
// connection ops
bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2);
#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
}\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
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
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
\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
// 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
}\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
}\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
\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
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
*/\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
*/\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
\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
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
}
}
}
+
+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();
+}
*/
bool createPatterns();
void resetPatternComputed();
+ bool computeOutputPatterns(int nbExec);
private:
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()) {
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;
if (canCompute) {
foreach(AbstractInterface* iface, getControlOutputs()) {
- iface->setOutputPattern(iface->getConnectedFrom()->getOutputPattern());
+ ConnectedInterface* connIface = AI_TO_CON(iface);
+ connIface->setOutputPattern(connIface->getConnectedFrom()->getOutputPattern());
}
setPatternComputed(true);
}
// public attributes
static int counter;
+ bool computeOutputPattern(int nbExec = -1);
private:
// patterns
* 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
*/
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;
parentItem = _parentItem;
if (parentItem != NULL) {
- parentItem->setChildGroupItem(this);
+ parentItem->setChildGroupItem(this);
}
/*
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));
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));
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;
}
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()));
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++);
}
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++);
}
void GroupScene::addSourceItem(SourceItem* item) {
+ // adding item to the scene
+ addItem(item);
+ item->setZValue(1);
// add item from the QList
sourceItems.append(item);
}
toolbarEditMode->addWidget(butAddConnection);
toolbarEditMode->addWidget(butEdit);
- toolbarAdd->addAction(copyBlockAct);
+ //toolbarAdd->addAction(copyBlockAct);
toolbarAdd->addAction(newEmptyGroupAct);
toolbarAdd->addAction(newGroupAct);
void MainWindow::slotGraphValidation() {
- params->parametersValidation();
+ params->getGraph()->computeOutputPatterns(5);
+ //params->parametersValidation();
}
void MainWindow::addTopGroup(GroupWidget *_topGroup) {
#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
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
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
// 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
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
type->setText(param->getTypeString());
}
-void ParametersWindow::save()
-{
+void ParametersWindow::save() {
BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
param->setValue(value->text());
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);
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);
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();
// 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++) {
<?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">
<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>
--- /dev/null
+<?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>
<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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
</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
--- /dev/null
+<?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
<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>
--- /dev/null
+<?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>
--- /dev/null
+<?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
--- /dev/null
+<?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
<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>
<!-- 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"/>
<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" />