circt icon indicating copy to clipboard operation
circt copied to clipboard

[DebugInfo][HGLDD] Consuming Tywaves annotations containing extra source language information from Chisel and improve HGLDD format

Open rameloni opened this issue 7 months ago • 7 comments

This PR adds new functionality to CIRCT for emitting source language type information in HGLDD https://github.com/llvm/circt/issues/6983.

This new functionality support the new backend of my project. Tywaves: a type-based waveform viewer. Tywaves adds support for Chisel to Surfer through HGLDD, however it misses of Chisel-type information and a proper documentation.

So, in addition to the changes I made to CIRCT, I also created a library for reading and documenting HGLDD in rust. I noticed that HGLDD misses a formal specification, so the rust documentation is a first attempt to provide more formal description of the fields contained in the file.

Specific contribution to CIRCT

  • Extract source language type information (not FIRRTL) encoded as TywavesAnnotation by Chisel https://github.com/chipsalliance/chisel/pull/4224
  • Associate it to respective MLIR operations
  • Consume it during MaterializeDebugInfo and convert to debug dialect operations
  • Add two new debug dialect operations to support internal representation of extra debug info for subfields of aggregates and modules (dbg.subfield and dbg.moduleinfo) https://github.com/llvm/circt/blob/a1f795e10fb5ae945fb00de8635ef0bce7ce2337/include/circt/Dialect/Debug/DebugOps.td#L87-L114 https://github.com/llvm/circt/blob/a1f795e10fb5ae945fb00de8635ef0bce7ce2337/include/circt/Dialect/Debug/DebugOps.td#L154-L168
  • Emit that information into HGLDD for modules, variables and subfields https://github.com/llvm/circt/blob/a1f795e10fb5ae945fb00de8635ef0bce7ce2337/lib/Target/DebugInfo/EmitHGLDD.cpp#L558-L580 https://github.com/llvm/circt/blob/a1f795e10fb5ae945fb00de8635ef0bce7ce2337/lib/Target/DebugInfo/EmitHGLDD.cpp#L612-L615 https://github.com/llvm/circt/blob/a1f795e10fb5ae945fb00de8635ef0bce7ce2337/lib/Target/DebugInfo/EmitHGLDD.cpp#L702-L705
  • Document HGLDD https://github.com/rameloni/tywaves-rs/blob/main/src/hgldd/spec.rs

rameloni avatar Jun 27 '24 15:06 rameloni