chisel icon indicating copy to clipboard operation
chisel copied to clipboard

[DebugInfo] Emit source language scala type information and pass it to CIRCT

Open rameloni opened this issue 1 year ago • 1 comments

This is a first attempt for generating and propagating scala source language type information to CIRCT https://github.com/chipsalliance/chisel/issues/4015. This PR adds a new option to support the new backend of my project: a type-based waveform viewer. Chisel currently misses an open-source waveform viewer and tywaves is adding support for Chisel to Surfer.

I wrote more details about the internal changes here: https://github.com/rameloni/tywaves-chisel-demo/wiki/Changes-in-Chisel. While the full wiki contains also details about the integration of the different components involved.

Specific Chisel contributions

  • Extract scala type name and constructor parameters (type, name, value)
  • Encode that information into an annotation for each circuit element and pass to CIRCT through the FIRRTL annotations (probably the intrinsics are a better solution, but to get things started I think annotations system is more than enough)
  • Integrate it in ChiselStage through the PhaseManager between the Elaborate and Convert phases
  • Add an option to ChiselStage for generating or not that information

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

  • Feature (or new API)
  • Backend code generation

Desired Merge Strategy

  • Squash: The PR will be squashed and merged (choose this if you have no preference).
  • Rebase: You will rebase the PR onto master and it will be merged with a merge commit.

Release Notes

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.

rameloni avatar Jun 27 '24 15:06 rameloni