1 ### Always-active SET/CLR removal.
3 read_verilog -icells <<EOT
14 $dffsr #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b1), .CLR_POLARITY(1'b1), .WIDTH(6)) ff0 (.CLK(CLK), .CLR({CLR, CLR, CLR, 1'b1, 1'b0, 1'bx}), .SET({1'b1, 1'b0, 1'bx, SET, SET, SET}), .D(D), .Q(Q[5:0]));
15 $dffsre #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b0), .CLR_POLARITY(1'b0), .EN_POLARITY(1'b1), .WIDTH(6)) ff1 (.CLK(CLK), .EN(EN), .CLR({CLR, CLR, CLR, 1'b1, 1'b0, 1'bx}), .SET({1'b1, 1'b0, 1'bx, SET, SET, SET}), .D(D), .Q(Q[11:6]));
16 $dlatchsr #(.SET_POLARITY(1'b0), .CLR_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(6)) ff2 (.EN(EN), .CLR({CLR, CLR, CLR, 1'b1, 1'b0, 1'bx}), .SET({1'b1, 1'b0, 1'bx, SET, SET, SET}), .D(D), .Q(Q[17:12]));
17 $sr #(.SET_POLARITY(1'b1), .CLR_POLARITY(1'b0), .WIDTH(6)) ff3 (.CLR({CLR, CLR, CLR, 1'b1, 1'b0, 1'bx}), .SET({1'b1, 1'b0, 1'bx, SET, SET, SET}), .Q(Q[23:18]));
25 # Equivalence check will fail for unmapped adlatch and dlatchsr due to negative hold hack.
26 #equiv_opt -undef -assert -multiclock opt_dff
29 select -assert-count 1 t:$dffsr
30 select -assert-count 1 t:$dffsr r:WIDTH=2 %i
31 select -assert-count 1 t:$dffsre
32 select -assert-count 1 t:$dffsre r:WIDTH=2 %i
33 select -assert-count 1 t:$dlatchsr
34 select -assert-count 1 t:$dlatchsr r:WIDTH=2 %i
35 select -assert-none t:$sr
39 #equiv_opt -undef -assert -multiclock opt_dff -keepdc
42 select -assert-count 1 t:$dffsr
43 select -assert-count 1 t:$dffsr r:WIDTH=4 %i
44 select -assert-count 1 t:$dffsre
45 select -assert-count 1 t:$dffsre r:WIDTH=4 %i
46 select -assert-count 1 t:$dlatchsr
47 select -assert-count 1 t:$dlatchsr r:WIDTH=4 %i
48 select -assert-count 1 t:$sr
49 select -assert-count 1 t:$sr r:WIDTH=4 %i
54 #equiv_opt -undef -assert -multiclock opt_dff
57 select -assert-count 1 t:$_DFF_PP0_
58 select -assert-count 1 t:$_DFF_PP1_
59 select -assert-count 1 t:$_DFFE_PN0P_
60 select -assert-count 1 t:$_DFFE_PN1P_
61 select -assert-count 1 t:$_DLATCH_PP0_
62 select -assert-count 1 t:$_DLATCH_PN1_
63 select -assert-none t:$_DFF_PP0_ t:$_DFF_PP1_ t:$_DFFE_PN0P_ t:$_DFFE_PN1P_ t:$_DLATCH_PP0_ t:$_DLATCH_PN1_ t:$_NOT_ %% %n t:* %i
68 #equiv_opt -undef -assert -multiclock opt_dff -keepdc
71 select -assert-count 1 t:$_DFF_PP0_
72 select -assert-count 1 t:$_DFF_PP1_
73 select -assert-count 2 t:$_DFFSR_PPP_
74 select -assert-count 1 t:$_DFFE_PN0P_
75 select -assert-count 1 t:$_DFFE_PN1P_
76 select -assert-count 2 t:$_DFFSRE_PNNP_
77 select -assert-count 1 t:$_DLATCH_PP0_
78 select -assert-count 1 t:$_DLATCH_PN1_
79 select -assert-count 2 t:$_DLATCHSR_PNP_
80 select -assert-count 1 t:$_DLATCH_P_
81 select -assert-count 1 t:$_DLATCH_N_
82 select -assert-count 2 t:$_SR_PN_
83 select -assert-none t:$_DFF_PP0_ t:$_DFF_PP1_ t:$_DFFSR_PPP_ t:$_DFFE_PN0P_ t:$_DFFE_PN1P_ t:$_DFFSRE_PNNP_ t:$_DLATCH_PP0_ t:$_DLATCH_PN1_ t:$_DLATCHSR_PNP_ t:$_NOT_ t:$_DLATCH_N_ t:$_DLATCH_P_ t:$_SR_PN_ %% %n t:* %i
89 ### Never-active CLR removal.
91 read_verilog -icells <<EOT
102 $dffsr #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b1), .CLR_POLARITY(1'b1), .WIDTH(6)) ff0 (.CLK(CLK), .CLR(6'h00), .SET({6{SET}}), .D(D), .Q(Q[5:0]));
103 $dffsre #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b0), .CLR_POLARITY(1'b0), .EN_POLARITY(1'b1), .WIDTH(6)) ff1 (.CLK(CLK), .EN(EN), .D(D), .CLR(6'h3f), .SET({6{SET}}), .Q(Q[11:6]));
104 $dlatchsr #(.SET_POLARITY(1'b0), .CLR_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(6)) ff2 (.EN(EN), .D(D), .CLR(6'h00), .SET({6{SET}}), .Q(Q[17:12]));
105 $sr #(.SET_POLARITY(1'b1), .CLR_POLARITY(1'b0), .WIDTH(6)) ff3 (.CLR(6'h3f), .SET({6{SET}}), .Q(Q[23:18]));
113 equiv_opt -undef -assert -multiclock opt_dff -keepdc
115 select -assert-count 0 t:$dffsr
116 select -assert-count 0 t:$dffsre
117 select -assert-count 0 t:$dlatchsr
118 select -assert-count 0 t:$sr
119 select -assert-count 1 t:$adff
120 select -assert-count 1 t:$adffe
121 select -assert-count 1 t:$adlatch
122 select -assert-count 1 t:$dlatch
128 ### Never-active CLR removal (not applicable).
130 read_verilog -icells <<EOT
142 $dffsr #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b1), .CLR_POLARITY(1'b1), .WIDTH(6)) ff0 (.CLK(CLK), .CLR(6'h00), .SET({{5{SET}}, ALT}), .D(D), .Q(Q[5:0]));
143 $dffsre #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b0), .CLR_POLARITY(1'b0), .EN_POLARITY(1'b1), .WIDTH(6)) ff1 (.CLK(CLK), .EN(EN), .D(D), .CLR(6'h3f), .SET({{5{SET}}, ALT}), .Q(Q[11:6]));
144 $dlatchsr #(.SET_POLARITY(1'b0), .CLR_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(6)) ff2 (.EN(EN), .D(D), .CLR(6'h00), .SET({{5{SET}}, ALT}), .Q(Q[17:12]));
145 $sr #(.SET_POLARITY(1'b1), .CLR_POLARITY(1'b0), .WIDTH(6)) ff3 (.CLR(6'h3f), .SET({{5{SET}}, ALT}), .Q(Q[23:18]));
153 equiv_opt -undef -assert -multiclock opt_dff -keepdc
155 select -assert-count 1 t:$dffsr
156 select -assert-count 1 t:$dffsre
157 select -assert-count 1 t:$dlatchsr
158 select -assert-count 1 t:$sr
159 select -assert-count 0 t:$adff
160 select -assert-count 0 t:$adffe
161 select -assert-count 0 t:$adlatch
162 select -assert-count 0 t:$dlatch
167 equiv_opt -undef -assert -multiclock opt_dff -keepdc
169 select -assert-count 0 t:$_DFFSR_*
170 select -assert-count 0 t:$_DFFSRE_*
171 select -assert-count 0 t:$_DLATCHSR_*
172 select -assert-count 0 t:$_SR_*
173 select -assert-count 6 t:$_DFF_PP1_
174 select -assert-count 6 t:$_DFFE_PN1P_
175 select -assert-count 6 t:$_DLATCH_PN1_
176 select -assert-count 6 t:$_DLATCH_P_
182 ### Never-active SET removal.
184 read_verilog -icells <<EOT
195 $dffsr #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b1), .CLR_POLARITY(1'b1), .WIDTH(6)) ff0 (.CLK(CLK), .CLR({6{CLR}}), .SET(6'h00), .D(D), .Q(Q[5:0]));
196 $dffsre #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b0), .CLR_POLARITY(1'b0), .EN_POLARITY(1'b1), .WIDTH(6)) ff1 (.CLK(CLK), .EN(EN), .D(D), .CLR({6{CLR}}), .SET(6'h3f), .Q(Q[11:6]));
197 $dlatchsr #(.SET_POLARITY(1'b0), .CLR_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(6)) ff2 (.EN(EN), .D(D), .CLR({6{CLR}}), .SET(6'h3f), .Q(Q[17:12]));
198 $sr #(.SET_POLARITY(1'b1), .CLR_POLARITY(1'b0), .WIDTH(6)) ff3 (.CLR({6{CLR}}), .SET(6'h00), .Q(Q[23:18]));
206 equiv_opt -undef -assert -multiclock opt_dff -keepdc
208 select -assert-count 0 t:$dffsr
209 select -assert-count 0 t:$dffsre
210 select -assert-count 0 t:$dlatchsr
211 select -assert-count 0 t:$sr
212 select -assert-count 1 t:$adff
213 select -assert-count 1 t:$adffe
214 select -assert-count 1 t:$adlatch
215 select -assert-count 1 t:$dlatch
221 ### Never-active CLR removal (not applicable).
223 read_verilog -icells <<EOT
235 $dffsr #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b1), .CLR_POLARITY(1'b1), .WIDTH(6)) ff0 (.CLK(CLK), .CLR({{5{CLR}}, ALT}), .SET(6'h00), .D(D), .Q(Q[5:0]));
236 $dffsre #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b0), .CLR_POLARITY(1'b0), .EN_POLARITY(1'b1), .WIDTH(6)) ff1 (.CLK(CLK), .EN(EN), .D(D), .CLR({{5{CLR}}, ALT}), .SET(6'h3f), .Q(Q[11:6]));
237 $dlatchsr #(.SET_POLARITY(1'b0), .CLR_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(6)) ff2 (.EN(EN), .D(D), .CLR({{5{CLR}}, ALT}), .SET(6'h3f), .Q(Q[17:12]));
238 $sr #(.SET_POLARITY(1'b1), .CLR_POLARITY(1'b0), .WIDTH(6)) ff3 (.CLR({{5{CLR}}, ALT}), .SET(6'h00), .Q(Q[23:18]));
246 equiv_opt -undef -assert -multiclock opt_dff -keepdc
248 select -assert-count 1 t:$dffsr
249 select -assert-count 1 t:$dffsre
250 select -assert-count 1 t:$dlatchsr
251 select -assert-count 1 t:$sr
252 select -assert-count 0 t:$adff
253 select -assert-count 0 t:$adffe
254 select -assert-count 0 t:$adlatch
255 select -assert-count 0 t:$dlatch
260 equiv_opt -undef -assert -multiclock opt_dff -keepdc
262 select -assert-count 0 t:$_DFFSR_*
263 select -assert-count 0 t:$_DFFSRE_*
264 select -assert-count 0 t:$_DLATCHSR_*
265 select -assert-count 0 t:$_SR_*
266 select -assert-count 6 t:$_DFF_PP0_
267 select -assert-count 6 t:$_DFFE_PN0P_
268 select -assert-count 6 t:$_DLATCH_PP0_
269 select -assert-count 6 t:$_DLATCH_N_
275 ### SET/CLR merge into ARST.
277 read_verilog -icells <<EOT
287 $dffsr #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b1), .CLR_POLARITY(1'b1), .WIDTH(6)) ff0 (.CLK(CLK), .CLR({ARST, 5'h00}), .SET({1'b0, {5{ARST}}}), .D(D), .Q(Q[5:0]));
288 $dffsre #(.CLK_POLARITY(1'b1), .SET_POLARITY(1'b0), .CLR_POLARITY(1'b0), .EN_POLARITY(1'b1), .WIDTH(6)) ff1 (.CLK(CLK), .EN(EN), .D(D), .CLR({ARST, 5'h1f}), .SET({1'b1, {5{ARST}}}), .Q(Q[11:6]));
289 $dlatchsr #(.SET_POLARITY(1'b0), .CLR_POLARITY(1'b1), .EN_POLARITY(1'b1), .WIDTH(6)) ff2 (.EN(EN), .D(D), .CLR({ARST, 5'h00}), .SET({1'b1, {5{ARST}}}), .Q(Q[17:12]));
290 $sr #(.SET_POLARITY(1'b1), .CLR_POLARITY(1'b0), .WIDTH(6)) ff3 (.CLR({ARST, 5'h1f}), .SET({1'b0, {5{ARST}}}), .Q(Q[23:18]));
298 equiv_opt -undef -assert -multiclock opt_dff -keepdc
300 select -assert-count 0 t:$dffsr
301 select -assert-count 0 t:$dffsre
302 select -assert-count 1 t:$dlatchsr
303 select -assert-count 1 t:$sr
304 select -assert-count 1 t:$adff
305 select -assert-count 1 t:$adff r:ARST_VALUE=6'h1f %i
306 select -assert-count 1 t:$adffe
307 select -assert-count 1 t:$adffe r:ARST_VALUE=6'h1f %i
308 select -assert-count 0 t:$adlatch
309 select -assert-count 0 t:$dlatch