Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
dsd1-10 / dsd-07=Verilog / comparescan.pdf
Скачиваний:
78
Добавлен:
05.06.2015
Размер:
760.57 Кб
Скачать

Comparescan User Guide

Writing Comparescan Rules

clkdef

clkdef clockDefinitionName clockSignal [options]

You use a clkdef command to define a clock for use in a clkcompare or stability clock compare. A clock definition is a name that refers to a signal in your design and has clock compare options applied to it.

clkdef Command Examples

Below, the name clk_check1 is defined as a reference to the signal top.cpu.clk1, with setup and hold times of 20ns each. The name clk_check2 is defined as a reference to the same clock again, but with setup and hold times of 10ns each.

clkdef clk_check1 top.cpu.clk1 -setup 20ns -hold 20ns

clkdef clk_check2 top.cpu.clk1 -setup 10ns -hold 10ns

If you do not want to use any options in your clock definition, then you do not need the clkdef command. You can use the actual signal name in the clkcompare statement, as shown below:

//In the following example, the clkdef command is unnecessary: clkdef clk1 top.clk

clkcompare clk1 top.signal

//The following rule is equivalent to the above two rules: clkcompare top.clk top.signal

clkdef Command Options

See -setup, -hold, -posedge, -negedge, and -bothedge in Table 6-8 on page 80.

December 2000

77

Product Version 1.9

Comparescan User Guide

Writing Comparescan Rules

clkcompare

clkcompare clock1 signal1 [clock2] [signal2] [options]

You use the clkcompare command to sample and compare two signals within a clock cycle (clocked compare) and perform setup and hold timing checks on these comparisons (using the -setup and -hold options).

By default, Comparescan samples the specified signals on an edge of a clock signal. (See the -posedge, -negedge, and -bothedge options in Table 6-8 on page 80 for instructions on how to alter this default setting.) However, you can move the actual sampling time relative to the clock edge. (Use the -sample options to do this.)

Once Comparescan samples the specified signals, it compares their values. If the values do not match, Comparescan reports an error.

clkcompare Command Arguments

A fully specified clkcompare statement has four arguments:

clock1—the name of the clock signal that you want to use with signal1

signal1—the name of the signal that you want to compare to signal2

clock2—the name of the clock signal that you want to use with signal2

signal2—the name of the signal that you want to compare to signal1

Only two of these arguments are required: You must specify at least clock1 and signal1.

The Comparescan rule parser fills in any argument that you do not specify before the parser executes the clkcompare rule, as follows:

If you specify only two arguments, the parser assumes that they are the clock name and the signal or module name, respectively. The parser reuses the clock name and the signal name that you specify for the unspecified clock2 and signal2 arguments.

If you specify only three arguments, the parser assumes that they are the clock name and the two signal or module names, respectively. The parser reuses the clock name that you specify for the unspecified clock2 argument.

Given the rules described above, the correct syntax for the clkcompare command depends on what you want to compare, as described below:

Use the following syntax to compare all of the signals in both the golden and test files at the edges of a clock signal:

December 2000

78

Product Version 1.9

Comparescan User Guide

Writing Comparescan Rules

clkcompare clock1 . [options]

Use the following syntax to compare a specific signal in both the golden and test files at the edges of a clock signal:

clkcompare clock1 signal1 [options]

Use the following syntax to compare two signals with different names at the edges of just one clock:

clkcompare clock1 signal1 signal2 [options]

Use the following syntax to compare the value of signal1 on the edges of clock1 with the value of signal2 on the edges of clock2:

clkcompare clock1 signal1 clock2 signal2 [options]

To compare two different signals within the same file, specify only one input file (using the datafile1 command, but not the datafile2 command), or use the n:: syntax described in “Variable and Module Naming in Different Files” on page 70.

Setting clkcompare Command Options

Comparescan searches for clkcompare rule options in the following order:

1.Options that you specify with the clkcompare command

2.Options that you specify with the clkdef commands

3.Options that you specify with the datafile commands

4.Options that you specify using the Compare Options form

5.Comparescan defaults

For example, to define two clocks with setup times of 20ns and 10ns and hold times of 10ns, you can use the following code in your rules file:

clkdef clk10 top.clk -setup 10ns -hold 10ns

clkdef clk20 top.clk -setup 20ns -hold 10ns

Now you can use these clocks in clkcompare statements, as follows:

clkcompare clk10 top.module1

clkcompare clk20 top.module2

clkcompare clk20 top.module3

The following rules use the clocks that are specified in the clkdef commands above but override the hold time of 10ns:

clkcompare clk10 top.module5 -hold 5ns

clkcompare clk20 top.module6 -hold 0

December 2000

79

Product Version 1.9

Comparescan User Guide

Writing Comparescan Rules

