X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/8f0bedf735fe2b306c11c3f4a168245a05e37ccd..refs/heads/master:/BlockParameterGeneric.cpp?ds=inline diff --git a/BlockParameterGeneric.cpp b/BlockParameterGeneric.cpp index d652c37..4ba6c8e 100644 --- a/BlockParameterGeneric.cpp +++ b/BlockParameterGeneric.cpp @@ -59,14 +59,47 @@ QString BlockParameterGeneric::toVHDL(int context, int flags) { formatNoValue.append(";"); } - if (!userValue.isNull()) { - ret = formatValue.arg(name).arg(getTypeString()).arg(userValue.toString()); + QString typeStr = ""; + QString valueStr = ""; + if ((type == Boolean)||(type == Bit)) { + typeStr = "std_logic"; + if (!userValue.isNull()) { + valueStr = "'"+userValue.toString()+"'"; + ret = formatValue.arg(name).arg(typeStr).arg(valueStr); + } + else if (!defaultValue.isNull()) { + valueStr = "'"+defaultValue.toString()+"'"; + ret = formatValue.arg(name).arg(typeStr).arg(valueStr); + } + else { + ret = formatNoValue.arg(name).arg(typeStr); + } } - else if (!defaultValue.isNull()) { - ret = formatValue.arg(name).arg(getTypeString()).arg(defaultValue.toString()); + else if (type == String) { + typeStr = "string"; + if (!userValue.isNull()) { + valueStr = "\""+userValue.toString()+"\""; + ret = formatValue.arg(name).arg(typeStr).arg(valueStr); + } + else if (!defaultValue.isNull()) { + valueStr = "\""+defaultValue.toString()+"\""; + ret = formatValue.arg(name).arg(typeStr).arg(valueStr); + } + else { + ret = formatNoValue.arg(name).arg(typeStr); + } } else { - ret = formatNoValue.arg(name).arg(getTypeString()); + typeStr = getTypeString(); + if (!userValue.isNull()) { + ret = formatValue.arg(name).arg(typeStr).arg(userValue.toString()); + } + else if (!defaultValue.isNull()) { + ret = formatValue.arg(name).arg(typeStr).arg(defaultValue.toString()); + } + else { + ret = formatNoValue.arg(name).arg(typeStr); + } } } else if (context == BlockParameter::Instance) { @@ -87,10 +120,26 @@ QString BlockParameterGeneric::toVHDL(int context, int flags) { } else { if (!userValue.isNull()) { - ret = format.arg(name).arg(userValue.toString()); + if ((type == Boolean)||(type == Bit)) { + ret = format.arg(name).arg("'"+userValue.toString()+"'"); + } + else if (type == String) { + ret = format.arg(name).arg("\""+userValue.toString()+"\""); + } + else { + ret = format.arg(name).arg(userValue.toString()); + } } else if (!defaultValue.isNull()) { - ret = format.arg(name).arg(defaultValue.toString()); + if ((type == Boolean)||(type == Bit)) { + ret = format.arg(name).arg("'"+defaultValue.toString()+"'"); + } + else if (type == String) { + ret = format.arg(name).arg("\""+defaultValue.toString()+"\""); + } + else { + ret = format.arg(name).arg(defaultValue.toString()); + } } else { // abnormal case