3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-19 20:33:39 +00:00

Merge pull request #5089 from YosysHQ/krys/cutpoint_whole

cutpoint: Re-add whole module optimization
This commit is contained in:
KrystalDelusion 2025-05-16 09:22:28 +12:00 committed by GitHub
commit f7888c607b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,50 @@
read_verilog << EOT
module top(input a, b, output o);
wire c, d, e;
bb bb1 (.a (a), .b (b), .o (c));
sub_mod sub_inst (.a (a), .b (b), .o (e));
some_mod some_inst (.a (c), .b (d), .c (e), .o (o));
endmodule
(* blackbox *)
module bb #( parameter SOME_PARAM=0 ) (input a, b, output o);
endmodule
module sub_mod(input a, b, output o);
bb bb2 (.a (a), .b (b), .o (o));
endmodule
module some_mod(input a, b, c, output o);
assign o = a & (b | c);
endmodule
EOT
hierarchy -top top
design -stash hier
# removing cell
design -load hier
logger -expect log "Removing cell .*, making all cell outputs cutpoints" 1
cutpoint sub_mod/bb2
logger -check-expected
logger -werror "Removing cell .*, making all cell outputs cutpoints"
# removing wires
design -load hier
logger -expect log "Making wire .* a cutpoint" 1
cutpoint top/c
logger -check-expected
logger -werror "Making wire .* a cutpoint"
# removing output wires
design -load hier
logger -expect log "Making output wire .* a cutpoint" 1
cutpoint sub_mod/o
logger -check-expected
logger -werror "Making output wire .* a cutpoint"
# whole module optimization, doesn't do any of the previous
design -load hier
logger -expect log "Making all outputs of module .* cut points, removing module contents" 1
cutpoint sub_mod
logger -check-expected