Skip to content
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

Hierarchy API: make Mems lookupable #2404

Merged
merged 8 commits into from
Feb 11, 2022

Conversation

debs-sifive
Copy link
Contributor

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • new feature/API

API Impact

@public can now be used on definitions/instances of Mems and SyncReadMems.

Backend Code Generation Impact

Desired Merge Strategy

  • Squash: The PR will be squashed and merged

Release Notes

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (Bug fix: 3.4.x, [small] API extension: 3.5.x, API modification or big change: 3.6.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

Comment on lines 105 to 107
if (Builder.currentModule != parent) {
Builder.currentModule = parent
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azidar this was the fix I arrived at to get rid of the "must be inside Builder context" failure, but I am unsure if this is an acceptable fix...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Do you know why this check is necessary? I would have thought just setting it would have been ok..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I am no longer sure this is actually a correct fix. I think the proper thing to do would be to check that parent is not None.

Some tests in InstanceSpec were failing with requirement failed: must be inside Builder context on accesses to dynamicContext when trying to set Builder.currentModule. After some digging, I think the failure is caused by Builder.currentModule returning None b/c it was getting set to parent in cases where parent was None.

@@ -229,6 +229,7 @@ package internal {
// Private internal class to serve as a _parent for Data in cloned ports
private[chisel3] class ModuleClone[T <: BaseModule](val getProto: T) extends PseudoModule with IsClone[T] {
override def toString = s"ModuleClone(${getProto})"
override def addId(d: HasId): Unit = ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other addId override is very non-obvious to me, can you add a comment explaining why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Do not call default addId function, which may modify a module that is already "closed"

@jackkoenig jackkoenig added this to the 3.5.x milestone Feb 11, 2022
@jackkoenig jackkoenig merged commit 2a985ac into chipsalliance:master Feb 11, 2022
mergify bot pushed a commit that referenced this pull request Feb 11, 2022
@mergify mergify bot added the Backported This PR has been backported label Feb 11, 2022
@debs-sifive debs-sifive deleted the di-mems branch February 11, 2022 20:45
mergify bot added a commit that referenced this pull request Feb 11, 2022
(cherry picked from commit 2a985ac)

Co-authored-by: Deborah Soung <debs@sifive.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported This PR has been backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants