SystemVerilog Series · SV-24

SystemVerilog Series — SV-24: VCD Data — VLSI Trainers
SystemVerilog Series · SV-24

VCD Data

How SystemVerilog types map into the standard Verilog VCD format for waveform dumping — type mappings, size rules, packed array and struct handling, enum representation, and what cannot be dumped.

📈 What VCD Is and What SV Does with It

Value Change Dump (VCD) is a plain-text waveform file format defined in Verilog-2001. It records the signal values and times at which those values change. VCD files are read by waveform viewers (GTKWave, Verdi, QuestaSim, etc.) to display simulation waveforms.

SystemVerilog does not extend the VCD format itself — the format remains unchanged from Verilog-2001. Instead, SV defines how its additional types are mapped to Verilog types when they are dumped into a VCD file. Some SV types dump cleanly, others require structural decomposition, and a few cannot be dumped at all.

📋 SV-to-Verilog Type Mapping

When a signal of an SV type is included in a VCD dump, it is represented as the corresponding Verilog type shown in this table.

SystemVerilog typeVCD Verilog typeVCD size (bits)
bitregSize of packed dimension
logicregSize of packed dimension
intinteger32
shortintinteger16
longintinteger64
shortrealreal
bytereg8
enuminteger32 (default)
If an enum specifies a base type, it is dumped as that type rather than the default 32-bit integer. For example, typedef enum byte {A, B, C} my_e would be dumped as a reg of 8 bits (the underlying byte type) rather than as a 32-bit integer.

📋 Packed Arrays and Structures

All packed arrays and packed structures are collapsed into a single vector of reg for VCD dumping. Multiple packed dimensions are flattened — they appear as one continuous bit field in the waveform viewer.

// Declared as two packed dimensions
bit [3:0][7:0] packed_array;
// Dumped as: reg [31:0] packed_array (32-bit single vector)

// Packed struct
typedef struct packed {
  logic valid;
  logic[7:0] data;
} frame_t;
frame_t f;
// Dumped as: reg [8:0] f (9-bit single vector)

📋 Unpacked Structures

Unpacked structures appear in the VCD as named fork...join blocks, with each member element appearing inside the block as its mapped Verilog type. This makes them easy to distinguish in waveform viewers from variables declared inside ordinary begin...end blocks.

// SystemVerilog unpacked struct
typedef struct {
  int          addr;
  logic[7:0]  data;
  bit          valid;
} bus_pkt_t;
bus_pkt_t pkt;

// VCD representation — member order follows declaration order:
// fork pkt
//   integer addr;     (32 bits)
//   reg [7:0] data;   (8 bits)
//   reg valid;        (1 bit)
// join
Named fork…join in VCD is deliberate. In Verilog-2001, fork...join blocks with variable declarations are rarely used in hardware models or testbenches, so waveform tools treat them as a distinct structural group. This makes unpacked structs clearly visible as composite objects in the viewer, rather than being mistaken for a flat list of variables.

📋 Enumerated Types

Enumerated type variables are dumped as their underlying integer type. By default this is a 32-bit integer, but if the enum has an explicit base type that base type governs the dump format.

// Default enum — dumps as 32-bit integer
typedef enum {IDLE, REQ, GRANT, DONE} state_t;
state_t state;
// VCD: integer state;  (IDLE=0, REQ=1, GRANT=2, DONE=3)

// Enum with explicit base type — dumps as that type
typedef enum byte {A, B, C} small_e;
small_e x;
// VCD: reg [7:0] x;  (8-bit reg, since base type is byte)

// The VCD value shows the ordinal integer — not the symbol name
// IDLE → 0, REQ → 1, etc.  Waveform tools may decode this back to
// symbol names if they recognise the enum declaration.

What Cannot Be Dumped

  • Unpacked arrays — not dumped. This includes dynamic arrays, queues, and associative arrays. Fixed-size unpacked arrays of scalars also cannot be dumped.
  • Automatic variables — not dumped. Automatic variables do not have a fixed storage location across the simulation run, so there is no stable address to track.
This is unchanged from Verilog-2001. Verilog-2001 already excluded unpacked arrays and automatic variables from VCD. SystemVerilog adds no new types to the “cannot dump” list — SV’s additional types (dynamic arrays, queues, class objects, etc.) simply inherit the same exclusion that Verilog-2001 unpacked arrays have always had.

📋 Signed/Unsigned Information

The current VCD format does not provide a field to indicate whether a variable is signed or unsigned. All SV numeric types that map to reg or integer in VCD lose their signed/unsigned annotation — the waveform viewer has no way to distinguish them.

This is a known limitation of the VCD format rather than a SystemVerilog issue. Some proprietary waveform formats (e.g. FSDB) preserve this information through additional metadata outside the VCD specification.

📋 Quick Reference

ConstructVCD representation
Packed array / packed structSingle reg vector (all dimensions collapsed)
Unpacked structNamed fork...join block; members inside as their mapped types
Enum (no explicit base)integer (32 bits); value is the ordinal
Enum (with explicit base)That base type (e.g. bytereg[7:0])
Unpacked arrayNot dumped
Automatic variableNot dumped
Signed/unsigned flagNot preserved in VCD
Coming next: SV-25 covers Compiler Directives — enhancements to the 'define macro for string literal construction (`", `\\`"), identifier construction with ``, and the 'include <filename> angle-bracket form for standard-location includes.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top