mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-15 19:55:41 +00:00
97 lines
3 KiB
Text
97 lines
3 KiB
Text
read_verilog -icells <<EOT
|
|
|
|
module top(input E, D, S, R, output [9:0] Q);
|
|
|
|
$_DLATCH_P_ latch0 (.E(E), .D(D), .Q(Q[0]));
|
|
$_DLATCH_PP0_ latch1 (.E(E), .D(D), .R(R), .Q(Q[1]));
|
|
$_DLATCH_PP1_ latch2 (.E(E), .D(D), .R(R), .Q(Q[2]));
|
|
$_DLATCHSR_PPP_ latch3 (.E(E), .D(D), .R(R), .S(S), .Q(Q[3]));
|
|
$_DLATCHSR_NNN_ latch4 (.E(E), .D(D), .R(R), .S(S), .Q(Q[4]));
|
|
|
|
assign Q[9:5] = ~Q[4:0];
|
|
|
|
endmodule
|
|
|
|
EOT
|
|
|
|
simplemap
|
|
|
|
design -save orig
|
|
read_liberty -lib dlatchlibmap.lib
|
|
|
|
equiv_opt -map dlatchlibmap-sim.v -assert -multiclock dfflibmap -liberty dlatchlibmap.lib
|
|
equiv_opt -map dlatchlibmap-sim.v -assert -multiclock dfflibmap -prepare -liberty dlatchlibmap.lib
|
|
|
|
dfflibmap -prepare -liberty dlatchlibmap.lib
|
|
equiv_opt -map dlatchlibmap-sim.v -assert -multiclock dfflibmap -map-only -liberty dlatchlibmap.lib
|
|
|
|
design -load orig
|
|
dfflibmap -liberty dlatchlibmap.lib
|
|
clean
|
|
|
|
select -assert-count 4 t:$_NOT_
|
|
select -assert-count 1 t:dlatchn
|
|
select -assert-count 4 t:dlatchsr
|
|
select -assert-none t:dlatchn t:dlatchsr t:$_NOT_ %% %n t:* %i
|
|
|
|
design -load orig
|
|
dfflibmap -prepare -liberty dlatchlibmap.lib
|
|
|
|
select -assert-count 9 t:$_NOT_
|
|
select -assert-count 1 t:$_DLATCH_N_
|
|
select -assert-count 4 t:$_DLATCHSR_PPP_
|
|
select -assert-none t:$_DLATCH_N_ t:$_DLATCHSR_PPP_ t:$_NOT_ %% %n t:* %i
|
|
|
|
design -load orig
|
|
dfflibmap -map-only -liberty dlatchlibmap.lib
|
|
|
|
select -assert-count 5 t:$_NOT_
|
|
select -assert-count 0 t:dlatchn
|
|
select -assert-count 1 t:dlatchsr
|
|
select -assert-count 1 t:$_DLATCH_P_
|
|
select -assert-count 1 t:$_DLATCH_PP0_
|
|
select -assert-count 1 t:$_DLATCH_PP1_
|
|
select -assert-count 1 t:$_DLATCHSR_NNN_
|
|
|
|
design -load orig
|
|
dfflibmap -prepare -liberty dlatchlibmap.lib
|
|
dfflibmap -map-only -liberty dlatchlibmap.lib
|
|
clean
|
|
|
|
select -assert-count 4 t:$_NOT_
|
|
select -assert-count 1 t:dlatchn
|
|
select -assert-count 4 t:dlatchsr
|
|
select -assert-none t:dlatchn t:dlatchsr t:$_NOT_ %% %n t:* %i
|
|
|
|
design -load orig
|
|
dfflibmap -prepare -liberty dlatchlibmap_dlatchn.lib -liberty dlatchlibmap_dlatchsr_r.lib
|
|
dfflibmap -map-only -liberty dlatchlibmap_dlatchn.lib -liberty dlatchlibmap_dlatchsr_r.lib
|
|
clean
|
|
|
|
select -assert-count 4 t:$_NOT_
|
|
select -assert-count 1 t:dlatchn
|
|
select -assert-count 4 t:dlatchsr
|
|
select -assert-none t:dlatchn t:dlatchsr t:$_NOT_ %% %n t:* %i
|
|
|
|
design -load orig
|
|
dfflibmap -liberty dlatchlibmap.lib -dont_use *latchn
|
|
clean
|
|
|
|
select -assert-count 0 t:dlatchn
|
|
select -assert-count 5 t:dlatchsr
|
|
|
|
design -load orig
|
|
dfflibmap -liberty dlatchlibmap.lib -liberty dlatchlibmap_dlatchsr_mixedpol.lib -dont_use dlatchsr
|
|
clean
|
|
|
|
# We have one more _NOT_ than with the regular dlatchsr
|
|
select -assert-count 5 t:$_NOT_
|
|
select -assert-count 1 t:dlatchn
|
|
select -assert-count 4 t:dlatchsr_mixedpol
|
|
# The additional NOT is on latch2.
|
|
# Originally, latch2.R is an active high "preset".
|
|
# dlatchsr_mixedpol has functionally swapped labels due to the data_in inversion,
|
|
# so we use its CLEAR port for the "preset",
|
|
# but we have to invert it because the CLEAR pin is active low.
|
|
# latch2.CLEAR = !R
|
|
select -assert-count 1 c:latch2 %x:+[CLEAR] %ci t:$_NOT_ %i
|