yosys/tests/techmap/dfflegalize_dlatch_init.ys

121 lines
3.3 KiB
Plaintext
Raw Normal View History

2020-06-30 08:30:59 -05:00
read_verilog -icells <<EOT
module dlatch(input E, D, (* init = 2'h0 *) output [1:0] Q);
$_DLATCH_P_ ff0 (.E(E), .D(D), .Q(Q[0]));
$_DLATCH_N_ ff1 (.E(E), .D(D), .Q(Q[1]));
endmodule
EOT
design -save orig
2020-07-18 20:25:41 -05:00
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCH_P_ 0
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCH_P_ 1
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCH_PP0_ 0
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCH_PP0_ 1
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCH_PP1_ 0
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCH_PP1_ 1
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCHSR_PPP_ 0
equiv_opt -assert -multiclock dfflegalize -cell $_DLATCHSR_PPP_ 1
equiv_opt -assert -multiclock dfflegalize -cell $_ALDFF_PP_ 0
equiv_opt -assert -multiclock dfflegalize -cell $_ALDFF_PP_ 1
equiv_opt -assert -multiclock dfflegalize -cell $_ALDFFE_PPP_ 0
equiv_opt -assert -multiclock dfflegalize -cell $_ALDFFE_PPP_ 1
2020-06-30 08:30:59 -05:00
# Convert everything to DFFs.
design -load orig
dfflegalize -cell $_DLATCH_P_ 0
select -assert-count 1 t:$_NOT_
select -assert-count 2 t:$_DLATCH_P_
select -assert-none t:$_DLATCH_P_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_DLATCH_P_ 1
select -assert-count 5 t:$_NOT_
select -assert-count 2 t:$_DLATCH_P_
select -assert-none t:$_DLATCH_P_ t:$_NOT_ %% %n t:* %i
# Convert everything to ADLATCHs.
design -load orig
dfflegalize -cell $_DLATCH_PP0_ 0
select -assert-count 1 t:$_NOT_
select -assert-count 2 t:$_DLATCH_PP0_
select -assert-none t:$_DLATCH_PP0_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_DLATCH_PP0_ 1
select -assert-count 5 t:$_NOT_
select -assert-count 2 t:$_DLATCH_PP0_
select -assert-none t:$_DLATCH_PP0_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_DLATCH_PP1_ 0
select -assert-count 1 t:$_NOT_
select -assert-count 2 t:$_DLATCH_PP1_
select -assert-none t:$_DLATCH_PP1_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_DLATCH_PP1_ 1
select -assert-count 5 t:$_NOT_
select -assert-count 2 t:$_DLATCH_PP1_
select -assert-none t:$_DLATCH_PP1_ t:$_NOT_ %% %n t:* %i
# Convert everything to DLATCHSRs.
design -load orig
dfflegalize -cell $_DLATCHSR_PPP_ 0
select -assert-count 1 t:$_NOT_
select -assert-count 2 t:$_DLATCHSR_PPP_
select -assert-none t:$_DLATCHSR_PPP_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_DLATCHSR_PPP_ 1
select -assert-count 5 t:$_NOT_
select -assert-count 2 t:$_DLATCHSR_PPP_
select -assert-none t:$_DLATCHSR_PPP_ t:$_NOT_ %% %n t:* %i
# Convert everything to ALDFFs.
design -load orig
dfflegalize -cell $_ALDFF_PP_ 0
select -assert-count 1 t:$_NOT_
select -assert-count 2 t:$_ALDFF_PP_
select -assert-none t:$_ALDFF_PP_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_ALDFF_PP_ 1
select -assert-count 5 t:$_NOT_
select -assert-count 2 t:$_ALDFF_PP_
select -assert-none t:$_ALDFF_PP_ t:$_NOT_ %% %n t:* %i
# Convert everything to ALDFFEs.
design -load orig
dfflegalize -cell $_ALDFFE_PPP_ 0
select -assert-count 1 t:$_NOT_
select -assert-count 2 t:$_ALDFFE_PPP_
select -assert-none t:$_ALDFFE_PPP_ t:$_NOT_ %% %n t:* %i
design -load orig
dfflegalize -cell $_ALDFFE_PPP_ 1
select -assert-count 5 t:$_NOT_
select -assert-count 2 t:$_ALDFFE_PPP_
select -assert-none t:$_ALDFFE_PPP_ t:$_NOT_ %% %n t:* %i