-
Notifications
You must be signed in to change notification settings - Fork 607
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
Preserve literals across .asTypeOf #4168
Conversation
d285777
to
78a7e9a
Compare
I was hoping to backport this because I think it's potentially a very useful feature for ChiselSim and 6.x is closer to 3.6.x which makes for easier porting, but alas it seems that it is a really common pattern to use This change is still good and worth making, but it needs to be on a major version since it will break those uses (they just need to add a |
Converted to draft temporarily. I want to deprecate assigning to the wire returned by |
78a7e9a
to
88f93e7
Compare
This is ready to go |
88f93e7
to
982664d
Compare
it("should number AsTypeOfReadOnly as 8") { | ||
val args = Array("--warn-conf", "id=8:e,any:s", "--throw-on-first-error") | ||
it("should now error on AsTypeOfReadOnly") { | ||
val args = Array("--throw-on-first-error") | ||
val e = the[Exception] thrownBy ChiselStage.emitCHIRRTL(new AsTypeOfReadOnly, args) | ||
e.getMessage should include("[W008] Return values of asTypeOf will soon be read-only") | ||
e.getMessage should include("Return values of asTypeOf are now read-only") | ||
} |
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.
So this is the first time we'll be elevating a warning to an error. I haven't really worked through it all, we could add a corresponding E008
for the old W008
, but no other errors are numbered yet (and of course, unlike warnings, you will not be allowed to configure errors). Any thoughts?
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 seems like if we want to add error numbers we should do that more holistically? separately from this PR?
982664d
to
de6d98e
Compare
de6d98e
to
ca5062c
Compare
Casting a literal (of any type) to another type with .asTypeOf will result in a literal of the new type. For non-literals, the FIRRTL representation will now be a little bit more efficient.
ca5062c
to
f487c92
Compare
`UnknownWidth` became a `case object` in this Chisel PR: chipsalliance/chisel#4242 The `connectFromBits` method was removed in this Chisel PR: chipsalliance/chisel#4168
`UnknownWidth` became a `case object` in this Chisel PR: chipsalliance/chisel#4242 The `connectFromBits` method was removed in this Chisel PR: chipsalliance/chisel#4168
Built on top of #4160 so should merge this one after that one (might need rebase but git seems smarter about cherry-picks these days).
This is very valuable for ChiselSim-style testing because it means that you can much more easily construct literals in tests.
Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
Casting a literal (of any type) to another type with .asTypeOf will result in a literal of the new type. For non-literals, the FIRRTL representation will now be a little bit more efficient.
Reviewer Checklist (only modified by reviewer)
3.6.x
,5.x
, or6.x
depending on impact, API modification or big change:7.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.