The VCD file comprises a header section with date, simulator, and timescale information; a variable definition section; and a value change section, in that order. The sections are not explicitly delineated within the file, but are identified by the inclusion of
keywords belonging to each respective section. VCD
keywords are
marked by a leading
$; in general every keyword starts a command which is terminated by an explicit $end. Variable identifiers may also start with a $, but these may be distinguished by context. All VCD
tokens are delineated by
whitespace. Data in the VCD file is case sensitive.
Header section The header section of the VCD file includes a
timestamp, a
simulator version number, and a timescale, which maps the time increments listed in the value change section to simulation time units.
Variable definition section The variable definition section of the VCD file contains scope information as well as lists of signals instantiated in a given scope. Each variable is assigned an arbitrary identifier for use in the value change section. The identifier is composed of one or more printable ASCII characters from ! to ~ (decimal 33 to 126), these are conventionally kept short (i.e. one or two characters). Several variables can share an identifier if the simulator determines that they will always have the same value, i.e. are the same wire in the scope of the overall
netlist. The scope type definitions closely follow Verilog concepts, and include the types module, task, function, and fork.
$dumpvars section The section beginning with $dumpvars keyword contains initial values of all variables dumped.
Value change section The value change section contains a series of time-ordered value changes for the signals in a given simulation model. The current time is indicated by '#' followed by the timestamp. For scalar (single bit) signal the format is signal value denoted by 0 or 1 followed immediately by the signal identifier with no space between the value and the signal identifier. For vector (multi-bit) signals the format is signal value denoted by letter 'b' or 'B' followed by the value in binary format followed by space and then the signal identifier. Value for real variables is denoted by letter 'r' or 'R' followed by the data using %.16g printf() format followed by space and then the variable identifier. == Example VCD file ==