mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-24 05:47:35 -04:00
minor FPU RTL fixes
This commit is contained in:
parent
66b8a27d8f
commit
c806babd1b
5 changed files with 35 additions and 179 deletions
|
@ -1,155 +0,0 @@
|
|||
rv32ud-p-fadd.hex ✅
|
||||
rv32ud-p-fclass.hex ✅
|
||||
rv32ud-p-fcmp.hex ✅
|
||||
rv32ud-p-fcvt.hex ✅
|
||||
rv32ud-p-fcvt_w.hex ✅
|
||||
rv32ud-p-fdiv.hex ✅
|
||||
rv32ud-p-fmadd.hex ✅
|
||||
rv32ud-p-fmin.hex ✅
|
||||
rv32ud-p-ldst.hex ✅
|
||||
rv32ud-p-recoding.hex ✅
|
||||
rv32uf-p-fadd.hex ✅
|
||||
rv32uf-p-fclass.hex ✅
|
||||
rv32uf-p-fcmp.hex ✅
|
||||
rv32uf-p-fcvt.hex ✅
|
||||
rv32uf-p-fcvt_w.hex ✅
|
||||
rv32uf-p-fdiv.hex ✅
|
||||
rv32uf-p-fmadd.hex ✅
|
||||
rv32uf-p-fmin.hex ✅
|
||||
rv32uf-p-ldst.hex ✅
|
||||
rv32uf-p-move.hex ✅
|
||||
rv32uf-p-recoding.hex ✅
|
||||
rv32ui-p-add.hex ✅
|
||||
rv32ui-p-addi.hex ✅
|
||||
rv32ui-p-and.hex ✅
|
||||
rv32ui-p-andi.hex ✅
|
||||
rv32ui-p-auipc.hex ✅
|
||||
rv32ui-p-beq.hex ✅
|
||||
rv32ui-p-bge.hex ✅
|
||||
rv32ui-p-bgeu.hex ✅
|
||||
rv32ui-p-blt.hex ✅
|
||||
rv32ui-p-bltu.hex ✅
|
||||
rv32ui-p-bne.hex ✅
|
||||
rv32ui-p-fence_i.hex ✅
|
||||
rv32ui-p-jal.hex ✅
|
||||
rv32ui-p-jalr.hex ✅
|
||||
rv32ui-p-lb.hex ✅
|
||||
rv32ui-p-lbu.hex ✅
|
||||
rv32ui-p-lh.hex ✅
|
||||
rv32ui-p-lhu.hex ✅
|
||||
rv32ui-p-lui.hex ✅
|
||||
rv32ui-p-lw.hex ✅
|
||||
rv32ui-p-or.hex ✅
|
||||
rv32ui-p-ori.hex ✅
|
||||
rv32ui-p-sb.hex ✅
|
||||
rv32ui-p-sh.hex ✅
|
||||
rv32ui-p-simple.hex ✅
|
||||
rv32ui-p-sll.hex ✅
|
||||
rv32ui-p-slli.hex ✅
|
||||
rv32ui-p-slt.hex ✅
|
||||
rv32ui-p-slti.hex ✅
|
||||
rv32ui-p-sltiu.hex ✅
|
||||
rv32ui-p-sltu.hex ✅
|
||||
rv32ui-p-sra.hex ✅
|
||||
rv32ui-p-srai.hex ✅
|
||||
rv32ui-p-srl.hex ✅
|
||||
rv32ui-p-srli.hex ✅
|
||||
rv32ui-p-sub.hex ✅
|
||||
rv32ui-p-sw.hex ✅
|
||||
rv32ui-p-xor.hex ✅
|
||||
rv32ui-p-xori.hex ✅
|
||||
rv32um-p-div.hex ✅
|
||||
rv32um-p-divu.hex ✅
|
||||
rv32um-p-mul.hex ✅
|
||||
rv32um-p-mulh.hex ✅
|
||||
rv32um-p-mulhsu.hex ✅
|
||||
rv32um-p-mulhu.hex ✅
|
||||
rv32um-p-rem.hex ✅
|
||||
rv32um-p-remu.hex ✅
|
||||
rv64ud-p-fadd.hex ❌
|
||||
rv64ud-p-fclass.hex ❌
|
||||
rv64ud-p-fcmp.hex ❌
|
||||
rv64ud-p-fcvt.hex ❌
|
||||
rv64ud-p-fcvt_w.hex ❌
|
||||
rv64ud-p-fdiv.hex ❌
|
||||
rv64ud-p-fmadd.hex ❌
|
||||
rv64ud-p-fmin.hex ❌
|
||||
rv64ud-p-ldst.hex ❌ exitcode=13
|
||||
rv64ud-p-move.hex ❌
|
||||
rv64ud-p-recoding.hex ❌
|
||||
rv64ud-p-structural.hex ❌
|
||||
rv64uf-p-fadd.hex ❌ exitcode=7
|
||||
rv64uf-p-fclass.hex ✅
|
||||
rv64uf-p-fcmp.hex ✅
|
||||
rv64uf-p-fcvt.hex ❌ exitcode=7
|
||||
rv64uf-p-fcvt_w.hex ❌ exitcode=5
|
||||
rv64uf-p-fdiv.hex ❌ exitcode=7
|
||||
rv64uf-p-fmadd.hex ❌ exitcode=9
|
||||
rv64uf-p-fmin.hex ❌ exitcode=7
|
||||
rv64uf-p-ldst.hex ❌ exitcode=5
|
||||
rv64uf-p-move.hex ❌ exitcode=23
|
||||
rv64uf-p-recoding.hex ✅
|
||||
rv64ui-p-add.hex ✅
|
||||
rv64ui-p-addi.hex ✅
|
||||
rv64ui-p-addiw.hex ✅
|
||||
rv64ui-p-addw.hex ✅
|
||||
rv64ui-p-and.hex ✅
|
||||
rv64ui-p-andi.hex ✅
|
||||
rv64ui-p-auipc.hex ✅
|
||||
rv64ui-p-beq.hex ✅
|
||||
rv64ui-p-bge.hex ✅
|
||||
rv64ui-p-bgeu.hex ✅
|
||||
rv64ui-p-blt.hex ✅
|
||||
rv64ui-p-bltu.hex ✅
|
||||
rv64ui-p-bne.hex ✅
|
||||
rv64ui-p-fence_i.hex ❌ exitcode=5
|
||||
rv64ui-p-jal.hex ✅
|
||||
rv64ui-p-jalr.hex ✅
|
||||
rv64ui-p-lb.hex ✅
|
||||
rv64ui-p-lbu.hex ✅
|
||||
rv64ui-p-ld.hex ✅
|
||||
rv64ui-p-lh.hex ✅
|
||||
rv64ui-p-lhu.hex ✅
|
||||
rv64ui-p-lui.hex ✅
|
||||
rv64ui-p-lw.hex ✅
|
||||
rv64ui-p-lwu.hex ✅
|
||||
rv64ui-p-or.hex ✅
|
||||
rv64ui-p-ori.hex ✅
|
||||
rv64ui-p-sb.hex ✅
|
||||
rv64ui-p-sd.hex ✅
|
||||
rv64ui-p-sh.hex ❌ exitcode=7
|
||||
rv64ui-p-simple.hex ✅
|
||||
rv64ui-p-sll.hex ✅
|
||||
rv64ui-p-slli.hex ✅
|
||||
rv64ui-p-slliw.hex ✅
|
||||
rv64ui-p-sllw.hex ✅
|
||||
rv64ui-p-slt.hex ✅
|
||||
rv64ui-p-slti.hex ✅
|
||||
rv64ui-p-sltiu.hex ✅
|
||||
rv64ui-p-sltu.hex ✅
|
||||
rv64ui-p-sra.hex ✅
|
||||
rv64ui-p-srai.hex ✅
|
||||
rv64ui-p-sraiw.hex ❌ exitcode=5
|
||||
rv64ui-p-sraw.hex ❌ exitcode=5
|
||||
rv64ui-p-srl.hex ✅
|
||||
rv64ui-p-srli.hex ✅
|
||||
rv64ui-p-srliw.hex ❌ exitcode=7
|
||||
rv64ui-p-srlw.hex ❌ exitcode=7
|
||||
rv64ui-p-sub.hex ✅
|
||||
rv64ui-p-subw.hex ✅
|
||||
rv64ui-p-sw.hex ❌ exitcode=7
|
||||
rv64ui-p-xor.hex ✅
|
||||
rv64ui-p-xori.hex ✅
|
||||
rv64um-p-div.hex ✅
|
||||
rv64um-p-divu.hex ✅
|
||||
rv64um-p-divuw.hex ✅
|
||||
rv64um-p-divw.hex ✅
|
||||
rv64um-p-mul.hex ✅
|
||||
rv64um-p-mulh.hex ❌ exitcode=15
|
||||
rv64um-p-mulhsu.hex ❌ exitcode=15
|
||||
rv64um-p-mulhu.hex ✅
|
||||
rv64um-p-mulw.hex ✅
|
||||
rv64um-p-rem.hex ✅
|
||||
rv64um-p-remu.hex ✅
|
||||
rv64um-p-remuw.hex ❌ exitcode=5
|
||||
rv64um-p-remw.hex ❌ exitcode=5
|
|
@ -136,11 +136,11 @@
|
|||
0: `TRACE(level, ("SGNJ")); \
|
||||
1: `TRACE(level, ("SGNJN")); \
|
||||
2: `TRACE(level, ("SGNJX")); \
|
||||
3: `TRACE(level, ("MIN")); \
|
||||
4: `TRACE(level, ("MAX")); \
|
||||
5: `TRACE(level, ("MVXW")); \
|
||||
6: `TRACE(level, ("MVWX")); \
|
||||
7: `TRACE(level, ("CLASS")); \
|
||||
3: `TRACE(level, ("CLASS")); \
|
||||
4: `TRACE(level, ("FMV.X.W")); \
|
||||
5: `TRACE(level, ("FMV.W.X")); \
|
||||
6: `TRACE(level, ("MIN")); \
|
||||
7: `TRACE(level, ("MAX")); \
|
||||
8: `TRACE(level, ("FLE")); \
|
||||
9: `TRACE(level, ("FLT")); \
|
||||
10: `TRACE(level, ("FEQ")); \
|
||||
|
|
|
@ -314,7 +314,7 @@ module VX_decode #(
|
|||
`INST_FNMSUB,
|
||||
`INST_FNMADD: begin
|
||||
ex_type = `EX_FPU;
|
||||
op_type = `INST_OP_BITS'({2'b10, opcode[3:2]});
|
||||
op_type = `INST_OP_BITS'({2'b11, opcode[3:2]});
|
||||
op_mod = `INST_MOD_BITS'(func3);
|
||||
use_rd = 1;
|
||||
`USED_FREG (rd);
|
||||
|
|
|
@ -63,7 +63,8 @@ module VX_fpu_agent #(
|
|||
wire [`INST_MOD_BITS-1:0] req_op_mod;
|
||||
assign fpu_to_csr_if.read_wid = fpu_agent_if.wid;
|
||||
assign req_op_mod = (fpu_agent_if.op_type != `INST_FPU_NCP
|
||||
&& fpu_agent_if.op_mod[2:0] == `INST_FRM_DYN) ? {1'b0, fpu_to_csr_if.read_frm} : fpu_agent_if.op_mod;
|
||||
&& fpu_agent_if.op_mod[2:0] == `INST_FRM_DYN) ? {fpu_agent_if.op_mod[`INST_MOD_BITS-1:`INST_FRM_BITS], fpu_to_csr_if.read_frm} :
|
||||
fpu_agent_if.op_mod;
|
||||
|
||||
// submit FPU request
|
||||
|
||||
|
|
|
@ -33,20 +33,23 @@ module VX_fpu_fpnew #(
|
|||
input wire ready_out,
|
||||
output wire valid_out
|
||||
);
|
||||
localparam FOP_BITS = fpnew_pkg::OP_BITS;
|
||||
localparam FMTF_BITS = fpnew_pkg::FP_FORMAT_BITS;
|
||||
localparam FMTI_BITS = fpnew_pkg::INT_FORMAT_BITS;
|
||||
|
||||
localparam LATENCY_FDIVSQRT = `MAX(`LATENCY_FDIV, `LATENCY_FSQRT);
|
||||
|
||||
`ifdef XLEN_64
|
||||
`ifdef FLEN_32
|
||||
`define ISA_RV64F
|
||||
`endif
|
||||
`endif
|
||||
|
||||
localparam fpnew_pkg::fpu_features_t FPU_FEATURES = '{
|
||||
Width: `XLEN,
|
||||
EnableVectors: 1'b0,
|
||||
EnableNanBox: 1'b1,
|
||||
FpFmtMask: 5'b10000,
|
||||
EnableNanBox: 1'b0,
|
||||
`ifdef XLEN_64
|
||||
FpFmtMask: 5'b11000,
|
||||
IntFmtMask: 4'b0011
|
||||
`else
|
||||
FpFmtMask: 5'b10000,
|
||||
IntFmtMask: 4'b0010
|
||||
`endif
|
||||
};
|
||||
|
@ -73,11 +76,11 @@ module VX_fpu_fpnew #(
|
|||
wire [NUM_LANES-1:0][`XLEN-1:0] fpu_result;
|
||||
fpnew_pkg::status_t [NUM_LANES-1:0] fpu_status;
|
||||
|
||||
reg [FOP_BITS-1:0] fpu_op;
|
||||
reg [fpnew_pkg::OP_BITS-1:0] fpu_op;
|
||||
reg [`INST_FRM_BITS-1:0] fpu_rnd;
|
||||
reg fpu_op_mod;
|
||||
reg fpu_has_fflags, fpu_has_fflags_out;
|
||||
reg [FMTF_BITS-1:0] fpu_src_fmt, fpu_dst_fmt, fpu_int_fmt;
|
||||
reg [fpnew_pkg::FP_FORMAT_BITS-1:0] fpu_src_fmt, fpu_dst_fmt, fpu_int_fmt;
|
||||
|
||||
wire is_fp_w = op_mod[3];
|
||||
|
||||
|
@ -118,19 +121,26 @@ module VX_fpu_fpnew #(
|
|||
`INST_FPU_CVTXWU:begin fpu_op = fpnew_pkg::I2F; fpu_op_mod = 1; end
|
||||
`INST_FPU_NCP: begin
|
||||
case (op_mod)
|
||||
0: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = `INST_FRM_RNE; fpu_has_fflags = 0; end // FSGNJ
|
||||
1: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = `INST_FRM_RTZ; fpu_has_fflags = 0; end // FSGNJN
|
||||
2: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = `INST_FRM_RDN; fpu_has_fflags = 0; end // FSGNJX
|
||||
0,1,2: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = {1'b0, op_mod[1:0]}; fpu_has_fflags = 0; end // FSGNJ
|
||||
3: begin fpu_op = fpnew_pkg::CLASSIFY; fpu_has_fflags = 0; end // CLASS
|
||||
4: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = `INST_FRM_RUP; fpu_op_mod = 1; fpu_has_fflags = 0; end // FMV.X.W
|
||||
5: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = `INST_FRM_RUP; fpu_has_fflags = 0; end // FMV.W.X
|
||||
6: begin fpu_op = fpnew_pkg::MINMAX; fpu_rnd = `INST_FRM_RNE; end // MIN
|
||||
7: begin fpu_op = fpnew_pkg::MINMAX; fpu_rnd = `INST_FRM_RTZ; end // MAX
|
||||
default: begin fpu_op = fpnew_pkg::CMP; fpu_has_fflags = 0; end // CMP (8,9,10)
|
||||
4: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = 3'b011; fpu_op_mod = 1; fpu_has_fflags = 0; end // FMV.X.W
|
||||
5: begin fpu_op = fpnew_pkg::SGNJ; fpu_rnd = 3'b011; fpu_has_fflags = 0; end // FMV.W.X
|
||||
6: begin fpu_op = fpnew_pkg::MINMAX; fpu_rnd = 3'b000; end // MIN
|
||||
7: begin fpu_op = fpnew_pkg::MINMAX; fpu_rnd = 3'b001; end // MAX
|
||||
default: begin fpu_op = fpnew_pkg::CMP; fpu_rnd = {1'b0, op_mod[1:0]}; end // CMP (8,9,10)
|
||||
endcase
|
||||
end
|
||||
default:;
|
||||
endcase
|
||||
endcase
|
||||
|
||||
`ifdef ISA_RV64F
|
||||
// apply nan-boxing to floating-point operands
|
||||
if (op_type != `INST_FPU_CVTXW && op_type != `INST_FPU_CVTXWU) begin
|
||||
fpu_operands[0] |= 64'hffffffff00000000;
|
||||
end
|
||||
fpu_operands[1] |= 64'hffffffff00000000;
|
||||
fpu_operands[2] |= 64'hffffffff00000000;
|
||||
`endif
|
||||
end
|
||||
|
||||
for (genvar i = 0; i < NUM_LANES; ++i) begin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue