+ foreach(BlockParameter* p, listPorts) {
+ QString var = "$";
+ var += p->getName();
+ if (width.contains(var)) {
+ expr.replace(var,p->toVHDL(0,0));
+ }
+ }
+ foreach(BlockParameter* p, listGenerics) {
+ QString var = "$";
+ var += p->getName();
+ if (width.contains(var)) {
+ int tmp = p->getValue().toInt(&ok);
+ if (!ok) return -1;
+ QString s="";
+ s.setNum(tmp);
+ expr.replace(var,s);
+ }
+ }
+ // now evaluate the whole expression
+ ArithmeticEvaluator evaluator;
+
+ try {
+ evaluator.setVariableMarkers("$");
+ evaluator.setExpression(expr);
+ w = (int)(evaluator.evaluate());
+ cout << "iface size :" << w << endl;
+ }
+ catch(int e) {
+ cerr << "invalid expression in size of interface " << qPrintable(name) << " at character " << e << endl;
+ w = -1;
+ }
+ }
+ return w;
+}
+
+QString AbstractInterface::getEndianessString() {
+ QString str="unknown";
+ switch(endianess){
+ case AbstractInterface::LittleEndian:
+ str = QString("little");
+ break;
+ case AbstractInterface::BigEndian:
+ str = QString("big");
+ break;
+ }
+ return str;
+}
+
+QString AbstractInterface::getPurposeString() {
+ QString str;
+ switch(purpose){
+ case AbstractInterface::AnyPurpose:
+ str = QString("any");
+ break;
+ case AbstractInterface::Data:
+ str = QString("data");
+ break;
+ case AbstractInterface::Control:
+ str = QString("control");
+ break;
+ case AbstractInterface::Clock:
+ str = QString("clock");
+ break;
+ case AbstractInterface::Reset:
+ str = QString("reset");
+ break;
+ case AbstractInterface::Wishbone:
+ str = QString("wishbone");
+ break;
+ }
+ return str;