formatting

This commit is contained in:
Kevin Kim 2023-03-22 10:14:12 -07:00
parent 3f46dff23e
commit c8a5514ca5
5 changed files with 10 additions and 11 deletions

View File

@ -30,12 +30,12 @@
`include "wally-config.vh"
module bitreverse #(parameter WIDTH=32) (
input logic [WIDTH-1:0] a,
output logic [WIDTH-1:0] b);
input logic [WIDTH-1:0] A,
output logic [WIDTH-1:0] RevA);
genvar i;
for (i=0; i<WIDTH;i++) begin:loop
assign b[WIDTH-i-1] = a[i];
assign RevA[WIDTH-i-1] = A[i];
end
endmodule

View File

@ -35,8 +35,7 @@ module clmul #(parameter WIDTH=32) (
logic [(WIDTH*WIDTH)-1:0] s; // intermediary signals for carry-less multiply
integer i;
integer j;
integer i,j;
always_comb begin
for (i=0;i<WIDTH;i++) begin: outer

View File

@ -57,9 +57,9 @@ module cnt #(parameter WIDTH = 32) (
lzc #(WIDTH) lzc(.num(lzcA), .ZeroCnt(czResult[$clog2(WIDTH):0]));
popcnt #(WIDTH) popcntw(.num(popcntA), .PopCnt(cpopResult[$clog2(WIDTH):0]));
// zero extend these results to fit into width *** There may be a more elegant way to do this
assign czResult[WIDTH-1:$clog2(WIDTH)+1] = {(WIDTH-$clog2(WIDTH)-1){1'b0}};
assign cpopResult[WIDTH-1:$clog2(WIDTH)+1] = {(WIDTH-$clog2(WIDTH)-1){1'b0}};
// zero extend these results to fit into width
assign czResult[WIDTH-1:$clog2(WIDTH)+1] = '0;
assign cpopResult[WIDTH-1:$clog2(WIDTH)+1] = '0;
mux2 #(WIDTH) cntresultmux(czResult, cpopResult, B[1], CntResult);
endmodule

View File

@ -38,5 +38,5 @@ module popcnt #(parameter WIDTH = 32) (
end
end
assign PopCnt = sum[$clog2(WIDTH):0];
assign PopCnt = sum;
endmodule

View File

@ -41,14 +41,14 @@ module zbc #(parameter WIDTH=32) (
assign select = ~Funct3[1:0];
bitreverse #(WIDTH) brB(.a(B), .b(RevB));
bitreverse #(WIDTH) brB(.A(B), .RevA(RevB));
mux3 #(WIDTH) xmux({RevA[WIDTH-2:0], {1'b0}}, RevA, A, select, x);
mux3 #(WIDTH) ymux({{1'b0},RevB[WIDTH-2:0]}, RevB, B, select, y);
clmul #(WIDTH) clm(.A(x), .B(y), .ClmulResult(ClmulResult));
bitreverse #(WIDTH) brClmulResult(.a(ClmulResult), .b(RevClmulResult));
bitreverse #(WIDTH) brClmulResult(.A(ClmulResult), .RevA(RevClmulResult));
mux2 #(WIDTH) zbcresultmux(ClmulResult, RevClmulResult, Funct3[1], ZBCResult);
endmodule