3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 00:55:32 +00:00

opt_expr: Fix 'signed X>=0' replacement for wide output ports

If the `$ge` cell we are replacing has wide output port, the upper bits
on the port should be driven to zero. That's not what a `$not` cell with
a single-bit input does. Instead opt for a `$logic_not` cell, which does
zero-pad its output.

Fixes #3867.
This commit is contained in:
Martin Povišer 2023-08-01 11:10:27 +02:00 committed by Lofty
parent 8b2a3d60f4
commit f8325f66b7
2 changed files with 8 additions and 1 deletions

7
tests/opt/bug3867.ys Normal file
View file

@ -0,0 +1,7 @@
read_verilog <<EOF
module test (input signed [4:0] i, output [5:0] o);
assign o = (i >= 0);
endmodule
EOF
equiv_opt -assert opt_expr -fine