diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-12-07 11:57:29 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-12-07 11:57:29 +0100 |
commit | 5d839047466724ceb30a01898f6c7e04edbaab16 (patch) | |
tree | 7d20f87f26790ac0f8d4255b8c8904ad5400c862 | |
parent | 06d96e8fcf651a3fd16f5c64cbb01570471c7c0e (diff) |
Fixes and improvements in RTLIL::SigSpec::parse
-rw-r--r-- | kernel/rtlil.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 138287ce..9dfe196d 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -1550,9 +1550,9 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri sigspec_parse_split(tokens, str, ','); sig = RTLIL::SigSpec(); - for (auto &tok : tokens) + for (int tokidx = int(tokens.size())-1; tokidx >= 0; tokidx--) { - std::string netname = tok; + std::string netname = tokens[tokidx]; std::string indices; if (netname.size() == 0) @@ -1618,6 +1618,16 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str) { + if (str == "0") { + sig = RTLIL::SigSpec(RTLIL::State::S0, lhs.width); + return true; + } + + if (str == "~0") { + sig = RTLIL::SigSpec(RTLIL::State::S1, lhs.width); + return true; + } + if (lhs.chunks.size() == 1) { char *p = (char*)str.c_str(), *endptr; long long int val = strtoll(p, &endptr, 10); |