-
Notifications
You must be signed in to change notification settings - Fork 147
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
Change bit indexing to use Word
parameter in replaceBit#
(#1983)
#1993
Conversation
This commit shows that |
Unless I'm missing your meaning, |
But you can still enumerate |
No, I do mean that it should be |
While it would be convenient for us if the Enum class would be changed to use |
Yeah, I know that But I always read them more in the spirit of: "Class Enum defines operations on sequentially ordered types.", where |
I'd say if they'd consider a breaking change like that, they should consider using |
Unfortunately, |
Isn't that, realistically, just a roundabout way of saying this won't get into Clash? |
No, we’ll merge this |
@gergoerdi Is there anything that still needs to happen for this PR? I'd like to get this in the 1.6 release (02-02-2022) if possible :) |
Some musing. While discussing my GHC issue report for
This is one developer's opinion, and I disagree on the "only desugaring" when I observe that The takeaway is this: maybe we are using clash-compiler/clash-prelude/src/Clash/Prelude/ROM.hs Lines 51 to 62 in a5174f6
|
@alex-mckenna Could you pretty please have a look whether we can include this for 1.6? :) |
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.
On the whole, I think this is fine. I would like to see a regression test if possible, although I think that means adding Yosys
as a vendor tool in the testsuite. If I make a PR for that, can you make a test for this @gergoerdi?
I'm not sure how I feel about this change, now that YosysHQ/yosys#3051 has a candidate fix. If using signed types to index bits is valid Verilog/VHDL, and the practical consideration of working around a Yosys bug no longer applies, then is there an advantage (other than maybe decreasing surprises) to this change? |
Hmm yes, if Yosys have a fix then I agree we don't think we really need this since it is allowed in Verilog / VHDL. I don't think there's much to be said for less surprise given how many Haskell APIs index with |
This is more of a proof-of-concept for #1983 than a fully tested fix. With it applied, I can see that it is an effective workaround for YosysHQ/yosys#3051, at least in the simple case. I haven't tried anything more complex yet; a good test case should be https://github.com/gergoerdi/clash-calculator which is where I initially noticed this.