ThePerfectComputer / FastWaveFrontend-Tauri

Starting point of what will become the FastWave frontend.
2 stars 0 forks source link

A wishlist for Spade #1

Open TheZoq2 opened 1 year ago

TheZoq2 commented 1 year ago

Hi! A few months ago you asked me for a wishlist for fastwave features, and I kind of forgot about it :sweat:

Anyway, after having to deal with gtkwave today, I was reminded that something nicer would be nice.

I think gtkwave does reasonably well for general verilog work, but when using it with spade, I have to jump through a whole bunch of hoops to get it to work well with the Spade type system. Most of those problems come down to wanting a way to translate names and values back into their spade counterparts.

For example, here are a few traces from my current project: image

the bottom line is the raw value used in the simulator, it is just a bit vector, but in Spade, this corresponds to a struct with a few fields, which is what the middle trace is.

This middle trace is generated externally, an intermediate tool takes the vcd file, finds all spade signals, and translates their value into strings. This translation can be done in gtkwave, but the interface to do so is hard to script, and very error prone if your translation program isn't correct. A better interface for a task like that would be amazing

Additionally, now I translate the value into a String, which means I can't destructure it further. Being able to have such a translation generate new traces, one for each field would be very useful.

Those two things would make Spade debugging a whole lot nicer.

Another minor issue is names, as you can see those signal names are a bit odd, with some annotations added to them. Being able to have a name translation system, where I could provide a translation from s3_name_n32 to name (stage 3) (defined on line X of file Y) would be amazing. I think I'd wantname (stage 3)` to be visible all the time, and the source location to only be visible on hover, or something like that.

I'm not sure what the best API for this would be. I can imagine a few ways to do it, but for my use case, I think the best way would be some sort of a query system, where I provide a binary which fastwave can run and query for translations. Perhaps something like

fastwave > info some_signal_name
spade_translator >
{
  human_readable_name: "(stage3) name",
  details: "Defined at main.spade:32",
  subfields: [
     "valid",
     "x1"
     "x2"
     ...
  ]
}

fastwave > translate name=some_signal_name value=0xdeadbeef
spade_translator: { "valid": false, "x1": 10, "x2": 20, ... }

This would be pretty general, in the sense that you're not locked into any particular language or interface, just send something universal (I guess json)

A more tightly integrated option might be a library where a translator provides some functions that fastwave calls, but that's a bit harder with interop

I hope that gives some ideas at least :)

ThePerfectComputer commented 1 year ago

Thanks for these suggestions!

I need to start working on FastWave again. I recently moved and had not had as much time to put in to FastWave or my bluespec work.