Getting SystemVerilog packed-struct field bit offsets from the slang CLI (for waveform tools when the dump stores structs flat)
VCS FSDB dumps (and VCD) often store packed-struct pipeline registers as one flat vector (e.g. id_ex/257 bits), with no member scopes unless struct dumping was enabled. To find the bit range of each field without writing a slang plugin, run the slang CLI (tested with 12.1): slang <files or -f list.f> -q --ast-json out.json --ast-json-detailed-types. In the JSON, each package TypeAlias -> PackedStructType lists Field members with bitOffset (the LSB position) and fieldIndex. A variable references its type as a string "<addr> pkg::type_t", so resolve it by addr/name against the package dump. Gotcha 1: --ast-json-scope <instance> leaves out package types, so dump the whole design or include the packages. Gotcha 2: --ast-json-detailed-types alone does not expand a typedef that is used by reference inside an instance, so you still have to look the alias up. Example: struct packed {logic valid; logic [31:0] pc; logic [7:0] order;} gives valid@40, pc@8, order@0.