
- •Contents
- •Introducing Comparescan
- •Features
- •Applications
- •Organization of this Guide
- •Getting Started
- •Starting Comparescan
- •Specifying Input Files
- •Specifying Simulation Results Databases for Comparison
- •Specifying a Comparescan Rules File
- •Specifying a Comparescan Error Database for Viewing
- •Using Automatically Generated Files
- •Using the State File
- •Using the Preferences File
- •Using X Resources
- •Understanding Comparescan Exit Status Codes
- •Comparescan Tutorial
- •Accessing the Tutorial Source Files
- •Simulation Results Databases
- •Comparescan Rules Files
- •Generating a Comparescan Error Database
- •Viewing a Comparescan Error Database
- •Viewing Errors in Hierarchical Order
- •Viewing Errors in Signalscan Waves
- •Viewing Multiple Objects in Signalscan Waves
- •Viewing Errors in Time Order
- •Exiting Comparescan
- •Giving More Information in the Rules File
- •Reviewing the demo.rules Rules File
- •Using the demo.rules Rules File
- •Viewing Clocked Miscompares in Signalscan Waves
- •Comparescan Graphical User Interface
- •Comparescan Window
- •Menu Bar
- •File Menu
- •Tools Menu
- •View Menu
- •Window Menu
- •Button Bar
- •Application Examples
- •Making Absolute Comparisons
- •Specifying the Filename of an Object
- •Comparing Two Objects from the Same File
- •Comparing Two Objects on a Condition
- •Making Clocked Comparisons
- •Using One Clock and Two Simulation Files
- •Using One Clock and One Simulation File
- •Using Two Clocks and Two Simulation Files
- •Using Two Clocks and One Simulation File
- •Performing a Clock Compare with Timing Checks
- •Checking Stability
- •Specifying Objects in the Design Hierarchy
- •Command Option Examples
- •Specifying Start and End Times for Golden and Test Files
- •Specifying Start and End Times for Comparison
- •Specifying a Time Shift
- •Specifying compare Command Tolerance Windows
- •Special Syntax Examples
- •Commenting
- •Continuing Long Lines
- •Specifying Both a Golden and a Test File
- •Specifying Filenames Using UNIX Filename Syntax
- •Writing Comparescan Rules
- •Default Comparison Rules
- •Absolute and Clocked Comparisons
- •Rules File Parsing and Execution
- •Command Syntax and Options
- •General Command Syntax
- •Command Summary
- •General Command Options
- •datafile1
- •datafile2
- •compare
- •clkdef
- •clkcompare
- •stability
- •sequencetime
- •nosequencetime
- •statemapping
- •threshold
- •report
- •savedata
- •loaddata
- •translate
- •Frequently Asked Questions
- •Comparescan Input
- •Comparescan Output
- •How do I view a comparison report that I have generated?
- •Can I print a report of my errors?
- •Can I run the tool in batch mode?
- •Graphical User Interface (GUI)
- •How do I run the program without the user interface?
- •Why can’t Comparescan allocate colors?
- •How do I change the colors in the GUI?
- •Why can’t I read the text in the GUI?
- •Comparescan Features
- •How can I compare a digital simulation with an analog simulation?
- •How do I match an X value?
- •How do I compare only the top-level signals in my design?
- •How do I compare modules at different levels in the hierarchy?
- •What if I want a different tolerance window for every signal?
- •Comparescan Error Messages
- •What does “Out of Memory” mean?
- •What does “fork failed” mean?
- •Index

