logo
viewcart
Your Ad Here
Value Change Dump (VCD)

Value Change Dump or VCD is an ASCII file usually generated by simulation tools capturing the value changes on selected variables in a simulation. The VCD format is defined by the IEEE Standard 1364-2001. There are two types of VCD files.
  • VCD is Four States to represent variable changes in 0, 1, x, and z with no strength information.
  • eVCD or Extended Value Change Dump represents all state and strength information.
This page will be describing Value Change Dump (VCD) only.
The ASCII VCD file consist of header information, variable definitions, and value changes of variables. Header information and variable definitions are marked by a beginning keyword and ending with an $end keyword. The value changes are a list of values for each variable with a preceding timestamp value. Only values that had changed need to be present in the list of value changes for each timestamp.

Example header information:

	$timescale 1 ns $end 
Example variable definition:
	$var reg 1 ^ data $end 
Example value changes:
	#0
	1^
	#4
	0^
VCD format
Each keyword is either a declaration_command or a simulation_command. The format for each keyword definition is the same. It begins with a keyword followed by a white space character then some relevant information then another white space character and ending with the $end keyword. The possible keywords include:

$comment
The $comment section allows for single or multiple line comments

	Syntax:	
		$comment some_text $end
	Examples:
		$comment This is a comment $end
		$comment 
			This is 
			multiple line comment
		$end
	
$date
The $date section indicates the date the VCD file was created.
	Syntax:
		$date some_date $end
	Example:
		$date Jun 25, 2006 10:30:34 $end
	
$enddefinitions
The $enddefinition section marks the end of the header information and variable definitions.
	Syntax:
		$enddefinition $end
	
	Example:
		$enddefinition $end
	
$scope
The $scope section defines the scope of which the variables belong in.
	Syntax:
		$scope scope_type identifier $end
		scope_type = begin | fork | function | module | task
	Example:
		$scope module top $end
	
$timescale
The $timescale section specifies what timescale was used for the simulation.
	Syntax:
		$timescale time_number time_unit $end
		time_number = 1 | 10 | 100
		time_unit = s | ms | us | ns | ps | fs
	Example:
		$timescale 1 ns $end
	
$upscope
The $upscope section indicates a scope change to a higher level in the hierachy.
	Syntax:
		$upscope $end
	Example:
		$upscope $end
	
$var
The $var section lists the names and identifier codes of all the variables.
	Syntax:
		$var var_type size identifier reference $end
		var_type =  event | integer | parameter | real | reg | 
                            supply0 | supply1 | time | tri | triand | 
                            trior | trireg | tri0 | tri1 | wand | wire | wor
		size = decimal value of number of bits.
		identifier = name of the variable in printable ASCII characters.
		reference = bit or vector name mapped to the identifier
	Examples:
		$var wire 1 * en_q $end
		$var reg 8 ( data_q[7:0] $end
	
$version
The $version section indicates the version of the VCD software used to produce the VCD file.
	Syntax:
		$version version_text $end
	Example:
		$version Simulator 1.0 $end
	
$dumpall
The $dumpall section specifies the current values of all the variables.
	Syntax:
		$dumpall list_of_value_changes $end
	Example:
		$dumpall
		1*
		0(
		x&
		$end
	
$dumpoff
The $dumpoff section specifies the current value of all the variables to be X values.
	Syntax:
		$dumpoff list_of_value_changes $end
	Example:
		$dumpoff 
		x*
		x(
		x&
		$end
	
$dumpon
The $dumpon section specifies resumption of capturing values changes and lists the current values of all variables.
	Syntax:
		$dumpon list_of_value_changes $end
	Example:
		$dumpon
		1*
		0(
		x&
		$end
	
$dumpvars
The $dumpvars section lists initial values of all variables
	Syntax:
		$dumpvars list_of_initial_values $end
	Example:
		$dumpvars
		1*
		0(
		x&
		$end
	
Timestamps
The timestamp statement indicates the current time where the following value changes take place. The timestamps doesn't not need to be continuously. Only when there are value changes will there be a need to indicate the current timestamp.
	Syntax:
		#decimal_time_value
	Examples:
		#0
		#4
	
Value Changes
The value change section is a listing of variables with their value. If the variable is a scalar (1 bit) then the value change format will be the value (0,1,x,z) followed by the identifier without any space characters in between. If the variable is a vector then value change begins with either the b (binary) or r (real_number) character followed by the vector value without any space character between the b or r and the vector value. Then a mandatory white space character followed by the identifier.
	Syntax:
		value+identifider
		b|r+value identifier
	Examples:
		1*
		0(
		b1010 &
		b1101 ^	
	
Value Change Dump (VCD) file example.