-
Notifications
You must be signed in to change notification settings - Fork 4
Description
As far as I can tell, there is currently no way to emit an array scope type into the FST.
Here is an example that demonstrates the problem this causes:
module t;
typedef struct packed {
logic a;
logic b;
logic [1:0][0:0] arr;
} struct_t;
struct_t [2:0][1:0] thing = '0;
initial forever begin
$dumpfile("dump.fst");
$dumpvars;
while (!&thing) begin
#1;
thing = thing + $bits(thing)'(1);
end
#1;
$finish;
end
endmoduleRunning this with Verilator:
verilator --binary --trace-fst --trace-structs thing.sv && ./obj_dir/VthingThe dump contains the unrolled struct scopes, and within the structs the unrolled member arrays), and the viewers guess some of the arrayness (based on variable naming I presume). In both GTKWave and Surfer, the signal is presented similarly:
The real world problem is that it's pretty common to have many small arrays of structures in modern SV. I have examples where there are hundreds of these unrolled arrays of structs entries under each instance of a module in the hierarchy, which makes navigating the design very hard.
Circling back, the underlying issue is that there is no way to emit in the FST that a set of signals/struct scopes are part of an array. The scope tree looks like this:
pushScope "t" FST_ST_VCD_MODULE
pushScope "thing[0][0]" FST_ST_VCD_STRUCT
var "a"
var "b"
var "arr[1][0]"
var "arr[0][0]"
popScope // "thing[0][0]" FST_ST_VCD_STRUCT
...
popScope // "t" FST_ST_VCD_MODULE
What I would like is:
pushScope "t" FST_ST_VCD_MODULE
pushScope "thing[2:0]" ARRAY_PACKED
pushScope "thing[0][1:0]" ARRAY_PACKED
pushScope "thing[0][0]" FST_ST_VCD_STRUCT
var "a"
var "b"
pushScope "arr[1:0]" ARRAY_PACKED
pushScope "arr[1][0:0]" ARRAY_PACKED
var "arr[1][0]"
popScope // "arr[1][0:0]" ARRAY_PACKED
pushScope "arr[0][0:0]" ARRAY_PACKED
var "arr[0][0]"
popScope // "arr[0][0:0]" ARRAY_PACKED
popScope // "arr[1:0]" ARRAY_PACKED
popScope // "thing[0][0]" FST_ST_VCD_STRUCT
...
popScope // "thing[0][1:0]" ARRAY_PACKED
...
popScope // "thing[2:0]" ARRAY_PACKED
...
popScope // "t" FST_ST_VCD_MODULE
@tbybell @rfuest, is there a current way to communicate this layout in FST at the moment so the viewers don't have to guess? I failed to find one.
If not, do we have a strategy for extending the FST format in a forward compatible way so adding this does not lead to crashes in viewers that don't understand it?