Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Fix bug in zero-width memory removal #2153

Merged
merged 2 commits into from
Mar 26, 2021
Merged

Conversation

seldridge
Copy link
Member

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories. Previously,
only read ports were correctly handled.

Contributor Checklist

  • [n/a] Did you add Scaladoc to every public function/method?
  • [n/a] Did you update the FIRRTL spec to include every new feature/behavior?
  • 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 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

  • bug fix

API Impact

None.

Backend Code Generation Impact

None.

Desired Merge Strategy

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

Release Notes

None.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge added this to the 1.2.x milestone Mar 26, 2021
Copy link
Contributor

@ekiwi ekiwi left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

Good test!

@seldridge seldridge added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Mar 26, 2021
@mergify mergify bot merged commit 67ce97a into master Mar 26, 2021
mergify bot pushed a commit that referenced this pull request Mar 26, 2021
* Fix bug in zero-width memory removal

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>

* fixup! Fix bug in zero-width memory removal

(cherry picked from commit 67ce97a)

# Conflicts:
#	src/main/scala/firrtl/passes/ZeroWidth.scala
mergify bot pushed a commit that referenced this pull request Mar 26, 2021
* Fix bug in zero-width memory removal

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>

* fixup! Fix bug in zero-width memory removal

(cherry picked from commit 67ce97a)

# Conflicts:
#	src/main/scala/firrtl/passes/ZeroWidth.scala
Comment on lines +28 to +33
private def makeZero(tpe: ir.Type): ir.Type = tpe match {
case ClockType => UIntType(IntWidth(0))
case a: UIntType => a.copy(IntWidth(0))
case a: SIntType => a.copy(IntWidth(0))
case a: AggregateType => a.map(makeZero)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private def makeZero(tpe: ir.Type): ir.Type = tpe match {
case ClockType => UIntType(IntWidth(0))
case a: UIntType => a.copy(IntWidth(0))
case a: SIntType => a.copy(IntWidth(0))
case a: AggregateType => a.map(makeZero)
}
private def makeZeroWidth(tpe: ir.Type): ir.Type = tpe match {
case ClockType => UIntType(IntWidth(0))
case a: UIntType => a.copy(IntWidth(0))
case a: SIntType => a.copy(IntWidth(0))
case a: AggregateType => a.map(makeZeroWidth)
}

I was about to link you to Utils.getGroundZero because that's the functionality that makeZero implies to me

Copy link
Contributor

Choose a reason for hiding this comment

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

Well I'm too late, not worth changing heh

mergify bot pushed a commit that referenced this pull request Mar 26, 2021
* Fix bug in zero-width memory removal

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>

* fixup! Fix bug in zero-width memory removal

(cherry picked from commit 67ce97a)
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Mar 26, 2021
mergify bot added a commit that referenced this pull request Mar 26, 2021
* Fix bug in zero-width memory removal

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>

* fixup! Fix bug in zero-width memory removal

(cherry picked from commit 67ce97a)

Co-authored-by: Schuyler Eldridge <[email protected]>
mergify bot added a commit that referenced this pull request Mar 26, 2021
* Fix bug in zero-width memory removal (#2153)

* Fix bug in zero-width memory removal

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>

* fixup! Fix bug in zero-width memory removal

(cherry picked from commit 67ce97a)

# Conflicts:
#	src/main/scala/firrtl/passes/ZeroWidth.scala

* fixup! Fix bug in zero-width memory removal (#2153)

Co-authored-by: Schuyler Eldridge <[email protected]>
mergify bot added a commit that referenced this pull request Mar 26, 2021
* Fix bug in zero-width memory removal (#2153)

* Fix bug in zero-width memory removal

Correctly remove all extraneous connections to all types of memory
ports (read, write, readwrite) for zero-width memories.  Previously,
only read ports were correctly handled.

Signed-off-by: Schuyler Eldridge <[email protected]>

* fixup! Fix bug in zero-width memory removal

(cherry picked from commit 67ce97a)

# Conflicts:
#	src/main/scala/firrtl/passes/ZeroWidth.scala

* fixup! Fix bug in zero-width memory removal (#2153)

Co-authored-by: Schuyler Eldridge <[email protected]>
@jackkoenig jackkoenig deleted the dev/seldridge/zero-width-mem branch March 26, 2021 23:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backported This PR has been backported to marked stable branch bugfix 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