1 ### Always-active EN removal.
3 read_verilog -icells <<EOT
15 $dffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(2)) ff0 (.CLK(CLK), .EN(1'b1), .D(D), .Q(Q[1:0]));
16 $adffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b0), .ARST_POLARITY(1'b1), .ARST_VALUE(2'h2), .WIDTH(2)) ff1 (.CLK(CLK), .EN(1'b0), .ARST(ARST), .D(D), .Q(Q[3:2]));
17 $sdffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .SRST_POLARITY(1'b1), .SRST_VALUE(2'h2), .WIDTH(2)) ff2 (.CLK(CLK), .EN(1'b1), .SRST(SRST), .D(D), .Q(Q[5:4]));
18 $sdffce #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .SRST_POLARITY(1'b1), .SRST_VALUE(2'h2), .WIDTH(2)) ff3 (.CLK(CLK), .EN(1'b1), .SRST(SRST), .D(D), .Q(Q[7:6]));
19 $dffsre #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b0), .CLR_POLARITY(1'b1), .SET_POLARITY(1'b0), .WIDTH(2)) ff4 (.CLK(CLK), .EN(1'b0), .SET(SET), .CLR(CLR), .D(D), .Q(Q[9:8]));
21 $dlatch #(.EN_POLARITY(1'b1), .WIDTH(2)) ff5 (.EN(1'b1), .D(D), .Q(Q[11:10]));
22 $adlatch #(.EN_POLARITY(1'b0), .ARST_POLARITY(1'b1), .ARST_VALUE(2'h2), .WIDTH(2)) ff6 (.EN(1'b0), .ARST(ARST), .D(D), .Q(Q[13:12]));
23 $dlatchsr #(.EN_POLARITY(1'b0), .CLR_POLARITY(1'b1), .SET_POLARITY(1'b0), .WIDTH(2)) ff7 (.EN(1'b0), .SET(SET), .CLR(CLR), .D(D), .Q(Q[15:14]));
31 # Equivalence check will fail for unmapped adlatch and dlatchsr due to negative hold hack.
32 delete top/ff6 top/ff7
33 equiv_opt -undef -assert -multiclock opt_dff
36 delete top/ff6 top/ff7
38 equiv_opt -undef -assert -multiclock opt_dff
42 select -assert-count 0 t:$dffe
43 select -assert-count 0 t:$adffe
44 select -assert-count 0 t:$sdffe
45 select -assert-count 0 t:$sdffce
46 select -assert-count 0 t:$dffsre
47 select -assert-count 0 t:$dlatch
48 select -assert-count 0 t:$adlatch
49 select -assert-count 0 t:$dlatchsr
50 select -assert-count 1 t:$dff
51 select -assert-count 2 t:$sdff
52 select -assert-count 1 t:$adff
53 select -assert-count 1 t:$dffsr
58 select -assert-count 0 t:$_DFFE_*
59 select -assert-count 0 t:$_SDFFE_*
60 select -assert-count 0 t:$_SDFFCE_*
61 select -assert-count 0 t:$_DFFSRE_*
62 select -assert-count 0 t:$_DLATCH*
63 select -assert-count 2 t:$_DFF_P_
64 select -assert-count 4 t:$_SDFF_PP?_
65 select -assert-count 2 t:$_DFF_PP?_
66 select -assert-count 2 t:$_DFFSR_PNP_
72 ### Never-active EN removal.
74 read_verilog -icells <<EOT
80 (* init = 32'h55555555 *)
87 $dffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(2)) ff0 (.CLK(CLK), .EN(1'b0), .D(D), .Q(Q[1:0]));
88 $adffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b0), .ARST_POLARITY(1'b1), .ARST_VALUE(2'h2), .WIDTH(2)) ff1 (.CLK(CLK), .EN(1'b1), .ARST(ARST), .D(D), .Q(Q[3:2]));
89 $sdffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .SRST_POLARITY(1'b1), .SRST_VALUE(2'h2), .WIDTH(2)) ff2 (.CLK(CLK), .EN(1'b0), .SRST(SRST), .D(D), .Q(Q[5:4]));
90 $sdffce #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .SRST_POLARITY(1'b1), .SRST_VALUE(2'h2), .WIDTH(2)) ff3 (.CLK(CLK), .EN(1'b0), .SRST(SRST), .D(D), .Q(Q[7:6]));
91 $dffsre #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b0), .CLR_POLARITY(1'b1), .SET_POLARITY(1'b0), .WIDTH(2)) ff4 (.CLK(CLK), .EN(1'b1), .SET(SET), .CLR(CLR), .D(D), .Q(Q[9:8]));
93 $dlatch #(.EN_POLARITY(1'b1), .WIDTH(2)) ff5 (.EN(1'b0), .D(D), .Q(Q[11:10]));
94 $adlatch #(.EN_POLARITY(1'b0), .ARST_POLARITY(1'b1), .ARST_VALUE(2'h2), .WIDTH(2)) ff6 (.EN(1'b1), .ARST(ARST), .D(D), .Q(Q[13:12]));
95 $dlatchsr #(.EN_POLARITY(1'b0), .CLR_POLARITY(1'b1), .SET_POLARITY(1'b0), .WIDTH(2)) ff7 (.EN(1'b1), .SET(SET), .CLR(CLR), .D(D), .Q(Q[15:14]));
97 $dffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(2)) ff8 (.CLK(CLK), .EN(1'bx), .D(D), .Q(Q[17:16]));
98 $adffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b0), .ARST_POLARITY(1'b1), .ARST_VALUE(2'h2), .WIDTH(2)) ff9 (.CLK(CLK), .EN(1'bx), .ARST(ARST), .D(D), .Q(Q[19:18]));
99 $sdffe #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .SRST_POLARITY(1'b1), .SRST_VALUE(2'h2), .WIDTH(2)) ff10 (.CLK(CLK), .EN(1'bx), .SRST(SRST), .D(D), .Q(Q[21:20]));
100 $sdffce #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b1), .SRST_POLARITY(1'b1), .SRST_VALUE(2'h2), .WIDTH(2)) ff11 (.CLK(CLK), .EN(1'bx), .SRST(SRST), .D(D), .Q(Q[23:22]));
101 $dffsre #(.CLK_POLARITY(1'b1), .EN_POLARITY(1'b0), .CLR_POLARITY(1'b1), .SET_POLARITY(1'b0), .WIDTH(2)) ff12 (.CLK(CLK), .EN(1'bx), .SET(SET), .CLR(CLR), .D(D), .Q(Q[25:24]));
103 $dlatch #(.EN_POLARITY(1'b1), .WIDTH(2)) ff13 (.EN(1'bx), .D(D), .Q(Q[27:26]));
104 $adlatch #(.EN_POLARITY(1'b0), .ARST_POLARITY(1'b1), .ARST_VALUE(2'h2), .WIDTH(2)) ff14 (.EN(1'bx), .ARST(ARST), .D(D), .Q(Q[29:28]));
105 $dlatchsr #(.EN_POLARITY(1'b0), .CLR_POLARITY(1'b1), .SET_POLARITY(1'b0), .WIDTH(2)) ff15 (.EN(1'bx), .SET(SET), .CLR(CLR), .D(D), .Q(Q[31:30]));
113 equiv_opt -undef -assert -multiclock opt_dff
115 select -assert-count 2 t:$dffe
116 select -assert-count 4 t:$dlatch
117 select -assert-count 4 t:$sr
118 select -assert-none t:$dffe t:$dlatch t:$sr %% %n t:* %i
122 equiv_opt -undef -assert -multiclock opt_dff -keepdc
124 select -assert-count 2 t:$dffe
125 select -assert-count 1 t:$adffe
126 select -assert-count 1 t:$sdffe
127 select -assert-count 1 t:$sdffce
128 select -assert-count 1 t:$dffsre
129 select -assert-count 3 t:$dlatch
130 select -assert-count 1 t:$adlatch
131 select -assert-count 1 t:$dlatchsr
132 select -assert-count 2 t:$sr
137 equiv_opt -undef -assert -multiclock opt_dff
139 select -assert-count 4 t:$_DFFE_??_
140 select -assert-count 8 t:$_DLATCH_?_
141 select -assert-count 8 t:$_SR_??_
142 select -assert-none t:$_DFFE_??_ t:$_DLATCH_?_ t:$_SR_??_ %% %n t:* %i
147 equiv_opt -undef -assert -multiclock opt_dff -keepdc
149 select -assert-count 4 t:$_DFFE_??_
150 select -assert-count 2 t:$_DFFE_????_
151 select -assert-count 2 t:$_SDFFE_????_
152 select -assert-count 2 t:$_SDFFCE_????_
153 select -assert-count 2 t:$_DFFSRE_????_
154 select -assert-count 6 t:$_DLATCH_?_
155 select -assert-count 2 t:$_DLATCH_???_
156 select -assert-count 2 t:$_DLATCHSR_???_
157 select -assert-count 4 t:$_SR_??_