On-the-fly conversion and quotient selection function#858
Open
Durchbruchswagen wants to merge 12 commits intokuznia-rdzeni:masterfrom
Open
On-the-fly conversion and quotient selection function#858Durchbruchswagen wants to merge 12 commits intokuznia-rdzeni:masterfrom
Durchbruchswagen wants to merge 12 commits intokuznia-rdzeni:masterfrom
Conversation
80f8793 to
63d16ce
Compare
Member
|
You have circular imports. |
tilk
requested changes
Apr 30, 2026
Comment on lines
+105
to
+108
| a1 = q[1] | sign | ||
| a0 = q[0] | ||
| b1 = ((~q[1]) & (~q[0])) | (sign & q[0]) | ||
| b0 = ~q[0] |
Member
There was a problem hiding this comment.
These should be signals as they are used multiple times. Actually, given the usage, you could just declare two-bit signals a and b.
Comment on lines
+17
to
+32
| test_cases = [ | ||
| [(0, 1), (0, 0), (0, 0), (1, 1), (1, 2), (0, 2)], | ||
| [(0, 0), (0, 0), (0, 0), (0, 2), (1, 2), (1, 1)], | ||
| [(1, 2), (1, 2), (0, 0), (0, 1), (0, 1), (0, 1)], | ||
| [(0, 0), (0, 0), (0, 0), (0, 0), (1, 1), (0, 1)], | ||
| [(0, 2), (0, 0), (0, 0), (0, 0), (0, 1), (0, 0)], | ||
| [(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)], | ||
| ] | ||
| results = [ | ||
| 1002, | ||
| 23, | ||
| 1557 + (3 << 12), | ||
| 4093 + (3 << 12), | ||
| (1 << 11) + (1 << 2), | ||
| 0, | ||
| ] |
Member
There was a problem hiding this comment.
There are just a few cases here, so this doesn't hurt that much, but writing cases like this hurts readability and maintainability. Group test case data, e.g. like you did in test_fpu_classification.
Comment on lines
+109
to
+119
| with m.If(divisor == Const(self.intervals[i])): | ||
| with m.If(residual < Const(self.bounds[i][0])): | ||
| m.d.av_comb += q.eq(Const(self.digits[0][1])) | ||
| m.d.av_comb += sign.eq(Const(self.digits[0][0])) | ||
| for j in range(1, len(self.bounds[i])): | ||
| with m.Elif(residual < Const(self.bounds[i][j])): | ||
| m.d.av_comb += q.eq(Const(self.digits[j][1])) | ||
| m.d.av_comb += sign.eq(Const(self.digits[j][0])) | ||
| with m.Else(): | ||
| m.d.av_comb += q.eq(Const(self.digits[len(self.bounds[i])][1])) | ||
| m.d.av_comb += sign.eq(Const(self.digits[len(self.bounds[i])][0])) |
Member
There was a problem hiding this comment.
Are the Const uses here really needed? Looks weird.
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.
Implementation of: