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

smt: run DeadCodeElimination after PropagatePresetAnnotations #2036

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

ekiwi
Copy link
Contributor

@ekiwi ekiwi commented Jan 8, 2021

This enables an important pattern in Chisel:

val preset = WireInit(false.B.asAsyncReset())
annotate(new ChiselAnnotation {
  override def toFirrtl = PresetAnnotation(preset.toTarget)
})
withReset(preset) {
  // ...
}

Note that the problematic part is the use of WireInit which is required in order not to run afoul of wire initialization checks in the compiler frontend.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • 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?

Type of Improvement

  • bug fix

API Impact

  • none

Backend Code Generation Impact

  • only affects SMT/Btor2 backends, no change to Verilog generaion

Desired Merge Strategy

  • squash

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?

@ekiwi ekiwi added this to the 1.4.x milestone Jan 8, 2021
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.

Looks good. I can't comment on the interactions in smt specifically, but I trust you here.

This may hint that PropagatePresetAnnotations is invalidating DeadCodeElimination.

@ekiwi
Copy link
Contributor Author

ekiwi commented Jan 11, 2021

This may hint that PropagatePresetAnnotations is invalidating DeadCodeElimination.

I could have also fixed this by only lazily throwing errors. Essentially my problem is that there is a left over AsyncReset expression which I cannot translate. It is never used, so it is not actually a problem for the final translation. However tracking which signals are used would make my translation code harder to write.

Copy link
Contributor

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

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

Looks good, just need to migrate off Travis due to extremely limited open-source credits

@ekiwi ekiwi added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Jan 19, 2021
@mergify mergify bot merged commit 2882912 into chipsalliance:master Jan 19, 2021
mergify bot pushed a commit that referenced this pull request Jan 19, 2021
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Jan 19, 2021
mergify bot added a commit that referenced this pull request Jan 19, 2021
…#2043)

(cherry picked from commit 2882912)

Co-authored-by: Kevin Laeufer <laeufer@cs.berkeley.edu>
Co-authored-by: Jack Koenig <koenig@sifive.com>
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 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