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

Error on S-interpolator usage for assert, assume and printf #2751

Merged
merged 11 commits into from
Sep 30, 2022

Conversation

adkian-sifive
Copy link
Contributor

@adkian-sifive adkian-sifive commented Sep 27, 2022

This is to be backported to 3.5.x as a warning instead of an error

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

  • updated feature/API

API Impact

Current assert, assume and printf APIs allow the Scala s-interpolator for formatting messages. This often leads to user errors where the Scala object is printed instead of the Chisel object, which leads to the messages being generally unhelpful.

After this update, using s-interpolators will throw an error about deprecation.

Backend Code Generation Impact

N/A

Desired Merge Strategy

  • Squash: The PR will be squashed and merged (choose this if you have no preference.

Release Notes

Using Scala s-interpolators now throws an error recommending a shift to the cf interpolator.

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.

@mwachs5
Copy link
Contributor

mwachs5 commented Sep 27, 2022

I think this requires some fixes to the printable docs? Or can we say something there to show people the warning/error they will get if they try to printf(s"...")?

adkian-sifive and others added 8 commits September 29, 2022 13:26
Co-authored-by: Megan Wachs <megan@sifive.com>
Update a callsite. Rename function in Printf.scala to match the naming
convention in the file. Undo call by name change to preserve binary compatibility.
@adkian-sifive adkian-sifive changed the title Warn on S-interpolator usage for assert, assume and printf Error on S-interpolator usage for assert, assume and printf Sep 29, 2022
Better docs for the error

Update error message to not mention the p-interpolator
@jackkoenig jackkoenig enabled auto-merge (squash) September 30, 2022 00:26
@jackkoenig jackkoenig added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Sep 30, 2022
@jackkoenig
Copy link
Contributor

This is not marked with Milestone 3.5.x because we do not want it to be backported and automerged, instead after merging we will do a manual backport and change the behavior to be just a warning.

}
```

Instead, use Chisel's `cf` interpolator as in the following examples:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants