amaranth-lang / amaranth

A modern hardware definition language and toolchain based on Python
https://amaranth-lang.org/docs/amaranth/
BSD 2-Clause "Simplified" License
1.56k stars 174 forks source link

GTKW files with signal groups #764

Closed tilk closed 5 months ago

tilk commented 1 year ago

For debugging complex circuits, it's useful to have the signal traces grouped according to their function. The popular gtkwave tool supports this, as does the GTKWSave class from the vcd package used by Amaranth to export VCD files. All that remains is to connect this together.

I have implemented an extension to Amaranth's _VCDWriter which does just that. The idea is that the traces argument can be passed other things than lists of signals. My implementation currently accepts the following as traces:

There is no support in the current implementation for the recently added lib.data classes from RFC 1, but it can be easily added.

Are you interested in merging this functionality to Amaranth?

whitequark commented 1 year ago

Let's discuss improvements to VCD and GTKW writing functionality after the next release.

whitequark commented 7 months ago

I'm interested in expanding traces= handling with the following behavior:

Note that I've specified dict and list above because I consider the syntax of tracing to be a mini-DSL where I ascribe new meaning to, specifically, the Python {} and []/() syntax. This allows flexibility for later expansion with other objects, which may also be e.g. iterables.

Is this something you're interested in implementing? I'd be happy to merge that in 0.5, but otherwise I may have to bump it to 0.6.

tilk commented 7 months ago

I could port the implementation of this feature from Coreblocks, adapting the behavior to stated requirements.

whitequark commented 7 months ago

Sounds good to me.

tilk commented 7 months ago

It looks like there is a regression on #790: I can't get view field traces on main. I will try to do a bisect later.

tilk commented 7 months ago

I bisected the regression to commit 2bf1b4dafc3a5860e532ae8dac31859c3f9c7089.

wanda-phi commented 7 months ago

Yeah, I see the problem, I'm going to do a quick fix soon

wanda-phi commented 7 months ago

Fixed in #1237.