diff options
author | Marcelina KoĆcielnicka <mwk@0x04.net> | 2020-08-05 21:01:20 +0200 |
---|---|---|
committer | Marcelina KoĆcielnicka <mwk@0x04.net> | 2020-08-05 21:01:20 +0200 |
commit | c1ed1c28be9bd9880cc036d13f43294bf257788b (patch) | |
tree | 4ce011ac29f69cfdb1d94a1d71aa5170ea79acdc /passes/pmgen | |
parent | c39ebe6ae0e41cf9a84da852fa3cf9f71937a9b2 (diff) | |
download | yosys-c1ed1c28be9bd9880cc036d13f43294bf257788b.tar.gz yosys-c1ed1c28be9bd9880cc036d13f43294bf257788b.tar.bz2 yosys-c1ed1c28be9bd9880cc036d13f43294bf257788b.zip |
peeopt.shiftmul: Add a signedness check.
Fixes #2332.
Diffstat (limited to 'passes/pmgen')
-rw-r--r-- | passes/pmgen/peepopt_shiftmul.pmg | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/passes/pmgen/peepopt_shiftmul.pmg b/passes/pmgen/peepopt_shiftmul.pmg index d4748ae19..d71fbf744 100644 --- a/passes/pmgen/peepopt_shiftmul.pmg +++ b/passes/pmgen/peepopt_shiftmul.pmg @@ -31,22 +31,18 @@ match mul select mul->type.in($mul) select port(mul, \A).is_fully_const() || port(mul, \B).is_fully_const() index <SigSpec> port(mul, \Y) === shamt + filter !param(mul, \A_SIGNED).as_bool() endmatch code { IdString const_factor_port = port(mul, \A).is_fully_const() ? \A : \B; - IdString const_factor_signed = const_factor_port == \A ? \A_SIGNED : \B_SIGNED; Const const_factor_cnst = port(mul, const_factor_port).as_const(); int const_factor = const_factor_cnst.as_int(); if (GetSize(const_factor_cnst) == 0) reject; - if (const_factor_cnst.bits[GetSize(const_factor_cnst)-1] != State::S0 && - param(mul, const_factor_signed).as_bool()) - reject; - if (GetSize(const_factor_cnst) > 20) reject; |