Fixed stdcells.v for $adff with undef reset value
authorClifford Wolf <clifford@clifford.at>
Sun, 24 Mar 2013 09:43:05 +0000 (10:43 +0100)
committerClifford Wolf <clifford@clifford.at>
Sun, 24 Mar 2013 09:43:05 +0000 (10:43 +0100)
techlibs/stdcells.v

index 9733c370cbcd0304d8cfe2d9f022d3c573f401ea..e4a034c6e2e83b84046ec69b7af0d6df6e213a99 100644 (file)
@@ -1305,69 +1305,74 @@ output [WIDTH-1:0] Q;
 genvar i;
 generate
        for (i = 0; i < WIDTH; i = i + 1) begin:V
-               if (CLK_POLARITY == 0 && ARST_POLARITY == 0 && ARST_VALUE[i] == 0) begin:NN0
-                        \$_DFF_NN0_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY == 0 && ARST_POLARITY == 0 && ARST_VALUE[i] != 0) begin:NN1
-                        \$_DFF_NN1_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY == 0 && ARST_POLARITY != 0 && ARST_VALUE[i] == 0) begin:NP0
-                        \$_DFF_NP0_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY == 0 && ARST_POLARITY != 0 && ARST_VALUE[i] != 0) begin:NP1
-                        \$_DFF_NP1_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY != 0 && ARST_POLARITY == 0 && ARST_VALUE[i] == 0) begin:PN0
-                        \$_DFF_PN0_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY != 0 && ARST_POLARITY == 0 && ARST_VALUE[i] != 0) begin:PN1
-                        \$_DFF_PN1_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY != 0 && ARST_POLARITY != 0 && ARST_VALUE[i] == 0) begin:PP0
-                        \$_DFF_PP0_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
-               end
-               if (CLK_POLARITY != 0 && ARST_POLARITY != 0 && ARST_VALUE[i] != 0) begin:PP1
-                        \$_DFF_PP1_ ff (
-                               .D(D[i]),
-                               .Q(Q[i]),
-                               .C(CLK),
-                               .R(ARST)
-                       );
+               if (CLK_POLARITY == 0) begin:N
+                       if (ARST_POLARITY == 0) begin:NN
+                               if (ARST_VALUE[i] == 0) begin:NN0
+                                        \$_DFF_NN0_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end else begin:NN1
+                                        \$_DFF_NN1_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end
+                       end else begin:NP
+                               if (ARST_VALUE[i] == 0) begin:NP0
+                                        \$_DFF_NP0_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end else begin:NP1
+                                        \$_DFF_NP1_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end
+                       end
+               end else begin:P
+                       if (ARST_POLARITY == 0) begin:PN
+                               if (ARST_VALUE[i] == 0) begin:PN0
+                                        \$_DFF_PN0_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end else begin:PN1
+                                        \$_DFF_PN1_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end
+                       end else begin:PP
+                               if (ARST_VALUE[i] == 0) begin:PP0
+                                        \$_DFF_PP0_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end else begin:PP1
+                                        \$_DFF_PP1_ ff (
+                                               .D(D[i]),
+                                               .Q(Q[i]),
+                                               .C(CLK),
+                                               .R(ARST)
+                                       );
+                               end
+                       end
                end
        end
 endgenerate