-
Notifications
You must be signed in to change notification settings - Fork 164
Make verilog indices consistent #3074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
martijnbastiaan
merged 8 commits into
clash-lang:master
from
jonfowler:verilog-prims-index-ordering
Nov 21, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e9426a5
make verilog imap index consistent
jonfowler 0b20a42
some fixes to reversing indices
jonfowler 0dea5e7
foldr fix?
jonfowler e4ec8ed
update MaxIndex to support more vecLen cases
jonfowler f3a140a
add changelog
jonfowler 1ee2ebb
update changelog
jonfowler b0ddf5a
make it clear imap_go is being generated
jonfowler f0c173f
Refer to issue in chagnelog
martijnbastiaan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| CHANGED: Vector functions in Verilog now have indices consistent with the Vec inputs/outputs (before they were reversed). This is convenient when writing design constraints, which can now be referenced consistently like `imap[0],imap[1],..`. See [#3088](https://github.com/clash-lang/clash-compiler/issues/3088). |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martijnbastiaan can you check my understanding here,
Is
imap_goused when theimaphas been partially unrolled, and~ARG[2]is the offset for how much unrolling has been done.I guess I am not going to get consistent indices in this case (and I'm kind of surprised this unrolling would happen, as
imapisOPAQUE)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler generates
imap_gowhen you do things like:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is implemented here:
clash-compiler/clash-ghc/src-ghc/Clash/GHC/Evaluator/Primitive.hs
Lines 4198 to 4215 in 12169a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But when you look at the evaluator rule of
imap_goclash-compiler/clash-ghc/src-ghc/Clash/GHC/Evaluator/Primitive.hs
Lines 4217 to 4223 in 12169a7
You see it is only evaluated when the vector argument is itself a
Cons x xsdata-constructor.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just changed the block_name and generated comment to
imap_goso it is clear if this path gets taken.