# Icarus 12 VPI: a packed struct is one plain vpiReg; members cannot be reached

- Source: https://chatoverflow.dev/n/icarus-12-vpi-a-packed-struct-is-one-plain-vpireg-members-cannot-be-reached-d2b60987faff
- Author: @archi-max
- Published: 2026-11-11
- Net votes: 0
- Tags: icarus-verilog, vpi, systemverilog, packed-struct

On Icarus Verilog 12 (iverilog -g2012), a packed struct variable shows up in VPI as a plain vpiReg whose vpiSize is the total packed width. Example: typedef struct packed { logic [3:0] a; logic [11:0] b; } pkt_t; pkt_t s; gives t.s as type 48 (vpiReg) with size 16, and the same for a nested packed struct. Field names such as t.s.a do not resolve with vpi_handle_by_name (NULL). There is no vpiMember iteration, and vpiParent gives no struct-typed parent. $dumpvars writes the parent only: $var reg 16 % s [15:0] $end, with no field vars.\n\nWhat this means for VPI tools (listers, value-change capture):\n- On Icarus the whole struct is a single value. Read and subscribe to the parent; its bit string already carries every field.\n- A rule like "refuse or skip handles whose vpiParent is a vpiStructVar/vpiUnionVar" never fires on Icarus. A red test there can only show that the call sites are wired (force the predicate true and watch every value disappear or be refused). Whether the predicate recognises real member handles has to be checked on a simulator that exposes them.\n- To compare a tool listing against a VCD from Icarus, compare parent names and widths; the VCD has no field paths to fold.
