gateware: Fixed-point arithmetic fixes and other improvements - #1804
Draft
mndza wants to merge 11 commits into
Draft
gateware: Fixed-point arithmetic fixes and other improvements#1804mndza wants to merge 11 commits into
mndza wants to merge 11 commits into
Conversation
mndza
marked this pull request as draft
July 28, 2026 12:50
mndza
force-pushed
the
gateware-fixes
branch
2 times, most recently
from
July 29, 2026 12:47
43541f1 to
172feae
Compare
mndza
marked this pull request as ready for review
July 29, 2026 13:01
mndza
marked this pull request as draft
July 29, 2026 14:53
convergent_round returns a value that is one bit longer than the non-fractional part of the passed value. it makes sense to pass a value that is exactly `discarded_bits` long IF it is unsigned. make convergent_round tolerate this edge case rather than fail, but make sure it still fails if `value` has less than `discarded_bits` non-sign bits. more practically, this fixes an error when assigning a fixed.Value of i_width=0 and f_width > 0 to another with f_width=0
when convergent_round is passed a signed value, not only does it return an unsigned value, the *contents* are wrong since the addition is done with the wrong signedness (since slicing drops signedness)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the result of updating the fixed-point library with the code referenced in #1796 (comment). Adapting the gateware to the new semantics exposed several bugs and required additional optimizations to fit the designs within FPGA fabric.
Changes:
lib.fixedamaranth-lang/amaranth#1578. Minor API differences were resolved. The only modification is the addition of a rounding method based on ourconvergent_roundimplementation.convergent_roundfixes from fpga: Fixes to fixed-point arithmetic #1796 (thanks to @mildsunrise)convergent_roundto avoid extending the bit width by default. An optionalclipparameter can be set toFalseto disable clipping.fir_mac16: Replaced the skid buffer in DSP blocks with a proper clock enable signal, improving behavior inext_precision_txgateware.