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

Make CheckWidths accept zero-width UIntLiterals #530

Open
wants to merge 2 commits into
base: master-deprecated
Choose a base branch
from

Conversation

jackkoenig
Copy link
Contributor

@jackkoenig jackkoenig commented Apr 7, 2017

Fixes #508

Release notes:
Zero-width literals with value zero are now allowed.

aswaterman
aswaterman previously approved these changes Apr 7, 2017
Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

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

lgtm

| module Top :
| output x: UInt<3>
| x <= UInt<0>(0)""".stripMargin
val check =
"""module Top(
| output [2:0] x
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you check if x is assigned to be zero?

Copy link
Contributor Author

@jackkoenig jackkoenig Apr 7, 2017

Choose a reason for hiding this comment

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

This diff is messed up, this check for this test is identical to the one above so git strangely put the new code in the middle, but if you look below there is more to the new test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that's super weird, if I view the whole file it looks fine.

azidar
azidar previously approved these changes Apr 7, 2017
@jackkoenig
Copy link
Contributor Author

This change seems to lead to a zero-width Vec issue in the Chisel tests. Looking into it

@jackkoenig
Copy link
Contributor Author

(Well I think this one combined with the one where Chisel emits zero width UInts)

@donggyukim
Copy link
Contributor

@colinschmidt Can you confirm this works?

@jackkoenig
Copy link
Contributor Author

Here's the Chisel branch, looking in to the Chisel test failure: https://github.com/ucb-bar/chisel3/tree/one-entry-enum

@colinschmidt
Copy link
Contributor

Thanks @jackkoenig I'll test with that branch and this firrtl branch

@colinschmidt
Copy link
Contributor

Hmm I got a bunch of these errors:

======== Starting Transform CheckWidths$ ========
[error] (run-main-0) firrtl.passes.PassExceptions:
[error] firrtl.passes.CheckWidths$TailWidthException:  @[Decoupled.scala 221:40:[email protected]]: [module FinishQueue] Parameter 1 in tail operator is larger than input width 1.
[error] firrtl.passes.CheckWidths$TailWidthException:  @[Decoupled.scala 221:40:[email protected]]: [module FinishQueue_1] Parameter 1 in tail operator is larger than input width 1.
[error] firrtl.passes.CheckWidths$TailWidthException:  @[Decoupled.scala 221:40:[email protected]]: [module FinishQueue_2] Parameter 1 in tail operator is larger than input width 1.
[error] firrtl.passes.CheckWidths$TailWidthException:  @[Decoupled.scala 221:40:[email protected]]: [module Queue_16] Parameter 1 in tail operator is larger than input width 1.
[error] firrtl.passes.CheckWidths$TailWidthException:  @[Decoupled.scala 221:40:[email protected]]: [module Queue_17] Parameter 1 in tail operator is larger than input width 1.
[error] firrtl.passes.CheckWidths$TailWidthException:  @[Decoupled.scala 221:40:[email protected]]: [module Queue_127] Parameter 1 in tail operator is larger than input width 1.

@jackkoenig
Copy link
Contributor Author

It seems like there might be some hidden zero-width wire problems in Firrtl, perhaps we should just patch Chisel by not emitting zero-width for 1-entry Enums and at least fix THAT problem

@jackkoenig
Copy link
Contributor Author

I added a testcase that currently fails so that a fix for it (and possibly other issues) can accompany this change.

@jackkoenig jackkoenig added this to the 1.2.0 milestone Dec 15, 2017
jackkoenig pushed a commit that referenced this pull request Jun 28, 2018
#530)

* Revert "Change Vec creation to check if gen is lit (and hence needs to be declared)"

This reverts commit dc86e7e1734d6abacb739b488df1de231e6b41b2.
This may address #522 - using chiselCloneType (instead of cloneType) to preserve directionality.

* Add missing implicits to Vec.apply() signature.

* Use correct macro (CompileOptionsTransform) for indexWhere.
@azidar
Copy link
Contributor

azidar commented Nov 21, 2018

Any updates on this? Is this dated?

@jackkoenig
Copy link
Contributor Author

No updates, I think it's a lingering problem

@ucbjrl ucbjrl dismissed stale reviews from azidar and aswaterman via 6c4f0a5 January 8, 2019 22:23
@jackkoenig jackkoenig requested a review from a team as a code owner January 8, 2019 22:23
@ucbjrl
Copy link
Contributor

ucbjrl commented Jan 8, 2019

All tests (FIRRTL) currently pass. I'm running regression tests with the rest of the BIG6.

@azidar azidar modified the milestones: 1.2.0, 1.2.X Mar 1, 2019
Copy link
Contributor

@chick chick left a comment

Choose a reason for hiding this comment

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

This looks ok to me (weird diff not withstanding)
Should get branch updated

@albert-magyar
Copy link
Contributor

I rebased and cleaned up. The previously failing Vec test works now; should we consider merging this now @jackkoenig?

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

Successfully merging this pull request may close these issues.

Zero-width UInt constant zeros are "too small"
8 participants