mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge branch 'openhwgroup:main' into main
This commit is contained in:
commit
2fc214bb2d
@ -34,6 +34,10 @@ for dir in `ls ${WALLY}/addins/riscv-arch-test/riscv-test-suite/rv*/*`
|
|||||||
do
|
do
|
||||||
dir=$(echo $dir | cut -d':' -f1)
|
dir=$(echo $dir | cut -d':' -f1)
|
||||||
echo $dir
|
echo $dir
|
||||||
|
if [ $dir == "src" ]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
for fn in `ls $dir/src/*.S`
|
for fn in `ls $dir/src/*.S`
|
||||||
do
|
do
|
||||||
result=`grep 'inst_' $fn | tail -n 1`
|
result=`grep 'inst_' $fn | tail -n 1`
|
||||||
|
@ -109,7 +109,9 @@ module alu import cvw::*; #(parameter cvw_t P) (
|
|||||||
else assign PreALUResult = FullResult;
|
else assign PreALUResult = FullResult;
|
||||||
|
|
||||||
// Bit manipulation muxing
|
// Bit manipulation muxing
|
||||||
if (P.ZBC_SUPPORTED | P.ZBS_SUPPORTED | P.ZBA_SUPPORTED | P.ZBB_SUPPORTED | P.ZBKB_SUPPORTED | P.ZBKC_SUPPORTED | P.ZBKX_SUPPORTED | P.ZKND_SUPPORTED | P.ZKNE_SUPPORTED | P.ZKNH_SUPPORTED) begin : bitmanipalu
|
if (P.ZBC_SUPPORTED | P.ZBS_SUPPORTED | P.ZBA_SUPPORTED | P.ZBB_SUPPORTED |
|
||||||
|
P.ZBKB_SUPPORTED | P.ZBKC_SUPPORTED | P.ZBKX_SUPPORTED |
|
||||||
|
P.ZKND_SUPPORTED | P.ZKNE_SUPPORTED | P.ZKNH_SUPPORTED) begin : bitmanipalu
|
||||||
bitmanipalu #(P) balu(
|
bitmanipalu #(P) balu(
|
||||||
.A, .B, .W64, .BSelect, .ZBBSelect, .BMUActive,
|
.A, .B, .W64, .BSelect, .ZBBSelect, .BMUActive,
|
||||||
.Funct3, .Funct7, .Rs2E, .LT,.LTU, .BALUControl, .PreALUResult, .FullResult,
|
.Funct3, .Funct7, .Rs2E, .LT,.LTU, .BALUControl, .PreALUResult, .FullResult,
|
||||||
|
@ -87,7 +87,7 @@ module bitmanipalu import cvw::*; #(parameter cvw_t P) (
|
|||||||
end
|
end
|
||||||
|
|
||||||
// Bit reverse needed for some ZBB, ZBC instructions
|
// Bit reverse needed for some ZBB, ZBC instructions
|
||||||
if (P.ZBC_SUPPORTED | P.ZBB_SUPPORTED) begin: bitreverse
|
if (P.ZBC_SUPPORTED | P.ZBKC_SUPPORTED | P.ZBB_SUPPORTED) begin: bitreverse
|
||||||
bitreverse #(P.XLEN) brA(.A(ABMU), .RevA);
|
bitreverse #(P.XLEN) brA(.A(ABMU), .RevA);
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -99,6 +99,11 @@ module bitmanipalu import cvw::*; #(parameter cvw_t P) (
|
|||||||
// ZBB Unit
|
// ZBB Unit
|
||||||
if (P.ZBB_SUPPORTED) begin: zbb
|
if (P.ZBB_SUPPORTED) begin: zbb
|
||||||
zbb #(P.XLEN) ZBB(.A(ABMU), .RevA, .B(BBMU), .W64, .LT, .LTU, .BUnsigned(Funct3[0]), .ZBBSelect(ZBBSelect[2:0]), .ZBBResult);
|
zbb #(P.XLEN) ZBB(.A(ABMU), .RevA, .B(BBMU), .W64, .LT, .LTU, .BUnsigned(Funct3[0]), .ZBBSelect(ZBBSelect[2:0]), .ZBBResult);
|
||||||
|
end else if (P.ZBKB_SUPPORTED) begin: zbkbonly // only needs rev8 portion
|
||||||
|
genvar i;
|
||||||
|
for (i=0;i<P.XLEN;i+=8) begin:byteloop
|
||||||
|
assign ZBBResult[P.XLEN-i-1:P.XLEN-i-8] = ABMU[i+7:i]; // Rev8
|
||||||
|
end
|
||||||
end else assign ZBBResult = '0;
|
end else assign ZBBResult = '0;
|
||||||
|
|
||||||
// ZBKB Unit
|
// ZBKB Unit
|
||||||
|
@ -98,10 +98,6 @@ module bmuctrl import cvw::*; #(parameter cvw_t P) (
|
|||||||
BMUControlsD = `BMUCTRLW'b000_0010_0001_1_1_0_1_0_0_0_0_0; // sign extend instruction
|
BMUControlsD = `BMUCTRLW'b000_0010_0001_1_1_0_1_0_0_0_0_0; // sign extend instruction
|
||||||
else if ((Rs2D[4:2]==3'b000) & ~(Rs2D[1] & Rs2D[0]))
|
else if ((Rs2D[4:2]==3'b000) & ~(Rs2D[1] & Rs2D[0]))
|
||||||
BMUControlsD = `BMUCTRLW'b000_0010_0000_1_1_0_1_0_0_0_0_0; // count instruction
|
BMUControlsD = `BMUCTRLW'b000_0010_0000_1_1_0_1_0_0_0_0_0; // count instruction
|
||||||
// // coverage off: This case can't occur in RV64
|
|
||||||
// 17'b0110011_0000100_100: if (P.XLEN == 32)
|
|
||||||
// BMUControlsD = `BMUCTRLW'b000_10_001_1_1_0_1_0_0_0_0_0; // zexth (rv32)
|
|
||||||
// // coverage on
|
|
||||||
17'b0010011_0010100_101: if (Rs2D[4:0] == 5'b00111)
|
17'b0010011_0010100_101: if (Rs2D[4:0] == 5'b00111)
|
||||||
BMUControlsD = `BMUCTRLW'b000_0010_0010_1_1_0_1_0_0_0_0_0; // orc.b
|
BMUControlsD = `BMUCTRLW'b000_0010_0010_1_1_0_1_0_0_0_0_0; // orc.b
|
||||||
17'b0110011_0000101_110: BMUControlsD = `BMUCTRLW'b000_0010_0111_1_0_0_1_1_0_0_0_0; // max
|
17'b0110011_0000101_110: BMUControlsD = `BMUCTRLW'b000_0010_0111_1_0_0_1_1_0_0_0_0; // max
|
||||||
@ -124,12 +120,13 @@ module bmuctrl import cvw::*; #(parameter cvw_t P) (
|
|||||||
if (P.ZBC_SUPPORTED)
|
if (P.ZBC_SUPPORTED)
|
||||||
casez({OpD, Funct7D, Funct3D})
|
casez({OpD, Funct7D, Funct3D})
|
||||||
17'b0110011_0000101_010: BMUControlsD = `BMUCTRLW'b000_0011_0001_1_0_0_1_0_0_0_0_0; // clmulr
|
17'b0110011_0000101_010: BMUControlsD = `BMUCTRLW'b000_0011_0001_1_0_0_1_0_0_0_0_0; // clmulr
|
||||||
17'b0110011_0000101_0??: BMUControlsD = `BMUCTRLW'b000_0011_0000_1_0_0_1_0_0_0_0_0; // ZBC instruction
|
17'b0110011_0000101_0??: BMUControlsD = `BMUCTRLW'b000_0011_0000_1_0_0_1_0_0_0_0_0; // clmul/clmulh
|
||||||
endcase
|
endcase
|
||||||
if (P.ZBKC_SUPPORTED | P.ZBC_SUPPORTED) begin
|
if (P.ZBKC_SUPPORTED) begin
|
||||||
casez({OpD, Funct7D, Funct3D})
|
casez({OpD, Funct7D, Funct3D})
|
||||||
17'b0110011_0000101_001: BMUControlsD = `BMUCTRLW'b000_0011_0000_1_0_0_1_0_0_0_0_0; // clmul
|
17'b0110011_0000101_0??: BMUControlsD = `BMUCTRLW'b000_0011_0000_1_0_0_1_0_0_0_0_0; // clmul/clmulh
|
||||||
17'b0110011_0000101_011: BMUControlsD = `BMUCTRLW'b000_0011_0001_1_0_0_1_0_0_0_0_0; // clmulh
|
// 17'b0110011_0000101_001: BMUControlsD = `BMUCTRLW'b000_0011_0000_1_0_0_1_0_0_0_0_0; // clmul
|
||||||
|
// 17'b0110011_0000101_011: BMUControlsD = `BMUCTRLW'b000_0011_0001_1_0_0_1_0_0_0_0_0; // clmulh
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -179,7 +179,9 @@ module controller import cvw::*; #(parameter cvw_t P) (
|
|||||||
// Be rigorous about detecting illegal instructions if CSRs or bit manipulation or conditional ops are supported
|
// Be rigorous about detecting illegal instructions if CSRs or bit manipulation or conditional ops are supported
|
||||||
// otherwise be cheap
|
// otherwise be cheap
|
||||||
|
|
||||||
if (P.ZICSR_SUPPORTED | P.ZBA_SUPPORTED | P.ZBB_SUPPORTED | P.ZBC_SUPPORTED | P.ZBS_SUPPORTED | P.ZICOND_SUPPORTED) begin:legalcheck // Exact integer decoding
|
if (P.ZICSR_SUPPORTED | P.ZBA_SUPPORTED | P.ZBB_SUPPORTED | P.ZBC_SUPPORTED | P.ZBS_SUPPORTED |
|
||||||
|
P.ZBKB_SUPPORTED | P.ZBKC_SUPPORTED | P.ZBKX_SUPPORTED | P.ZKNE_SUPPORTED |
|
||||||
|
P.ZKND_SUPPORTED | P.ZKNH_SUPPORTED | P.ZICOND_SUPPORTED) begin:legalcheck // Exact integer decoding
|
||||||
logic Funct7ZeroD, Funct7b5D, IShiftD, INoShiftD;
|
logic Funct7ZeroD, Funct7b5D, IShiftD, INoShiftD;
|
||||||
logic Funct7ShiftZeroD, Funct7Shiftb5D;
|
logic Funct7ShiftZeroD, Funct7Shiftb5D;
|
||||||
|
|
||||||
@ -322,7 +324,9 @@ module controller import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign BaseSubArithD = ALUOpD & (subD | sraD | sltD | sltuD);
|
assign BaseSubArithD = ALUOpD & (subD | sraD | sltD | sltuD);
|
||||||
|
|
||||||
// bit manipulation Configuration Block
|
// bit manipulation Configuration Block
|
||||||
if (P.ZBS_SUPPORTED | P.ZBA_SUPPORTED | P.ZBB_SUPPORTED | P.ZBC_SUPPORTED) begin: bitmanipi //change the conditional expression to OR any Z supported flags
|
if (P.ZBS_SUPPORTED | P.ZBA_SUPPORTED | P.ZBB_SUPPORTED | P.ZBC_SUPPORTED |
|
||||||
|
P.ZBKB_SUPPORTED | P.ZBKC_SUPPORTED | P.ZBKX_SUPPORTED | P.ZKNE_SUPPORTED |
|
||||||
|
P.ZKND_SUPPORTED | P.ZKNH_SUPPORTED) begin: bitmanipi
|
||||||
logic IllegalBitmanipInstrD; // Unrecognized B instruction
|
logic IllegalBitmanipInstrD; // Unrecognized B instruction
|
||||||
logic BRegWriteD; // Indicates if it is a R type BMU instruction in decode stage
|
logic BRegWriteD; // Indicates if it is a R type BMU instruction in decode stage
|
||||||
logic BW64D; // Indicates if it is a W type BMU instruction in decode stage
|
logic BW64D; // Indicates if it is a W type BMU instruction in decode stage
|
||||||
|
@ -40,7 +40,7 @@ module shifter import cvw::*; #(parameter cvw_t P) (
|
|||||||
|
|
||||||
assign Sign = A[P.XLEN-1] & SubArith; // sign bit for sign extension
|
assign Sign = A[P.XLEN-1] & SubArith; // sign bit for sign extension
|
||||||
if (P.XLEN==32) begin // rv32
|
if (P.XLEN==32) begin // rv32
|
||||||
if (P.ZBB_SUPPORTED) begin: rotfunnel32 //rv32 shifter with rotates
|
if (P.ZBB_SUPPORTED | P.ZBKB_SUPPORTED) begin: rotfunnel32 //rv32 shifter with rotates
|
||||||
always_comb // funnel mux
|
always_comb // funnel mux
|
||||||
case({Right, Rotate})
|
case({Right, Rotate})
|
||||||
2'b00: Z = {A[31:0], 31'b0};
|
2'b00: Z = {A[31:0], 31'b0};
|
||||||
@ -57,7 +57,7 @@ module shifter import cvw::*; #(parameter cvw_t P) (
|
|||||||
end else begin // rv64
|
end else begin // rv64
|
||||||
logic [P.XLEN-1:0] A64;
|
logic [P.XLEN-1:0] A64;
|
||||||
mux3 #(64) extendmux({{32{1'b0}}, A[31:0]}, {{32{A[31]}}, A[31:0]}, A, {~W64, SubArith}, A64); // bottom 32 bits are always A[31:0], so effectively a 32-bit upper mux
|
mux3 #(64) extendmux({{32{1'b0}}, A[31:0]}, {{32{A[31]}}, A[31:0]}, A, {~W64, SubArith}, A64); // bottom 32 bits are always A[31:0], so effectively a 32-bit upper mux
|
||||||
if (P.ZBB_SUPPORTED) begin: rotfunnel64 // rv64 shifter with rotates
|
if (P.ZBB_SUPPORTED | P.ZBKB_SUPPORTED) begin: rotfunnel64 // rv64 shifter with rotates
|
||||||
// shifter rotate source select mux
|
// shifter rotate source select mux
|
||||||
logic [P.XLEN-1:0] RotA; // rotate source
|
logic [P.XLEN-1:0] RotA; // rotate source
|
||||||
mux2 #(P.XLEN) rotmux(A, {A[31:0], A[31:0]}, W64, RotA); // W64 rotatons
|
mux2 #(P.XLEN) rotmux(A, {A[31:0], A[31:0]}, W64, RotA); // W64 rotatons
|
||||||
|
Loading…
Reference in New Issue
Block a user