diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-11-09 12:02:27 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-11-09 12:02:27 +0100 |
commit | 223892ac286b1dd0d09bf2449cd8953b1029ae68 (patch) | |
tree | 704ff413b0dd4112106b7dca8fa5761236700019 /passes | |
parent | 2864cb3b59d1e293d3738eebbaf363b4e03d365e (diff) | |
download | yosys-223892ac286b1dd0d09bf2449cd8953b1029ae68.tar.gz yosys-223892ac286b1dd0d09bf2449cd8953b1029ae68.tar.bz2 yosys-223892ac286b1dd0d09bf2449cd8953b1029ae68.zip |
Improved user-friendliness of "sat" and "eval" expression parsing
Diffstat (limited to 'passes')
-rw-r--r-- | passes/sat/eval.cc | 30 | ||||
-rw-r--r-- | passes/sat/sat.cc | 6 |
2 files changed, 16 insertions, 20 deletions
diff --git a/passes/sat/eval.cc b/passes/sat/eval.cc index 54cb60d21..473cb41c5 100644 --- a/passes/sat/eval.cc +++ b/passes/sat/eval.cc @@ -384,13 +384,12 @@ struct EvalPass : public Pass { log_cmd_error("Can't perform EVAL on an empty selection!\n"); ConstEval ce(module); - RTLIL::SigSpec show_signal, show_value, undef_signal; for (auto &it : sets) { RTLIL::SigSpec lhs, rhs; if (!RTLIL::SigSpec::parse(lhs, module, it.first)) log_cmd_error("Failed to parse lhs set expression `%s'.\n", it.first.c_str()); - if (!RTLIL::SigSpec::parse(rhs, module, it.second)) + if (!RTLIL::SigSpec::parse_rhs(lhs, rhs, module, it.second)) log_cmd_error("Failed to parse rhs set expression `%s'.\n", it.second.c_str()); if (!rhs.is_fully_const()) log_cmd_error("Right-hand-side set expression `%s' is not constant.\n", it.second.c_str()); @@ -400,26 +399,23 @@ struct EvalPass : public Pass { ce.set(lhs, rhs.as_const()); } - for (auto &it : shows) { - RTLIL::SigSpec sig; - if (!RTLIL::SigSpec::parse(sig, module, it)) - log_cmd_error("Failed to parse lhs set expression `%s'.\n", it.c_str()); - show_signal.append(sig); - } - if (shows.size() == 0) { for (auto &it : module->wires) if (it.second->port_output) - show_signal.append(it.second); + shows.push_back(it.second->name); } - show_signal.optimize(); - show_value = show_signal; - - if (!ce.eval(show_value, undef_signal)) - log("Failed to evaluate signal %s: Missing value for %s.\n", log_signal(show_signal), log_signal(undef_signal)); - else - log("Eval result: %s = %s.\n", log_signal(show_signal), log_signal(show_value)); + for (auto &it : shows) { + RTLIL::SigSpec signal, value, undef; + if (!RTLIL::SigSpec::parse(signal, module, it)) + log_cmd_error("Failed to parse lhs set expression `%s'.\n", it.c_str()); + signal.optimize(); + value = signal; + if (!ce.eval(value, undef)) + log("Failed to evaluate signal %s: Missing value for %s.\n", log_signal(signal), log_signal(undef)); + else + log("Eval result: %s = %s.\n", log_signal(signal), log_signal(value)); + } } } EvalPass; diff --git a/passes/sat/sat.cc b/passes/sat/sat.cc index 31808503e..c1e41eff3 100644 --- a/passes/sat/sat.cc +++ b/passes/sat/sat.cc @@ -81,7 +81,7 @@ struct SatHelper if (!RTLIL::SigSpec::parse(lhs, module, s.first)) log_cmd_error("Failed to parse lhs set expression `%s'.\n", s.first.c_str()); - if (!RTLIL::SigSpec::parse(rhs, module, s.second)) + if (!RTLIL::SigSpec::parse_rhs(lhs, rhs, module, s.second)) log_cmd_error("Failed to parse rhs set expression `%s'.\n", s.second.c_str()); show_signal_pool.add(sigmap(lhs)); show_signal_pool.add(sigmap(rhs)); @@ -102,7 +102,7 @@ struct SatHelper if (!RTLIL::SigSpec::parse(lhs, module, s.first)) log_cmd_error("Failed to parse lhs set expression `%s'.\n", s.first.c_str()); - if (!RTLIL::SigSpec::parse(rhs, module, s.second)) + if (!RTLIL::SigSpec::parse_rhs(lhs, rhs, module, s.second)) log_cmd_error("Failed to parse rhs set expression `%s'.\n", s.second.c_str()); show_signal_pool.add(sigmap(lhs)); show_signal_pool.add(sigmap(rhs)); @@ -162,7 +162,7 @@ struct SatHelper if (!RTLIL::SigSpec::parse(lhs, module, s.first)) log_cmd_error("Failed to parse lhs proof expression `%s'.\n", s.first.c_str()); - if (!RTLIL::SigSpec::parse(rhs, module, s.second)) + if (!RTLIL::SigSpec::parse_rhs(lhs, rhs, module, s.second)) log_cmd_error("Failed to parse rhs proof expression `%s'.\n", s.second.c_str()); show_signal_pool.add(sigmap(lhs)); show_signal_pool.add(sigmap(rhs)); |