Merge pull request #3185 from YosysHQ/micko/co_sim
[yosys.git] / passes / pmgen / peepopt_shiftmul.pmg
index e1da5218291d7d9666fc5fe6dc2dc6c8f95106c6..d71fbf74449dc416ab615cf9bf1fd6817165c69a 100644 (file)
@@ -31,28 +31,23 @@ 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;
 
-       if (shift->type.in($shift, $shiftx))
-               if (GetSize(port(shift, \Y)) > const_factor)
-                       reject;
+       if (GetSize(port(shift, \Y)) > const_factor)
+               reject;
 
        int factor_bits = ceil_log2(const_factor);
        SigSpec mul_din = port(mul, const_factor_port == \A ? \B : \A);