From 5d839047466724ceb30a01898f6c7e04edbaab16 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 7 Dec 2013 11:57:29 +0100 Subject: Fixes and improvements in RTLIL::SigSpec::parse --- kernel/rtlil.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'kernel') 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); -- cgit v1.2.3