fpu: sign-extend RV64 FCVT.WU positive overflow results

未关闭 适合新手
#499 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
embedded-iot

调研方向

打开 hw/rtl/fpu/VX_fcvt_unit.sv 中 682-685 行附近的 f2i_u32_pos_ovf 分支,对比其他溢出分支,检查 res_val_64 在这里是如何组装的;RV64 路径需要将 32 位的 0xffffffff 符号扩展,而 res_val_32 保持不变。先阅读周围的 f2i 分支,了解 XLEN 如何在 64 位和 32 位结果之间进行选择。完成标准是:对 FCVT.WU.S 以 0x4f800000 和 frm=RNE 进行 FPU 仿真,得到 0xffffffffffffffff 且 NV 置位。

由索引模型根据 Issue 内容生成。

描述

On RV64, FCVT.WU.S and FCVT.WU.D can return a zero-extended result when a finite positive input overflows the unsigned 32-bit range.

For example, FCVT.WU.S of 0x4f800000 (2^32), with frm=RNE, should produce 0xffffffffffffffff: the invalid flag is set and the 32-bit result 0xffffffff is sign-extended to XLEN. The RTL instead returns 0x00000000ffffffff. FCVT.WU.D of a value whose exponent is at least 32 takes the same arm.

This is not #430. #430 is FCVT.S.D overflow rounding, and #432 already fixed that path. This report is the float-to-unsigned-int arm: the overflow is detected and NV is set, but the RV64 result is zero-extended instead of sign-extended.

In hw/rtl/fpu/VX_fcvt_unit.sv, the f2i_u32_pos_ovf branch sets NV but zero-extends the result:

end else if (f2i_u32_pos_ovf) begin
    final_fflags_s5.NV = 1'b1;
    res_val_64 = {32'h00000000, 32'hFFFFFFFF};
    res_val_32 = 32'hFFFFFFFF;
主要语言
Verilog
星标
2.4k
派生
563
平均合并
2 天 12 小时
30 天内合并 PR
33

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vortexgpgpu/vortex 的其他 Issue

查看 vortexgpgpu/vortex 的全部 Issue

相似的 Issue

更多 Embedded & IoT Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。