diff options
author | clairexen <claire@symbioticeda.com> | 2020-08-20 16:19:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 16:19:37 +0200 |
commit | 16bb3fc8bb11b6d373d0e2685b7d1fb38a306de0 (patch) | |
tree | c14fb0b50ad107d53b58addc92300046d01ee80b /passes | |
parent | 1cdb533fa58c8dbb6f8e45665a89134f5184ed40 (diff) | |
parent | e89cc9c02fc5d9ff2a6eedc524e7c0420666ac22 (diff) | |
download | yosys-16bb3fc8bb11b6d373d0e2685b7d1fb38a306de0.tar.gz yosys-16bb3fc8bb11b6d373d0e2685b7d1fb38a306de0.tar.bz2 yosys-16bb3fc8bb11b6d373d0e2685b7d1fb38a306de0.zip |
Merge pull request #2326 from YosysHQ/mwk/peeopt-muldiv-sign
peepopt.muldiv: Add a signedness check.
Diffstat (limited to 'passes')
-rw-r--r-- | passes/pmgen/peepopt_muldiv.pmg | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/passes/pmgen/peepopt_muldiv.pmg b/passes/pmgen/peepopt_muldiv.pmg index 7cad759d0..a4e232342 100644 --- a/passes/pmgen/peepopt_muldiv.pmg +++ b/passes/pmgen/peepopt_muldiv.pmg @@ -1,16 +1,18 @@ pattern muldiv state <SigSpec> t x y +state <bool> is_signed match mul select mul->type == $mul select GetSize(port(mul, \A)) + GetSize(port(mul, \B)) <= GetSize(port(mul, \Y)) endmatch -code t x y +code t x y is_signed t = port(mul, \Y); x = port(mul, \A); y = port(mul, \B); + is_signed = param(mul, \A_SIGNED).as_bool(); branch; std::swap(x, y); endcode @@ -19,6 +21,7 @@ match div select div->type.in($div) index <SigSpec> port(div, \A) === t index <SigSpec> port(div, \B) === x + filter param(div, \A_SIGNED).as_bool() == is_signed endmatch code |