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 ElaboratedCircuit and deprecate use of internal ir Circuit #4683

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

jackkoenig
Copy link
Contributor

When I tried out #4643 internally at SiFive, I realized that despite chisel3.internal.firrtl.ir being a package private object, ir.Circuit still leaks out via ChiselCircuitAnnotation and it can be used freely. This leaks full access to the Chisel internal IR in a way that makes it really hard to change things.

This is my attempt to "spackle" that leak by providing the new ElaboratedCircuit API as the intended public interface to give to users to let them do what they want to do, while letting us muck with the internals. I think we should feel free to add and deprecate then remove APIs from ElaboratedCircuit as long as we take care to keep the actual internals private.

Before merging this, I intend to test it internally and redo #4643 on top of it because I still want to backport the annotation deprecations as well. Technically #4643 does not need this, but I think this makes the story of what changes I want to make in 7.0 a lot cleaner without having to worry about changes to ir.Circuit accidentally breaking user code.

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 request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • API deprecation

Desired Merge Strategy

  • Squash

Release Notes

Change ChiselCircuitAnnotation and CircuitSerializationAnnotation to no longer be case classes to help with the transition to ElaboratedCircuit.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.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) and clean up the commit message.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

@jackkoenig jackkoenig added the Deprecation Deprecates an API, will be included in release notes label Feb 12, 2025
@jackkoenig jackkoenig added this to the 6.x milestone Feb 12, 2025
@jackkoenig jackkoenig requested a review from seldridge February 12, 2025 23:31
@jackkoenig jackkoenig force-pushed the circuit-spackle branch 3 times, most recently from e6f5531 to fcbfa22 Compare February 13, 2025 00:19
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

LGTM

A few nits.

@jackkoenig jackkoenig force-pushed the circuit-spackle branch 3 times, most recently from eab6e45 to aef8230 Compare February 14, 2025 00:41
Change ChiselCircuitAnnotation and CircuitSerializationAnnotation to no
longer be case classes to help with the transition to ElaboratedCircuit.
@jackkoenig jackkoenig enabled auto-merge (squash) February 14, 2025 00:59
@jackkoenig jackkoenig merged commit 4d75573 into main Feb 14, 2025
15 checks passed
@jackkoenig jackkoenig deleted the circuit-spackle branch February 14, 2025 01:22
@mergify mergify bot added the Backported This PR has been backported label Feb 14, 2025
chiselbot pushed a commit that referenced this pull request Feb 14, 2025
Change ChiselCircuitAnnotation and CircuitSerializationAnnotation to no
longer be case classes to help with the transition to ElaboratedCircuit.

(cherry picked from commit 4d75573)

# Conflicts:
#	core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
#	core/src/main/scala/chisel3/internal/Builder.scala
#	src/main/scala/chisel3/stage/ChiselOptions.scala
#	src/main/scala/chisel3/stage/phases/AddImplicitOutputAnnotationFile.scala
#	src/main/scala/chisel3/stage/phases/AddImplicitOutputFile.scala
#	src/main/scala/chisel3/stage/phases/Convert.scala
#	src/main/scala/chisel3/stage/phases/Elaborate.scala
#	src/test/scala/circtTests/stage/ChiselStageSpec.scala
Copy link
Contributor

mergify bot commented Feb 14, 2025

backport

✅ Backports have been created

chiselbot added a commit that referenced this pull request Feb 14, 2025
…ort #4683) (#4693)

* Add ElaboratedCircuit and deprecate use of internal ir Circuit (#4683)

Change ChiselCircuitAnnotation and CircuitSerializationAnnotation to no
longer be case classes to help with the transition to ElaboratedCircuit.

(cherry picked from commit 4d75573)

# Conflicts:
#	core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
#	core/src/main/scala/chisel3/internal/Builder.scala
#	src/main/scala/chisel3/stage/ChiselOptions.scala
#	src/main/scala/chisel3/stage/phases/AddImplicitOutputAnnotationFile.scala
#	src/main/scala/chisel3/stage/phases/AddImplicitOutputFile.scala
#	src/main/scala/chisel3/stage/phases/Convert.scala
#	src/main/scala/chisel3/stage/phases/Elaborate.scala
#	src/test/scala/circtTests/stage/ChiselStageSpec.scala

* Resolve backport conflicts

* MiMa waive package private constructor change

* Fix ScalaDoc

---------

Co-authored-by: Jack Koenig <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.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 Deprecation Deprecates an API, will be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants