RV64 signed DIV/REM restores the sign from bit 31
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 领域
- hpc
调研方向
Bug 位于 VX_serial_div.sv:幅值路径使用位 WIDTHN-1 / WIDTHD-1(大约第 53-56 行),但商和余数的符号标志使用第 31 位(大约第 82-83 行)。先阅读这两个代码块,然后在没有 DPI 除法器的情况下(SV_DPI 未设置或 SYNTHESIS 已设置)构建,以便执行 VX_serial_div。当符号修正测试使用 numer[i][WIDTHN-1] 和 denom[i][WIDTHD-1],并且 issue 中的 RV64 DIV 用例返回预期的商和余数时,即完成。
由索引模型根据 Issue 内容生成。
描述
On RV64, the synthesizable divider in VX_serial_div takes operand magnitudes using bit WIDTHN-1 / WIDTHD-1, but decides whether to negate the quotient and remainder using bit 31. These bits agree on RV32 and for DIVW / REMW, whose operands are sign-extended from bit 31. They can differ for 64-bit DIV and REM, causing an incorrect result sign.
Two cases with a positive divisor:
DIV 0x0000000080000000, 3should return quotient0x000000002aaaaaaa, remainder2. The divider returns quotient0xffffffffd5555556, remainder-2.DIV 0xffffffff00000000, 2should return0xffffffff80000000, remainder0. The divider returns0x0000000080000000.
DIVU 0x0000000080000000, 3 returns quotient 0x000000002aaaaaaa, remainder 2. DIVU and REMU do not use this sign-correction logic.
The magnitude path uses the operand’s top bit in VX_serial_div.sv:
wire negate_numer = is_signed && numer[i][WIDTHN-1];
wire negate_denom = is_signed && denom[i][WIDTHD-1];
The quotient and remainder sign-correction flags instead use bit 31 in VX_serial_div.sv:
inv_quot[i] <= (denom[i] != 0) && is_signed && (numer[i][31] ^ denom[i][31]);
inv_rem[i] <= is_signed && numer[i][31];
For 0x0000000080000000, the magnitude path treats the operand as positive, but the bit-31 tests incorrectly negate the quotient and remainder. For 0xffffffff00000000, the magnitude path takes the absolute value of a negative operand, but the bit-31 test fails to negate the quotient afterward.
The sign-correction tests should use numer[i][WIDTHN-1] and denom[i][WIDTHD-1], matching the magnitude path.
The default rtlsim build does not exercise this divider. VX_define.vh defines IDIV_DPI when SV_DPI is set and SYNTHESIS is not; that path uses DPI division instead of VX_serial_div. The bug affects the synthesizable divider and non-DPI RTL builds.
Environment: commit 1061088aa.
- 主要语言
- Verilog
- 星标
- 2.4k
- 派生
- 563
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 33
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vortexgpgpu/vortex 的其他 Issue
-
难度 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 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
vortexgpgpu/vortex#500 ·
维护者通常 1 天内回复
查看 vortexgpgpu/vortex 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
E3SM-Project/mam4xx#650 ·
维护者通常 1 天内回复
-
area:dmrg bug P2
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
NCAR/ccpp-physics#1256 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
-
[Issue]: examples/01-vectorAdd.py: out-of-bounds float4 accesses when N is not a multiple of 4可能已有人在做 @merrittttt 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复