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

Make "deprecated public" binding APIs private #4177

Merged
merged 2 commits into from
Jun 17, 2024
Merged

Conversation

jackkoenig
Copy link
Contributor

@jackkoenig jackkoenig commented Jun 14, 2024

This is done by adding a new package private object "binding" within
which all bindings live. This required changing imports in lots of files
but it makes it much easier to not accidentally create a public binding
in the future.

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 modification

Desired Merge Strategy

  • Merge

Release Notes

These chisel3.internal APIs should never have been public in the first place.

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), 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.

Comment on lines -12 to +29
// Element only direction used for the Binding system only.
private[chisel3] sealed abstract class BindingDirection
private[chisel3] object BindingDirection {

/** Internal type or wire
*/
case object Internal extends BindingDirection

/** Module port with output direction
*/
case object Output extends BindingDirection

/** Module port with input direction
*/
case object Input extends BindingDirection

/** Determine the BindingDirection of an Element given its top binding and resolved direction.
*/
def from(binding: TopBinding, direction: ActualDirection): BindingDirection = {
binding match {
case _: PortBinding | _: SecretPortBinding =>
direction match {
case ActualDirection.Output => Output
case ActualDirection.Input => Input
case dir => throw new RuntimeException(s"Unexpected port element direction '$dir'")
}
case _ => Internal
private[chisel3] object binding {

// Element only direction used for the Binding system only.
sealed abstract class BindingDirection
object BindingDirection {

/** Internal type or wire
*/
case object Internal extends BindingDirection

/** Module port with output direction
*/
case object Output extends BindingDirection

/** Module port with input direction
*/
case object Input extends BindingDirection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This diff looks crazy, but all it is is adding private[chisel3] object binding {, tabbing everything over, and deleting all nested private[chisel3] and deprecation messages. It's split into 2 commits that at least makes that more clear in the normal commit history. I'll merge with a merge commit.

This is done by adding a new package private object "binding" within
which all bindings live. This required changing imports in lots of files
but it makes it much easier to not accidentally create a public binding
in the future.
These are no longer needed now that all binding are packaged up in a
package private object.
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

@jackkoenig jackkoenig merged commit 59c97bd into main Jun 17, 2024
15 checks passed
@jackkoenig jackkoenig deleted the privatize-binding branch June 17, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants