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

Literals set the ref so that they no longer get named #826

Merged
merged 3 commits into from
Jun 1, 2018

Conversation

jackkoenig
Copy link
Contributor

@jackkoenig jackkoenig commented Jun 1, 2018

Have literals set their ref so that a name isn't allocated

This has a few implications

  • Constructing a literal no longer increments _T_ suffixes
  • Internally, wrapping a literal Bits in Node(...) will work
  • Literal Bools work in withReset/withClockAndReset
  • Data.ref is potentially redundant

Related issue: Fixes #763.

@azidar beat me to fixing #472, but this would also have fixed that issue (I added a test in this PR as well)

Type of change: other enhancement

Impact: no functional change

Development Phase: implementation

Release Notes
Literal Bools work for reset in withClockAndReset and withReset
Literals no longer increment temporary names suffix

Fixes #763

This has a few implications
* Constructing a literal no longer increments _T_ suffixes
* Internally, wrapping a literal Bits in Node(...) will work
* Literal Bools work in withReset/withClockAndReset
* Data.ref is potentially redundant
@jackkoenig jackkoenig requested a review from ducky64 June 1, 2018 01:33
Copy link
Contributor

@ducky64 ducky64 left a comment

Choose a reason for hiding this comment

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

Also, are there any implications for usage with the bundle literals framework (#820)? That PR moves litArg into the binding and alters the behavior of the ref accessors somewhat. So this probably won't be directly compatible, and it might make more sense for ref to be set on a binding operation? It would also probably be safer and cleaner to have refs initialized with binding?

Test cases look sane though.

@@ -142,6 +142,18 @@ class MultiClockSpec extends ChiselFlatSpec {
assert(withReset(this.reset) { 5 } == 5)
})
}
it should "support literal Bools" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test seems kind of random, I assume this fix is a side effect of the above change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#763 was the motivating issue so I added a test for it :) In looking into that issue, I realized that literal Bools not working in withReset was a side effect of the weirdness that this PR fixes

@jackkoenig
Copy link
Contributor Author

@ducky64 Yeah I think this will need to be done slightly differently in #820. Since the current LitBinding doesn't have any information about the literal value, I think this implementation is the right one in the meantime. I agree though that with Bundle literals it makes more sense to set the ref as part of the Binding.

Copy link
Contributor

@ducky64 ducky64 left a comment

Choose a reason for hiding this comment

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

This seems fine as an immediate-term solution until Bundle literals refactors things more fundamentally

@jackkoenig jackkoenig merged commit d0cdd3b into master Jun 1, 2018
@jackkoenig jackkoenig deleted the lit-set-ref branch June 1, 2018 19:16
ucbjrl added a commit that referenced this pull request Jun 20, 2018
@ucbjrl ucbjrl added this to the 3.2.0 milestone Sep 7, 2018
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

Successfully merging this pull request may close these issues.

withClockAndReset generates incorrect FIRRTL causing UndeclaredReferenceException
4 participants