Skip to content

VCDWriter

class VCDWriter : public TraceWriter

VCD (Value Change Dump) format trace file writer.

Implements IEEE Std 1364-2001 (Verilog) standard for trace files. Supports hierarchical signal organization and efficient multi-signal updates.

Variables

Name Description
time_emitted_ False until the first #<time> marker has been emitted.

Functions

Name Description
VCDWriter Construct a VCD writer for the specified file.
leaf_name Leaf name of a (possibly dotted) hierarchical signal name: VCD $var declarations carry the name within the enclosing scope, not the full path.
to_bit_string Normalise a caller-supplied value to the VCD bit representation for width bits.

Variable Details

time_emitted_

bool time_emitted_

False until the first #<time> marker has been emitted. Without this, values written at time 0 would be emitted with no timestamp at all, because current_time_ already reads 0.

Function Details

VCDWriter

explicit VCDWriter(const std::string& filename)

Construct a VCD writer for the specified file.

filename
Output file path (e.g., "trace.vcd") @throws std::runtime_error if file cannot be opened

leaf_name

static std::string leaf_name(const std::string& full_name)

Leaf name of a (possibly dotted) hierarchical signal name: VCD $var declarations carry the name within the enclosing scope, not the full path.

to_bit_string

static std::string to_bit_string(const std::string& value, size_t width)

Normalise a caller-supplied value to the VCD bit representation for width bits. Accepts binary (with x/z), 0x-prefixed hex, or decimal.