feat: add scalar fexp support

This commit is contained in:
Zhongdi LUO
2026-07-02 07:24:59 +00:00
parent 97a1eff701
commit 9251ba0a24
12 changed files with 327 additions and 14 deletions

View File

@@ -31,6 +31,7 @@ module VX_fpu_dsp import VX_fpu_pkg::*; #(
input wire [TAGW-1:0] tag_in,
input wire [`INST_FPU_BITS-1:0] op_type,
input wire [`INST_MOD_BITS-1:0] op_mod,
input wire [`INST_FMT_BITS-1:0] fmt,
input wire [`INST_FRM_BITS-1:0] frm,
@@ -51,7 +52,8 @@ module VX_fpu_dsp import VX_fpu_pkg::*; #(
localparam FPU_DIVSQRT = 1;
localparam FPU_CVT = 2;
localparam FPU_NCP = 3;
localparam NUM_FPC = 4;
localparam FPU_EXP = 4;
localparam NUM_FPC = 5;
localparam FPC_BITS = `LOG2UP(NUM_FPC);
localparam RSP_DATAW = (NUM_LANES * 32) + 1 + $bits(fflags_t) + TAGW;
@@ -98,6 +100,7 @@ module VX_fpu_dsp import VX_fpu_pkg::*; #(
`INST_FPU_F2U: begin core_select = FPU_CVT; end
`INST_FPU_I2F: begin core_select = FPU_CVT; is_itof = 1; is_signed = 1; end
`INST_FPU_U2F: begin core_select = FPU_CVT; is_itof = 1; end
`INST_FPU_MISC: begin core_select = `INST_FPU_IS_EXP(op_type, op_mod) ? FPU_EXP : FPU_NCP; end
default: begin core_select = FPU_NCP; end
endcase
end
@@ -107,6 +110,7 @@ module VX_fpu_dsp import VX_fpu_pkg::*; #(
`RESET_RELAY (sqrt_reset, reset);
`RESET_RELAY (cvt_reset, reset);
`RESET_RELAY (ncp_reset, reset);
`RESET_RELAY (exp_reset, reset);
wire [NUM_LANES-1:0][31:0] dataa_s;
wire [NUM_LANES-1:0][31:0] datab_s;
@@ -243,6 +247,25 @@ module VX_fpu_dsp import VX_fpu_pkg::*; #(
.ready_out (per_core_ready_out[FPU_NCP])
);
VX_fpu_exp #(
.NUM_LANES (NUM_LANES),
.TAGW (TAGW)
) fpu_exp (
.clk (clk),
.reset (exp_reset),
.valid_in (valid_in && (core_select == FPU_EXP)),
.ready_in (per_core_ready_in[FPU_EXP]),
.lane_mask (lane_mask),
.tag_in (tag_in),
.dataa (dataa_s),
.has_fflags (per_core_has_fflags[FPU_EXP]),
.fflags (per_core_fflags[FPU_EXP]),
.result (per_core_result[FPU_EXP]),
.tag_out (per_core_tag_out[FPU_EXP]),
.valid_out (per_core_valid_out[FPU_EXP]),
.ready_out (per_core_ready_out[FPU_EXP])
);
///////////////////////////////////////////////////////////////////////////
assign per_core_ready_in[FPU_DIVSQRT] = is_div ? div_ready_in : sqrt_ready_in;