Timing Description Languages:VCD

VCD

A Value Change Dump (VCD) file is used for representing waveforms in the ASCII format. VCD logs the value changes of selected variables in a design during a simulation session or waveform generation. VCD can also be created by inserting the VCD system tasks in the Verilog source file and simulating the Verilog file. As another example, SystemC has also a number of features for creating VCD files. This file format was first introduced in the IEEE 1364-1995 Verilog standard.

VCD Structure

VCD files can be categorized into four-state VCD files, and extended VCD files. In a four-state VCD file, variable changes are represented by 0, 1, X, and Z with no strength information while in an extended VCD file, variable changes are represented by all states and strength information. A VCD file is composed of sections for header specification, node information, and value changes.

Four-State VCD File Structure

A four-state VCD file is an ASCII file composed of three different sections discussed below.

Header Section.

The header of a VCD file consists of the information about the entire file. This information includes creation date and time of the current VCD file, the simulator version used to generate the VCD file, and the timescale for the corresponding parameters. To represent the creation date and time of a VCD file

$date keyword is used. The VCD writer version and the timescales are specified using $version and $timescale keywords.

To specify the timescale, a timescale number and a unit are required. According to the IEEE Verilog standard, the timescale number should be 1, 10, or 100 and the timescale unit should be s, ms, us, ns, ps, and fs [3]. All header section constructs terminate with the $end keyword. A complete example of a VCD file is shown in Figure 95.4.

Timing Description Languages-0469

Node Information Section.

The node information section starts with $scope and terminates with $enddefinitions $end keywords. This section deals with scope definitions and the types of variables being dumped. $scope, $upscope, $comment, and $var keyword commands can be included in this section.

$scope: $scope keyword command defines the scope of the variables being dumped. Scope types can be classified into five different categories as shown below:

module: This type represents the top-level module and module instances. The $scope module

mod1 command specifies that signals of mod1 module are to be dumped.

task: This type is used to introduce tasks.

function: This type represents functions.

begin: This type specifies scope as a named sequential block.

fork: This type is utilized to define scope to be a named parallel block.

$upscope: This keyword command indicates the change of the current scope to the next higher scope in the design hierarchy.

$comment: Comments can be inserted in a VCD file using the $comment keyword command.

$var: This keyword command is used to specify a VCD symbol for each variable being dumped. A VCD symbol can be any sequence of printable ASCII characters. Each dumped variable is mapped to a unique VCD symbol. In some cases more than one variable is represented by a symbol. This occurs only if two differently named variables reference the same value. $var com- mand has four different fields. The first, second, and fourth fields specify the type, size, and name of the variable being dumped, while the third field specifies the corresponding VCD symbol. The acceptable variable types in this command are: event, integer, parameter, real, reg, supply0, supply1, time, tri, triand, trior, trireg, tri0, tri1, wand, wire, and wor.

Note that the individual bits of a vector can be dumped individually. Figure 95.5 shows the waveforms of a 4-bit 2-to-1 multiplexer (Figure 95.5(a)) and the header and node information sections of the corresponding extended VCD file (Figure 95.5(b)).

Timing Description Languages-0470

Value Change Section.

This section deals with the value change of variables declared in the node information section.

Variable Values Format — Scalar and vector value changes are dumped according to their related formats. To introduce a scalar variable, the VCD symbol should immediately follow the corresponding value digits, i.e., no space character is permitted between the VCD symbol and the corresponding value digits.

Timing Description Languages-0471

To represent a vector variable, the corresponding value digits immediately follow a base character but a space character is required between the value digits and the VCD symbol. This base character is used to declare the type of the vector variable. ‘B’ and ‘b’ characters are utilized for binary vector representation while ‘R’ and ‘r’ characters are used to specify real vectors. Note that data in the VCD file is case-sensitive.

Keyword Commands — The value of the variables being dumped can be specified by utilizing (but not be limited to) the following commands.

$dumpvar: This keyword command indicates the initial values of all variables being dumped.

$dumpoff: $dumpoff keyword command shows that all variables are dumped with value X.

$dumpon: This keyword command indicates the current values of all the variables being dumped. Between a $dumpoff and its next $dumpon, no value changes are dumped.

$dumpall: $dumpall keyword command specifies the current values of all variables being dumped.

