Repository navigation
Add vfrec7 vector floating-point reciprocal estimate unit - #1858
Noah-Fotenos wants to merge 13 commits into
Conversation
Fix illegal nested always_comb (would not compile) found during review. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwBGrU45A1ohBuBdbTnx2m
|
Please click "Resolve conversation" if you are confident your changes resolve the query. Otherwise, reply with a note. |
|
Please ask for an AI review of your own work. Don't assume everything it says is true. Here is what Claude says. Q is not applicable. The code has significant unnecessary hardware and could be simplified to a single short module. PR #1858 — vfrec7 vector reciprocal estimate unit2026-09-24 — critical review at head
|
|
Overall, this looks clean. However, Claude offers a design 12% smaller and 7.5% faster. Do you want to spend some time optimizing yourself, or see Claude's design? |
Replace the lzc + shifter with a byte/bit one-hot normalizer that selects
the table index directly and yields the leading-zero count as {byte, bit}.
Compute the output exponent with one adder on the internal-bias Xe, and
detect subnormal reciprocal results by comparing Xe to constants.
DC sky130 rv64gc: area 8674 -> 5768 um^2 at 100 MHz (-33%), min delay
2.68 -> 2.36 ns (-12%). Bit-identical to the previous RTL on 14.6M vectors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fail at elaboration unless D and ZFH are supported without Q, since the unit assumes the unpacked operand is double width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Size the datapath from the widest supported format (P.NE, P.NF, P.BIAS) instead of assuming double, and enable each SEW only with its scalar format (16: Zfh, 32: F, 64: D). An unsupported SEW gives a zero result and no flags, like a reserved one. Unsupported formats are removed by constant propagation; only the SEW=64 pack needs a generate block. The unit testbench derives boxing and Fmt from the configuration and expects zero for unsupported SEWs. Passes on H/S/D, S/D, H/S, S-only and H/S/D/Q configs (rv32 and rv64); bit-identical to the previous RTL on rv64gc and rv32gc over 14.6M vectors. DC sky130, area at 100 MHz / delay floor: rv64gc 5768 -> 5697 um^2, 2.45 -> 2.41 ns S/D 5481 um^2, 2.37 ns H/S 4569 um^2, 2.15 ns S only 4283 um^2, 2.04 ns Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| // normal input, Xe = e + D: rec B-1-e = (B+D-1) - Xe | ||
| // rsqrt (3B-1-(e+B))/2 = ((2B+D-1) - Xe) / 2 | ||
| // Supported SEW, one-hot. A flag that is constant 0 removes its format from every select below. | ||
| assign Sew16 = P.ZFH_SUPPORTED & (Vsew == VSEW_16); |
There was a problem hiding this comment.
Change to ZVFH once supported in Wally. Currently, ZFH is used to test synthesis size effects.
|
Just add Zvfh_support in the Wally config. Follow it through the P. to get
it to modules. You’ll probably have to do this for a bunch of other
parameters.
…On Thu, Oct 22, 2026 at 10:30 AM Noah-Fotenos ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/vpu/vfrecrsqrt7.sv
<#1858 (comment)>
:
> @@ -89,28 +96,40 @@ module vfrecrsqrt7 import cvw::*; #(parameter cvw_t P) (
// internal biases are both odd, so that LSB is Xe[0] for a normal and Z[0] for a subnormal.
assign LutOut = IsSqrt ? REC7SQRT_TBL[{XSubnorm ? ZeroCount[0] : Xe[0], Idx[6:1]}] : REC7_TBL[Idx];
- // Output exponent constants for native bias B and internal bias D = P.D_BIAS (e = unbiased input exponent):
- // normal input, Xe = e + D: rec B-1-e = (B+D-1) - Xe
- // rsqrt (3B-1-(e+B))/2 = ((2B+D-1) - Xe) / 2
+ // Supported SEW, one-hot. A flag that is constant 0 removes its format from every select below.
+ assign Sew16 = P.ZFH_SUPPORTED & (Vsew == VSEW_16);
Change to ZVFH once supported in Wally. Currently, ZFH is used to test
synthesis size effects.
—
Reply to this email directly, view it on GitHub
<#1858?email_source=notifications&email_token=AR4AA33DRTSFA7O32T6LPJL5VI72RA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKNRRHAZDOMZYGM3KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-5618273836>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AR4AA3Z4KAPTSG2IHONHSDL5VI72RAVCNFSNUABFKJSXA33TNF2G64TZHMZTEOJYGA3DMMJVHNEXG43VMU5TKNBTGYZTIMZZG4ZKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AR4AA3YDZVS73KAKWCBSNNL5VI72RA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKNRRHAZDOMZYGM3KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AR4AA33CYLEXXBSVD6RUAKL5VI72RA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKNRRHAZDOMZYGM3KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you commented.Message ID:
***@***.***>
|
Gate the SEW 16 path on ZVFH_SUPPORTED instead of scalar ZFH_SUPPORTED: vfrec7/vfrsqrt7 at SEW 16 belong to Zvfh, which scalar Zfh does not imply. The ZVFHMIN/ZVFH/VF_SUPPORTED parameters are copied verbatim from PR openhwfoundation#1988 so the two branches merge without conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Added vfrec7 module.
Claude review: Fix illegal nested always_comb (would not compile) found during review.
Claude-Session: https://claude.ai/code/session_01WwBGrU45A1ohBuBdbTnx2m