-
Notifications
You must be signed in to change notification settings - Fork 602
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
Add support for marking things as readOnly #4190
Conversation
I'm going to peel off the bit that actually marks the return value as "deprecated read-only" into its own PR. |
case (Output, Output) => issueConnectR2L(left, right) | ||
case (Internal, Output) => issueConnectR2L(left, right) | ||
case (Output, Output) => issueConnectR2L(left, lwr, right, rwr) | ||
case (Internal, Output) => issueConnectR2L(left, lwr, right, rwr) | ||
|
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 diff here can probably be made lower touch. The issueConnect
functions call .lref
so we could probably rely on the error reporting there, although that means it would construct wires in the error case (to provide a legal lref for a read-only thing) whereas doing it at this level allows us to elide issuing the connection altogether.
Separate from that, this code is also pretty inelegant in that it's checking .topBinding
for each left and right multiple times. This may be optimized by the JIT, but it's pretty inefficient if it isn't.
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.
This approach sounds good to me. I don't have time to do a thorough review today, so please bug me for a more detailed post-merge review.
core/src/main/scala/chisel3/experimental/dataview/package.scala
Outdated
Show resolved
Hide resolved
Also add internal support for marking things as "deprecated read only".
Also add internal support for marking things as "deprecated read only". (cherry picked from commit 7be4243) # Conflicts: # core/src/main/scala/chisel3/experimental/hierarchy/core/Lookupable.scala # core/src/main/scala/chisel3/internal/Binding.scala
* Add support for marking things as readOnly (#4190) Also add internal support for marking things as "deprecated read only". (cherry picked from commit 7be4243) # Conflicts: # core/src/main/scala/chisel3/experimental/hierarchy/core/Lookupable.scala # core/src/main/scala/chisel3/internal/Binding.scala * Resolve backport conflicts --------- Co-authored-by: Jack Koenig <koenig@sifive.com>
Also add internal support for marking things as "deprecated read only". This will promptly be used to mark the return value of
.asTypeOf
as "deprecated read only" in 6.x in preparation of #4168.I implemented this as part of the view binding for the following reasons:
Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
Users can call
.readOnly
on anyData
to prevent connections to the returned value. Resolves #1267.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
.