The value change section of the four-state VCD file corresponding to the waveform of Figure 95.5(a) is shown in Figure 95.6.

Extended VCD File Structure

In a four-state VCD file, variable changes can be represented by four different states: 0, 1, X, and Z with no strength information. However, this set of states is not always sufficient for representing value changes, i.e., in some cases more than four states are required to provide the necessary information about bidirec- tional pins, such as the driving direction, driving strength, and collision detection. The format of the extended VCD file is similar to that of the four-state VCD file, i.e., an extended VCD file is an ASCII file composed of three different sections: header, node information, and value change sections.

Header Section.

The header of an extended VCD file is similar to that of a four-state VCD file. This section includes the creation date and time of the current VCD file, the version of the simulator that has been used to generate the VCD file, and the timescale for the corresponding parameters.

Node Information Section.

The node information section which starts with $scope and terminates with $enddefinitions $end keyword commands, deals with the definitions of ports being dumped. $scope, $upscope, $comment, $var, and $vcdclose keyword commands can be included in this section.

$scope: The only allowable scope type in an extended VCD file is module. In this case, the module keyword is utilized to represent the top-level module and module instances.

$upscope: This keyword command indicates the change of the current scope to the next higher scope in the design hierarchy.

$comment: Comments can be inserted in an extended VCD file using $comment keyword command.

$var: In the extended VCD file (similar to the four-state VCD file) $var keyword command specifies a VCD symbol for each variable being dumped. The $var keyword command has four different fields. The first, second, and fourth fields specify the type, size, and name of the variable being dumped, while the third field introduces the corresponding VCD symbol. Note that the only allowable variable type in an extended VCD file is port. If a port is a bus, the size field indicates its actual index; otherwise the size value is 1. The VCD symbol of each port is an integer number preceded by the <character. This integer value starts at zero and is increased one unit per port in the order found in the module declaration.

$vcdclose: This keyword command which is not included in a four-state VCD file indicates the final simulation time.

Figure 95.7 shows the waveforms of a 4-bit counter (Figure 95.7(a)) and the header and node information sections of the corresponding extended VCD file (Figure 95.7(b)).

Value Change Section.

This section discusses the value changes of the ports identified in the node information section. The following keyword commands can be used to represent the values of the dumped ports.

$dumpportsoff: $dumpportsoff keyword command shows that all variables are dumped with value X.

$dumpportson: This keyword command indicates the current values of all variables being dumped. Between a $dumpportsoff and its next $dumpportson no value changes are dumped.

$dumpportsall: This keyword command specifies the current values of all variables being dumped.

$dumpports: This keyword command indicates the current values and strengths of the dumped ports and consists of the following five fields: the p character, port-value, 0-strength-componenet, 1-strength-component, and the corresponding VCD symbol. 0- and 1-strength-components represent 0 and 1 strengths of a port value.

An integer between 0 and 7 specifies the strength0 (1) specification of a port. Integers 0 to 7 represent high, small, medium, weak, large, pull, strong, and supply strength values, respectively.

The p character which begins a port value is followed by what is referred to as a state character. This character specifies port states for inputs, outputs, and bidirectional ports. Acceptable values for input ports are D, U, N, Z, d, and u that are used for low, high, unknown, tri-state, low (two or more drives active), and high (two or more drives active) states, respectively. Values for output ports are L, H, X, T, l, and h that are used for low, high, unknown, tri-state, low (two or more drives active), and high (two or more drives active) states, respectively. Values for bidirectional ports are 0, 1, F, ?, A, a, B, b, C, c, and f. The first two values are used for low and high states, the third value represents tri-states and other values represent the unknown states (depending on the input and output values of the specified port).

Figure 95.8 shows the value change section of the extended VCD file corresponding to the waveform shown in Figure 95.7(a).

Timing Description Languages-0472

Timing Description Languages-0473

Our Coverage of VCD

VCD is a general portable format for waveform display. In the preceding section, we discussed the basics of VCD and how it could be used for representation of waveforms. In the examples that we presented, constructs of this language and their utilization were discussed. Because VCD is a simple format, in the above discussion we were able to discuss most of its structures and capabilities.

Comments

Popular posts from this blog

Square wave oscillators and Op-amp square wave oscillator.

Adders:Carry Look-Ahead Adder.

Timing Description Languages:SDF