3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-27 06:27:57 +00:00
yosys/tests/opt/opt_hier.tcl
2025-07-05 16:45:52 +02:00

34 lines
715 B
Tcl

yosys -import
# per each opt_hier_*.v source file, confirm flattening and hieropt+flattening
# are combinationally equivalent
foreach fn [glob opt_hier_*.v] {
log -header "Test $fn"
log -push
design -reset
read_verilog $fn
hierarchy -auto-top
prep -top top
design -save start
flatten
design -save gold
design -load start
opt -hier
# check any instances marked `should_get_optimized_out` were
# indeed optimized out
select -assert-none a:should_get_optimized_out
dump
flatten
design -save gate
design -reset
design -copy-from gold -as gold A:top
design -copy-from gate -as gate A:top
yosys rename -hide
equiv_make gold gate equiv
equiv_induct equiv
equiv_status -assert equiv
log -pop
}