Performance fix for new $__lcu techmap rule
authorClifford Wolf <clifford@clifford.at>
Sun, 17 Aug 2014 22:27:54 +0000 (00:27 +0200)
committerClifford Wolf <clifford@clifford.at>
Sun, 17 Aug 2014 22:27:54 +0000 (00:27 +0200)
techlibs/common/techmap.v

index 5bbe883ef41df9be5615f2bfa081589df0fe08a1..366351ec0633248ffd9bf5705a23df0ba28e8315 100644 (file)
@@ -293,7 +293,7 @@ module \$__lcu (P, G, CI, CO);
 
        output reg [WIDTH:0] CO;
 
-       integer i, j, k;
+       integer i, j;
        reg [WIDTH-1:0] p, g;
 
        wire [1023:0] _TECHMAP_DO_ = "proc; opt -fast";
@@ -312,18 +312,16 @@ module \$__lcu (P, G, CI, CO);
                // Main tree
                for (i = 1; i <= $clog2(WIDTH); i = i+1) begin
                        for (j = 2**i - 1; j < WIDTH; j = j + 2**i) begin
-                               k = j - 2**(i-1);
-                               g[j] = g[j] | p[j] & g[k];
-                               p[j] = p[j] & p[k];
+                               g[j] = g[j] | p[j] & g[j - 2**(i-1)];
+                               p[j] = p[j] & p[j - 2**(i-1)];
                        end
                end
 
                // Inverse tree
                for (i = $clog2(WIDTH); i > 0; i = i-1) begin
                        for (j = 2**i + 2**(i-1) - 1; j < WIDTH; j = j + 2**i) begin
-                               k = j - 2**(i-1);
-                               g[j] = g[j] | p[j] & g[k];
-                               p[j] = p[j] & p[k];
+                               g[j] = g[j] | p[j] & g[j - 2**(i-1)];
+                               p[j] = p[j] & p[j - 2**(i-1)];
                        end
                end
        end