Comparescan User Guide
6
Writing Comparescan Rules
This chapter describes the syntax and semantics of Comparescan rules files.
A rules file is a text file that contains a set of Comparescan commands that specify the files or signals that you want to compare and how you want to compare them. You can limit a comparison to a portion of the design hierarchy or to a portion of simulation time. You can also define complicated functions, such as timing checks.
For an example of a rules file, see “Reviewing the demo.rules Rules File” on page 31.
Note: Rules and options that you specify in the rules file override the options that you specify on the Compare Options form.
If you do not specify a rules file on the command line or set your options on the Compare Options form, Comparescan uses a set of default rules. See “Default Comparison Rules” on page 56 for a listing of these default rules.
This chapter discusses the following topics:
■“Default Comparison Rules” on page 56
■“Absolute and Clocked Comparisons” on page 56
■“Rules File Parsing and Execution” on page 57
■“Command Syntax and Options” on page 58
December 2000 |
55 |
Product Version 1.9 |

Comparescan User Guide
Writing Comparescan Rules
Default Comparison Rules
Comparescan uses the following default comparison rules whenever you compare two simulation results databases without specifying a rules file on the command line or setting options on the Compare Options form and you have no ~/.comparescan.state file:
nosequencetime
compare . -depth 1 -internal -maxerrors 10
These two rules turn sequence timing off and then compare all of the internal signals in the main module of your designs. If there are more than 10 errors on any signal, Comparescan skips to the next signal.
See Table 6-2 on page 61 for a list of the default values for the compare command options.
Absolute and Clocked Comparisons
Comparescan supports two types of comparisons, absolute compare and clocked compare. An absolute compare finds all of the differences between two signals at any point in time. A clocked compare checks signal values only on the clock edges.
A clocked compare is much faster than an absolute compare and is therefore more commonly used.
An absolute compare (compare) is an event-matching comparison. Every event in the golden simulation must match an event in the test simulation. You can specify a tolerance window to facilitate this type of matching.
A clocked compare (clkcompare) is a clock-edge sample comparison and stability check. A clocked compare is very useful for comparing signals that have many uninteresting transitions before stabilizing.
The compare and clkcompare commands can take several options. You can use the -tol, -pos and -neg options to specify the window of tolerance for a comparison. The -pos option specifies the positive tolerance, or the amount of time before the edge, and the -neg option specifies the negative tolerance, or the amount of time after the edge. The -tol option specifies both the positive and negative tolerances.
When you use the clkcompare command, you must specify an additional signal as the clock signal. By default, a comparison occurs on the rising edge (-posedge) of the clock, but you can cause the comparison to occur on the falling edge or on both edges by using the
-negedge or -bothedge option.
December 2000 |
56 |
Product Version 1.9 |

Comparescan User Guide
Writing Comparescan Rules
The clkcompare command can also take options to perform setup and hold timing checks.
If you specify these options, Comparescan automatically checks the setup and hold times for the signals that you specify.
If you only want to check for setup and hold violations without performing any comparisons, you can use the stability command.
You can also add the when statement to your comparison commands to qualify errors. If you use the when statement, Comparescan only reports errors when the expression that you specify in the when statement evaluates to true.
Rules File Parsing and Execution
A rules file is a text file that contains a set of Comparescan commands or rules. Comparescan parses the rules file using a simple white space parser. White space is any of the following: space, tab, carriage return, or newline. A command in the rules file is made up of tokens separated by white space.
When Comparescan parses a command from the rules file, the rule interpreter executes that command immediately — that is, the effect of each command and option is immediate.
Comparescan processes options from left to right. You can specify options in any order. Options that are entered further to the right on the command line override any conflicting options that are further to the left on the same command line.
You can enter commands in any order in the rules file, with the following exceptions:
■All datafile1 and datafile2 commands must precede any compare, clkdef, clkcompare, or stability commands.
■If you use a clkdef command to define a clock signal, then that clkdef command must precede any use of that defined clock signal, such as in a clkcompare or stability command.
You should compare an object only once in a rules file. If you compare a signal or variable more than once in the same rules file, the error reports may be confusing. For example, if you compare top.a to top.b, and then compare top.a to top.c, Comparescan may produce error messages that are hard to understand, since the tool compares top.a twice.
December 2000 |
57 |
Product Version 1.9 |