From 11b829ba70f61a5c59abae8e4b6feec34000b74f Mon Sep 17 00:00:00 2001 From: rhanqtl Date: Thu, 4 Sep 2025 23:19:11 +0800 Subject: [PATCH] fix(parse): #5234 adjust width of rhs according to lhs --- kernel/rtlil.cc | 6 +++++- tests/sat/fminit_noexpand.ys | 10 ++++++++++ tests/sat/fminit_seq_width.ys | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/sat/fminit_noexpand.ys create mode 100644 tests/sat/fminit_seq_width.ys diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 035701cb9..586262f97 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -5974,7 +5974,11 @@ bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, R } } - return parse(sig, module, str); + if (!parse(sig, module, str)) + return false; + if (sig.width_ > lhs.width_) + sig.remove(lhs.width_, sig.width_ - lhs.width_); + return true; } RTLIL::CaseRule::~CaseRule() diff --git a/tests/sat/fminit_noexpand.ys b/tests/sat/fminit_noexpand.ys new file mode 100644 index 000000000..a271c3c59 --- /dev/null +++ b/tests/sat/fminit_noexpand.ys @@ -0,0 +1,10 @@ +read_verilog -sv <