}\r
\r
BlockParameterGeneric::BlockParameterGeneric(AbstractBlock* _owner, const QString &_name, const QString &_type, const QString &_value) : BlockParameter(_owner, _name, _type, _value) {\r
+ /* CAUTION: no check done on the type parameter !\r
+ * It must never be "expression" but something that is numeric/boolean\r
+ */\r
userValue = defaultValue;\r
}\r
\r
formatNoValue.append(";");\r
}\r
\r
- if (!userValue.isNull()) {\r
- ret = formatValue.arg(name).arg(type).arg(userValue.toString());\r
- }\r
- else if (!defaultValue.isNull()) {\r
- ret = formatValue.arg(name).arg(type).arg(defaultValue.toString());\r
+ QString typeStr = "";\r
+ QString valueStr = "";\r
+ if ((type == Boolean)||(type == Bit)) {\r
+ typeStr = "std_logic";\r
+ if (!userValue.isNull()) {\r
+ valueStr = "'"+userValue.toString()+"'";\r
+ ret = formatValue.arg(name).arg(typeStr).arg(valueStr);\r
+ }\r
+ else if (!defaultValue.isNull()) {\r
+ valueStr = "'"+defaultValue.toString()+"'";\r
+ ret = formatValue.arg(name).arg(typeStr).arg(valueStr);\r
+ }\r
+ else {\r
+ ret = formatNoValue.arg(name).arg(typeStr);\r
+ }\r
}\r
else {\r
- ret = formatNoValue.arg(name).arg(type);\r
+ typeStr = getTypeString();\r
+ if (!userValue.isNull()) {\r
+ ret = formatValue.arg(name).arg(typeStr).arg(userValue.toString());\r
+ }\r
+ else if (!defaultValue.isNull()) {\r
+ ret = formatValue.arg(name).arg(typeStr).arg(defaultValue.toString());\r
+ }\r
+ else {\r
+ ret = formatNoValue.arg(name).arg(typeStr);\r
+ }\r
}\r
}\r
- else if (context == BlockParameter::Architecture) {\r
+ else if (context == BlockParameter::Instance) {\r
QString format = "%1 => %2";\r
if ((flags & BlockParameter::NoComma) == 0) {\r
format.append(";");\r
}\r
AbstractBlock* parent = owner->getParent();\r
- BlockParameter* p = parent->getParameterFromName(name);\r
+ BlockParameter* p = NULL;\r
+ if (parent != NULL) {\r
+ p = parent->getParameterFromName(name);\r
+ }\r
if (p != NULL) {\r
/* the parent group has a generic parameter with the same\r
name\r
}\r
else {\r
if (!userValue.isNull()) {\r
- ret = format.arg(name).arg(userValue.toString());\r
+ if ((type == Boolean)||(type == Bit)) {\r
+ ret = format.arg(name).arg("'"+userValue.toString()+"'");\r
+ }\r
+ else {\r
+ ret = format.arg(name).arg(userValue.toString());\r
+ }\r
}\r
else if (!defaultValue.isNull()) {\r
- ret = format.arg(name).arg(defaultValue.toString());\r
+ if ((type == Boolean)||(type == Bit)) {\r
+ ret = format.arg(name).arg("'"+defaultValue.toString()+"'");\r
+ }\r
+ else {\r
+ ret = format.arg(name).arg(defaultValue.toString());\r
+ }\r
}\r
else {\r
// abnormal case\r