fpu: detect RV64 FCVT.WU.D overflow on a round-up to 2^32
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 领域
- embedded-iot
调研方向
Start in hw/rtl/fpu/VX_fcvt_unit.sv around lines 632-634, at round_carry_out_s5 and f2i_u32_pos_ovf. Trace how input_sign_s5, unpacked_exp_s5, dst_l_s5, and rounded_abs_s5 are formed for RV64 FCVT.WU.D; the pre-round exponent is 31 while rounding carries the magnitude to 2^32. Reproduce with input 0x41effffffff00000 and frm=RNE, then extend the unsigned overflow condition to cover a rounded value of 2^32, expecting 0xffffffffffffffff and NV set. Done means that case and the (2^32-1,2^32) interval are covered by the FPU tests.
由索引模型根据 Issue 内容生成。
描述
On RV64 at commit 1061088aa, FCVT.WU.D of 4294967295.5 (0x41effffffff00000) with frm=RNE returns 0 and raises only NX. RNE rounds this value to 2^32, which is outside the unsigned 32-bit range. The result should be 0xffffffffffffffff and NV should be set.
The overflow check misses this case. On RV64, S_MAN_WIDTH is at least 64, so rounding to 2^32 does not wrap rounded_abs_s5 to zero; meanwhile, the pre-round exponent is 31. The conversion therefore takes the in-range path and writes the low 32 bits of 2^32, which are zero. The same issue affects values in (2^32-1, 2^32) that round to 2^32.
This is distinct from #430, which concerns FCVT.S.D overflow rounding and was fixed by #432. It is also distinct from the f2i_u32_pos_ovf zero-extension issue: that branch is reached only when overflow is detected, while this input does not trigger it.
In hw/rtl/fpu/VX_fcvt_unit.sv, round-up carry is counted as overflow only when the rounded magnitude wraps to zero:
wire round_carry_out_s5 = (rounded_abs_s5 == '0) && (|pre_round_abs_s5);
wire f2i_u32_pos_ovf = !is_signed_s5 && !dst_l_s5 && !input_sign_s5
&& ((unpacked_exp_s5 >= S_EXP_WIDTH'(32)) || round_carry_out_s5);
- 主要语言
- Verilog
- 星标
- 2.4k
- 派生
- 563
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 33
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vortexgpgpu/vortex 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
vortexgpgpu/vortex#501 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
vortexgpgpu/vortex#499 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 22/100
vortexgpgpu/vortex#505 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 28/100
vortexgpgpu/vortex#504 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 22/100
vortexgpgpu/vortex#503 ·
维护者通常 1 天内回复
查看 vortexgpgpu/vortex 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 61/100
-
难度 2/5 1-3 小时 新手友好度 70/100
raspberrypi/usbboot#419 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
bug triage
难度 2/5 1-3 小时 新手友好度 67/100
crosspoint-reader/crosspoint-reader#4595 · 4 条评论 ·
维护者通常 1 天内回复