aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclairexen <claire@symbioticeda.com>2020-08-31 11:58:29 +0200
committerGitHub <noreply@github.com>2020-08-31 11:58:29 +0200
commitd23e4b4dce31df5baff47a1eda917e6b7df16693 (patch)
tree9d5920b4dd53bf77feb596bc67416e6877adf347
parent3030c2b46cabee8eee5e3ae25c9859887b0b97a1 (diff)
parent3af499c60f664711501cf3ee1ab5ff1943315e82 (diff)
downloadyosys-d23e4b4dce31df5baff47a1eda917e6b7df16693.tar.gz
yosys-d23e4b4dce31df5baff47a1eda917e6b7df16693.tar.bz2
yosys-d23e4b4dce31df5baff47a1eda917e6b7df16693.zip
Merge pull request #2368 from YosysHQ/verific_portrange
Fix import of VHDL enums
-rw-r--r--frontends/verific/verific.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc
index 52047ae2b..4358d957d 100644
--- a/frontends/verific/verific.cc
+++ b/frontends/verific/verific.cc
@@ -199,12 +199,17 @@ void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &att
attributes.emplace(stringf("\\enum_value_%s", p+2), RTLIL::escape_id(k));
}
else if (nl->IsFromVhdl()) {
- // Expect "<binary>"
+ // Expect "<binary>" or plain <binary>
auto p = v;
if (p) {
- if (*p != '"')
- p = nullptr;
- else {
+ if (*p != '"') {
+ auto l = strlen(p);
+ auto q = (char*)malloc(l+1);
+ strncpy(q, p, l);
+ q[l] = '\0';
+ for(char *ptr = q; *ptr; ++ptr )*ptr = tolower(*ptr);
+ attributes.emplace(stringf("\\enum_value_%s", q), RTLIL::escape_id(k));
+ } else {
auto *q = p+1;
for (; *q != '"'; q++)
if (*q != '0' && *q != '1') {
@@ -213,16 +218,20 @@ void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &att
}
if (p && *(q+1) != '\0')
p = nullptr;
+
+ if (p != nullptr)
+ {
+ auto l = strlen(p);
+ auto q = (char*)malloc(l+1-2);
+ strncpy(q, p+1, l-2);
+ q[l-2] = '\0';
+ attributes.emplace(stringf("\\enum_value_%s", q), RTLIL::escape_id(k));
+ free(q);
+ }
}
}
if (p == nullptr)
- log_error("Expected TypeRange value '%s' to be of form \"<binary>\".\n", v);
- auto l = strlen(p);
- auto q = (char*)malloc(l+1-2);
- strncpy(q, p+1, l-2);
- q[l-2] = '\0';
- attributes.emplace(stringf("\\enum_value_%s", q), RTLIL::escape_id(k));
- free(q);
+ log_error("Expected TypeRange value '%s' to be of form \"<binary>\" or <binary>.\n", v);
}
}
}