3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 06:03:23 +00:00

Improved user-friendliness of "sat" and "eval" expression parsing

This commit is contained in:
Clifford Wolf 2013-11-09 12:02:27 +01:00
parent 2864cb3b59
commit 223892ac28
4 changed files with 31 additions and 20 deletions

View file

@ -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++)