mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 18:25:27 +00:00
formatting
This commit is contained in:
parent
3f46dff23e
commit
c8a5514ca5
@ -30,12 +30,12 @@
|
|||||||
`include "wally-config.vh"
|
`include "wally-config.vh"
|
||||||
|
|
||||||
module bitreverse #(parameter WIDTH=32) (
|
module bitreverse #(parameter WIDTH=32) (
|
||||||
input logic [WIDTH-1:0] a,
|
input logic [WIDTH-1:0] A,
|
||||||
output logic [WIDTH-1:0] b);
|
output logic [WIDTH-1:0] RevA);
|
||||||
|
|
||||||
genvar i;
|
genvar i;
|
||||||
for (i=0; i<WIDTH;i++) begin:loop
|
for (i=0; i<WIDTH;i++) begin:loop
|
||||||
assign b[WIDTH-i-1] = a[i];
|
assign RevA[WIDTH-i-1] = A[i];
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ module clmul #(parameter WIDTH=32) (
|
|||||||
|
|
||||||
logic [(WIDTH*WIDTH)-1:0] s; // intermediary signals for carry-less multiply
|
logic [(WIDTH*WIDTH)-1:0] s; // intermediary signals for carry-less multiply
|
||||||
|
|
||||||
integer i;
|
integer i,j;
|
||||||
integer j;
|
|
||||||
|
|
||||||
always_comb begin
|
always_comb begin
|
||||||
for (i=0;i<WIDTH;i++) begin: outer
|
for (i=0;i<WIDTH;i++) begin: outer
|
||||||
|
@ -57,9 +57,9 @@ module cnt #(parameter WIDTH = 32) (
|
|||||||
|
|
||||||
lzc #(WIDTH) lzc(.num(lzcA), .ZeroCnt(czResult[$clog2(WIDTH):0]));
|
lzc #(WIDTH) lzc(.num(lzcA), .ZeroCnt(czResult[$clog2(WIDTH):0]));
|
||||||
popcnt #(WIDTH) popcntw(.num(popcntA), .PopCnt(cpopResult[$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
|
// zero extend these results to fit into width
|
||||||
assign czResult[WIDTH-1:$clog2(WIDTH)+1] = {(WIDTH-$clog2(WIDTH)-1){1'b0}};
|
assign czResult[WIDTH-1:$clog2(WIDTH)+1] = '0;
|
||||||
assign cpopResult[WIDTH-1:$clog2(WIDTH)+1] = {(WIDTH-$clog2(WIDTH)-1){1'b0}};
|
assign cpopResult[WIDTH-1:$clog2(WIDTH)+1] = '0;
|
||||||
|
|
||||||
mux2 #(WIDTH) cntresultmux(czResult, cpopResult, B[1], CntResult);
|
mux2 #(WIDTH) cntresultmux(czResult, cpopResult, B[1], CntResult);
|
||||||
endmodule
|
endmodule
|
@ -38,5 +38,5 @@ module popcnt #(parameter WIDTH = 32) (
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
assign PopCnt = sum[$clog2(WIDTH):0];
|
assign PopCnt = sum;
|
||||||
endmodule
|
endmodule
|
||||||
|
@ -41,14 +41,14 @@ module zbc #(parameter WIDTH=32) (
|
|||||||
|
|
||||||
assign select = ~Funct3[1:0];
|
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) xmux({RevA[WIDTH-2:0], {1'b0}}, RevA, A, select, x);
|
||||||
mux3 #(WIDTH) ymux({{1'b0},RevB[WIDTH-2:0]}, RevB, B, select, y);
|
mux3 #(WIDTH) ymux({{1'b0},RevB[WIDTH-2:0]}, RevB, B, select, y);
|
||||||
|
|
||||||
clmul #(WIDTH) clm(.A(x), .B(y), .ClmulResult(ClmulResult));
|
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);
|
mux2 #(WIDTH) zbcresultmux(ClmulResult, RevClmulResult, Funct3[1], ZBCResult);
|
||||||
endmodule
|
endmodule
|
Loading…
Reference in New Issue
Block a user