clkcompare Command Options

In addition to the options that are described in Table 6-2 on page 61, the clkcompare command can take any of the options that are defined in the following table:

Table 6-8 clkcompare and stability Command Options

Options

Meaning

Default

 

 

 

-sample N

Specifies the number of time units, N, by which

-sample 0

 

the sampling times for the comparison and the

 

 

relative times at which setup and hold timing

 

 

checks occur are offset from the edges of

 

 

clock1 and from the edges of clock2.

 

 

The default value is 0, which means that each

 

 

sample is taken at the clock edge and all setup

 

 

and hold checks are performed relative to the

 

 

clock edge.

 

-sample1 N

Specifies the number of time units, N, by which

-sample1 0

 

the sampling times for the comparison and the

 

 

relative times at which setup and hold timing

 

 

checks occur are offset from the edges of

 

 

clock1.

 

-sample2 N

Specifies the number of time units, N, by which

-sample2 0

 

the sampling times for the comparison and the

 

 

relative times at which setup and hold timing

 

 

checks occur are offset from the edges of

 

 

clock2.

 

-setup N

(Setup Time on the Compare

Options form)

Specifies the setup time for both clock1 and

-setup 0

clock2.

 

A setup time of zero means that no setup timing

 

check is performed.

 

Negative setup times are not supported. Use the

 

-sample option to negatively offset the times at

 

which setup timing checks are performed.

 

-setup1

N

Specifies the setup time for clock1.

-setup1

0

-setup2

N

Specifies the setup time for clock2.

-setup2

0

December 2000

80

Product Version 1.9

Comparescan User Guide

Writing Comparescan Rules

Table 6-8 clkcompare and stability Command Options, continued

Options

Meaning

Default

-hold N

(Hold Time on the

Compare Options form)

Specifies the hold time for both clock1 and

-hold 0

clock2.

 

A hold time of zero means that no hold timing

 

check is performed.

 

Negative hold times are not supported. Use the

 

-sample option to negatively offset the times at

 

which hold timing checks are performed.

 

-hold1 N

Specifies the hold time for clock1.

-hold1 0

-hold2 N

Specifies the hold time for clock2.

-hold2 0

-posedge

Specifies the active edge (the edge at which

-posedge

 

sampling occurs) as the positive edge of clock1

 

 

and the positive edge of clock2.

 

-posedge1

Specifies the active edge as the positive edge of

-posedge

 

clock1.

 

-posedge2

Specifies the active edge as the positive edge of

-posedge

 

clock2.

 

-negedge

Specifies the active edge (the edge at which

-posedge

 

sampling occurs) as the negative edge of

 

 

clock1 and the negative edge of clock2.

 

-negedge1

Specifies the active edge as the negative edge of

-posedge

 

clock1.

 

-negedge2

Specifies the active edge as the negative edge of

-posedge

 

clock2.

 

-bothedge

Specifies the active edges (the edges at which

-posedge

 

sampling occurs) as both the positive and

 

 

negative edges of clock1 and clock2.

 

-bothedge1

Specifies the active edges as both the positive

-posedge

 

and negative edges of clock1.

 

-bothedge2

Specifies the active edges as both the positive

-posedge

 

and negative edges of clock2.

 

 

 

 

December 2000

81

Product Version 1.9

Comparescan User Guide

Writing Comparescan Rules

clkcompare Command Example 1

The example clock comparison that is graphed in Figure 6-2 on page 82 uses the following rules:

datafile1 golden.trn

datafile2 test.trn

clkdef clk1 top.clk -setup 20 -hold 10

clkcompare clk1 top.s1

Setup and hold times are relative to the positive edges of the clock.

Figure 6-2 Clock Comparison with Setup and Hold Checks

Clock Edges

500

600

top.clk

Golden

Simulation

golden.trn :: top.s1

Test

Simulation

test.trn :: top.s1

 

Setup and Hold

 

Sample Point

Checks

Sample Point

 

clkcompare Command Example 2

The example clock comparison that is graphed in Figure 6-3 on page 83 uses the following rules:

datafile1 golden.trn

datafile2 test.trn

clkdef clk1 top.clk -sample 75ns -setup 20ns -hold 10ns

clkcompare clk1 top.s1

December 2000

82

Product Version 1.9

Comparescan User Guide

Writing Comparescan Rules

Setup and hold times are relative to the sample point.

Figure 6-3 Clock Comparison with Offset Sample, Setup, and Hold Times

 

Clock Edge

 

500

575

600

top.clk

Golden

Simulation

golden.trn :: top.s1

Test

Simulation

test.trn :: top.s1

Sample

Setup and Hold Point

Check

December 2000

83

Product Version 1.9

Соседние файлы в папке dsd-07=Verilog