Fix copy-pasta issue

This commit is contained in:
Eddie Hung 2019-06-17 22:29:22 -07:00
parent 2a35c4ef94
commit 608a95eb01
1 changed files with 8 additions and 9 deletions

View File

@ -32,28 +32,27 @@ module \$lut (A, Y);
// Need to swap input ordering, and fix init accordingly, // Need to swap input ordering, and fix init accordingly,
// to match ABC's expectation of LUT inputs in non-decreasing // to match ABC's expectation of LUT inputs in non-decreasing
// delay order // delay order
localparam P_WIDTH = WIDTH < 4 ? 4 : WIDTH; function [WIDTH-1:0] permute_index;
function [P_WIDTH-1:0] permute_index; input [WIDTH-1:0] i;
input [P_WIDTH-1:0] i;
integer j; integer j;
begin begin
permute_index = 0; permute_index = 0;
for (j = 0; j < P_WIDTH; j = j + 1) for (j = 0; j < WIDTH; j = j + 1)
permute_index[P_WIDTH-1 - j] = i[j]; permute_index[WIDTH-1 - j] = i[j];
end end
endfunction endfunction
function [2**P_WIDTH-1:0] permute_init; function [2**WIDTH-1:0] permute_init;
input [2**P_WIDTH-1:0] orig; input [2**WIDTH-1:0] orig;
integer i; integer i;
begin begin
permute_init = 0; permute_init = 0;
for (i = 0; i < 2**P_WIDTH; i = i + 1) for (i = 0; i < 2**WIDTH; i = i + 1)
permute_init[i] = orig[permute_index(i)]; permute_init[i] = orig[permute_index(i)];
end end
endfunction endfunction
parameter [2**P_WIDTH-1:0] P_LUT = permute_init(LUT); parameter [2**WIDTH-1:0] P_LUT = permute_init(LUT);
generate generate
if (WIDTH == 1) begin if (WIDTH == 1) begin