summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rtlil.cc14
-rw-r--r--kernel/rtlil.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index d03fb044..a65f0bb2 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1216,6 +1216,20 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri
return true;
}
+bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str)
+{
+ if (lhs.chunks.size() == 1) {
+ char *p = (char*)str.c_str(), *endptr;
+ long long int val = strtoll(p, &endptr, 10);
+ if (endptr && endptr != p && *endptr == 0) {
+ sig = RTLIL::SigSpec(val, lhs.width);
+ return true;
+ }
+ }
+
+ return parse(sig, module, str);
+}
+
RTLIL::CaseRule::~CaseRule()
{
for (auto it = switches.begin(); it != switches.end(); it++)
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 7628bf0a..952cb594 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -357,6 +357,7 @@ struct RTLIL::SigSpec {
RTLIL::Const as_const() const;
bool match(std::string pattern) const;
static bool parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str);
+ static bool parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str);
};
struct RTLIL::CaseRule {