RV64 signed DIV/REM restores the sign from bit 31
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- hpc
調査の方向性
バグは 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時間
- マージ済み PR(30日)
- 33
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 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 日以内に返信