mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 09:05:32 +00:00
Merge pull request #2326 from YosysHQ/mwk/peeopt-muldiv-sign
peepopt.muldiv: Add a signedness check.
This commit is contained in:
commit
16bb3fc8bb
2 changed files with 16 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue