Skip to content

Chisel 7 Support - ChiselAnnotation going away #3722

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

Closed
tymcauley opened this issue Mar 6, 2025 · 11 comments
Closed

Chisel 7 Support - ChiselAnnotation going away #3722

tymcauley opened this issue Mar 6, 2025 · 11 comments

Comments

@tymcauley
Copy link
Contributor

With chipsalliance/chisel#4717, Chisel has removed the ChiselAnnotation API, which breaks a number of spots throughout rocket-chip:

Can we replace the custom DCache InlineInstance trait with either chisel3.util.experimental.InlineInstance (in Chisel 6.6.0) or InlineInstanceAllowDedup (in Chisel 7)?

Do the other annotations have any consumer, or would they be harmless to remove?

@jerryz123
Copy link
Contributor

It looks like ElaborationArtefactAnnotation is also unused? I think all the unused Annotations can be removed.

InlineInstance is useful, but I agree that should be changed to experimental.InlineInstance.

@tymcauley
Copy link
Contributor Author

It looks like ElaborationArtefactAnnotation is also unused? I think all the unused Annotations can be removed.

InlineInstance is useful, but I agree that should be changed to experimental.InlineInstance.

Regarding DCache's InlineInstance, should we try to use chisel3.util.experimental.InlineInstanceAllowDedup, since that doesn't block dedup, like chisel3.util.experimental.InlineInstance does?

@jerryz123
Copy link
Contributor

Yeah, good point. It would be unintuitive for inlined instances to block dedup

@tymcauley
Copy link
Contributor Author

I'll submit a PR to get rid of most of the annotations except for DCache's InlineInstance. That PR will be Chisel-6 compatible. Then I'll make another which replaces DCache's InlineInstance

@tymcauley
Copy link
Contributor Author

Okay, this PR contains the removal of most of rocket-chip's annotations, aside from the DCache one: #3723

It impacts APIs that are used by other projects, so I've submitted PRs to those too (and they're listed in the rocket-chip PR).

@jackkoenig
Copy link
Contributor

I want to clarify that, while Chisel 7 removes ChiselAnnotation, it's still possible to annotate things, you just have to go directly to FirrtlAnnotation1. That being said, since it's basically impossible to implement user-defined annotations in CIRCT, there's a lot less utility in them than there once was anyway--it's best to use upstream annotations where possible.

Footnotes

  1. Admittedly this API is not released but will be in 6.7.0. I can prioritize getting 6.7.0 out if it helps y'all at all.

@tymcauley
Copy link
Contributor Author

I want to clarify that, while Chisel 7 removes ChiselAnnotation, it's still possible to annotate things, you just have to go directly to FirrtlAnnotation1. That being said, since it's basically impossible to implement user-defined annotations in CIRCT, there's a lot less utility in them than there once was anyway--it's best to use upstream annotations where possible.

Footnotes

1. Admittedly this API is not released but will be in 6.7.0. I can prioritize getting 6.7.0 out if it helps y'all at all. [↩](#user-content-fnref-1-a3f223b2745d92b1488adc93a6564054)

Ya, that might help us resolve ucb-bar/constellation#81 and chipsalliance/diplomacy#18

@tymcauley
Copy link
Contributor Author

I want to clarify that, while Chisel 7 removes ChiselAnnotation, it's still possible to annotate things, you just have to go directly to FirrtlAnnotation1. That being said, since it's basically impossible to implement user-defined annotations in CIRCT, there's a lot less utility in them than there once was anyway--it's best to use upstream annotations where possible.

Footnotes

1. Admittedly this API is not released but will be in 6.7.0. I can prioritize getting 6.7.0 out if it helps y'all at all. [↩](#user-content-fnref-1-a3f223b2745d92b1488adc93a6564054)

@jackkoenig I don't see the FirrtlAnnotation API in Chisel right now, all I see are calls to chisel3.experimental.annotate(...).

@jackkoenig
Copy link
Contributor

I've tagged v6.7.0, the artifacts should be on Maven in ~2 hours: https://github.com/chipsalliance/chisel/releases/tag/v6.7.0

@tymcauley the new chisel3.experimental.annotate takes => Seq[firrtl.annotations.Annotation] as its 2nd argument list, for example1:

  def addResource(blackBoxResource: String): Unit = {
    chisel3.experimental.annotate(self)(Seq(BlackBoxInlineAnno.fromResource(blackBoxResource, self.toNamed)))
  }

Also see the PR (chipsalliance/chisel#4643) that changed from the old to new for an example.

Footnotes

  1. https://github.com/chipsalliance/chisel/blob/425bdd2bd6132de684d0fdebe5f5a09aca61acb5/src/main/scala/chisel3/util/BlackBoxUtils.scala#L47

@tymcauley
Copy link
Contributor Author

Yup, we can use the new annotation API from chipsalliance/chisel#4643 to fix the remaining ChiselAnnotation in DCache, I'll submit a PR for that.

@tymcauley
Copy link
Contributor Author

Resolved by #3724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants