diff --git a/hw/rtl/fpu/VX_fpu_unit.sv b/hw/rtl/fpu/VX_fpu_unit.sv index 3b0c3982ee..9e2386d54f 100644 --- a/hw/rtl/fpu/VX_fpu_unit.sv +++ b/hw/rtl/fpu/VX_fpu_unit.sv @@ -61,16 +61,16 @@ module VX_fpu_unit import VX_gpu_pkg::*, VX_fpu_pkg::*; #( fpu_header_t fpu_hdr, fpu_hdr_wb, fpu_hdr_store; - // FPU always writes back, so header.wb is always 1 at dispatch. + // Carry the decoded wb through the tag store: FPU compares may target + // integer x0 (e.g. feq.s x0, ...), which decode does not reserve in the + // scoreboard, so forcing wb=1 on readback would trip the invalid + // writeback assertion. always_comb begin - fpu_hdr_store = per_block_execute_if[block_idx].data.header; - fpu_hdr_store.wb = 1'b0; + fpu_hdr_store = per_block_execute_if[block_idx].data.header; end - // Force wb=1 on the readback path. always_comb begin - fpu_hdr_wb = fpu_hdr; - fpu_hdr_wb.wb = 1'b1; + fpu_hdr_wb = fpu_hdr; end wire [TAG_WIDTH-1:0] fpu_req_tag, fpu_rsp_tag; diff --git a/tests/kernel/conform/main.cpp b/tests/kernel/conform/main.cpp index ef18e59704..2c0f31c08e 100644 --- a/tests/kernel/conform/main.cpp +++ b/tests/kernel/conform/main.cpp @@ -31,6 +31,8 @@ int main() { errors += test_jalr(); + errors += test_feq_x0_scoreboard(); + if (0 == errors) { PRINTF("Passed!\n"); } else { diff --git a/tests/kernel/conform/tests.cpp b/tests/kernel/conform/tests.cpp index f00a60466c..721f94059d 100644 --- a/tests/kernel/conform/tests.cpp +++ b/tests/kernel/conform/tests.cpp @@ -505,3 +505,25 @@ int test_jalr() { } return 0; } + +/////////////////////////////////////////////////////////////////////////////// + +void __attribute__((noinline)) do_feq_x0_scoreboard() { + asm volatile( + "fsgnj.s f24, f0, f0\n" + "fsgnj.s f1, f0, f0\n" + "feq.s x0, f24, f1\n" + : + : + : "memory"); +} + +int test_feq_x0_scoreboard() { + PRINTF("FEQ x0 Scoreboard Test\n"); + int num_threads = std::min(vx_num_threads(), 4); + int tmask = make_full_tmask(num_threads); + vx_tmc(tmask); + do_feq_x0_scoreboard(); + vx_tmc_one(); + return 0; +} diff --git a/tests/kernel/conform/tests.h b/tests/kernel/conform/tests.h index a398c2809b..90fcb3969b 100644 --- a/tests/kernel/conform/tests.h +++ b/tests/kernel/conform/tests.h @@ -30,4 +30,6 @@ int test_qshfl(); int test_jalr(); +int test_feq_x0_scoreboard(); + #endif