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

Add --warn:reflective-naming #2561

Merged
merged 2 commits into from
Jun 6, 2022
Merged

Add --warn:reflective-naming #2561

merged 2 commits into from
Jun 6, 2022

Conversation

jackkoenig
Copy link
Contributor

This new argument (and associated annotation) will turn on a warning
whenever reflective naming changes the name of a signal. This is
provided to help migrate from Chisel 3.5 to 3.6 since reflective naming
is removed in Chisel 3.6.

I also factored _computeName out into a resuable function so that you can ask for the name of something given a seed and prefix without having to have a HasId with those fields set.

This mega-conflicts with @mwachs5's #2556

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

This adds a new CLI/annotation API to warn when some names will change between Chisel 3.5 and 3.6.

Backend Code Generation Impact

No impact

Desired Merge Strategy

  • Rebase

Release Notes

Add --warn:reflective-naming to enable a warning that indicates when the name of some value in the hardware will change in the migration from Chisel 3.5 to 3.6.

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 do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash), clean up the commit message, and label with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

@jackkoenig jackkoenig requested a review from mwachs5 June 3, 2022 22:49
@jackkoenig jackkoenig added this to the 3.5.x milestone Jun 3, 2022
@jackkoenig jackkoenig mentioned this pull request Jun 4, 2022
16 tasks
case _ => false
}
case b: BaseModule => true
case m: Mem[_] => true
Copy link
Contributor

Choose a reason for hiding this comment

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

can Instances be named?

Copy link
Contributor

Choose a reason for hiding this comment

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

does this need a _ default case? What about Verification statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes and yes, will fix and add tests

* @param seed The seed for computing the name (if available)
* @param defaultPrefix Optional default prefix which is only used if the seed is not defined
* @param defaultSeed Optional default (or "fallback") seed
* @return the name, if it can be computed
Copy link
Contributor

Choose a reason for hiding this comment

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

is it None if it cannot be computed? Under what scenarios can it not be computed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can't be computed if seed and default seed are both None.

The new function is chisel3.internal.buildName.
Copy link
Contributor

@mwachs5 mwachs5 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jackkoenig
Copy link
Contributor Author

Forgot to run scalafmt and forgot to add a test for Instance, will push in a sec.

This new argument (and associated annotation) will turn on a warning
whenever reflective naming changes the name of a signal. This is
provided to help migrate from Chisel 3.5 to 3.6 since reflective naming
is removed in Chisel 3.6.
@jackkoenig jackkoenig enabled auto-merge June 6, 2022 21:34
@jackkoenig jackkoenig merged commit b6eb465 into master Jun 6, 2022
@jackkoenig jackkoenig deleted the warn-on-reflective-naming branch June 6, 2022 22:20
@mergify mergify bot added the Backported This PR has been backported label Jun 6, 2022
mergify bot added a commit that referenced this pull request Jun 6, 2022
* Factor buildName into reusable function

The new function is chisel3.internal.buildName.

(cherry picked from commit 370ca8a)

* Add --warn:reflective-naming

This new argument (and associated annotation) will turn on a warning
whenever reflective naming changes the name of a signal. This is
provided to help migrate from Chisel 3.5 to 3.6 since reflective naming
is removed in Chisel 3.6.

(cherry picked from commit 97afd9b)

Co-authored-by: Jack Koenig <koenig@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.

2 participants