Compare

X-Amin can perform logic equivalency checking between two different designs or between two signals within a design. When performing equivalency checking, X-Amin models all clocked signals as inputs and only compares the combinational path driving the two signals. Therefore, when comparing two different designs, it is necessary for X-Amin to match input and register names between the designs. X-Amin will automatically match together inputs, outputs and registers that have the same name. For all other cases, it is necessary for the user to create a mapping file that specifies how inputs, outputs and registers are to be matched.

Given the following code:

module test (clk, a, b, c);
 input clk;
 input a, b, c;
 
 wire [1:0] zwire;
 assign zwire = (a) ? 0 : (b) ? 2 : (c) ? 3 : 0;
 
 reg [1:0] zcomb;
 always @(a or b or c)
 if (a)
 zcomb <= 1;
 else if (b)
 zcomb <= 2;
 else if (c)
 zcomb <= 3;
 else
 zcomb <= 0;
 reg [1:0] zreg;
   always @(posedge clk)
   if (a)
   zreg <= 1;
   else if (b)
   zreg <= 2;
   else if (c)
   zreg <= 3;
   else
   zreg <= 0;
   
   endmodule
   

We can use compare to see if zwire, zcomb and zreg are equivalent:

> compare zwire zcomb
     Comparing: zwire with zcomb
     ERROR: zwire and zcomb are not identical
---------------------------- compare errors ----------------------------
   -- inputs
   a = 1
   b = 0
   c = 0
   -- outputs
   zwire evaluates to: 00
   zcomb evaluates to: 01
------------------------------------------------------------------------
> compare zcomb zreg
     Comparing: zcomb with zreg
     zcomb and zreg are identical
   

To compare two designs they must both be linked at the same time.

> link moda modb
 Namespace ':moda' linked
 Namespace ':modb' linked

To compare all outputs and register inputs (assumes same input and register names as would be expected in different revs of the same module):

> compare moda modb
     Comparing: moda.zcomb with modb.zcomb
     ERROR: moda.zcomb and modb.zcomb are not identical
---------------------------- compare errors ----------------------------
   -- inputs
   a = 1
   b = 0
   c = 0
   -- outputs
   moda.zcomb evaluates to: 00
   modb.zcomb evaluates to: 01
------------------------------------------------------------------------

   Comparing: moda.zreg with modb.zreg
   moda.zreg and modb.zreg are identical
   

To compare two components in GUI mode, select both components in the Components Window using the Ctrl key along with the left mouse button. Then, use the Analyze menu (Analyze->Compare) or Compare icon in the Analyze toolbar to invoke the Compare Options dialog.

To compare two signals in GUI mode, select the component in the Components Window then select the two signals in the Signals Window using the Ctrl key along with the left mouse button. Then, use the Analyze menu (Analyze->Compare) or Compare icon in the Analyze toolbar to invoke the Compare Options dialog.

Map File: When comparing multiple components, all outputs and internal FF's of the designs must be matched together. X-Amin automatically matches these items by name. However, if names differ between designs, the user must create a map file to specify how the items will be matched.

The map file format is straightforward. The file contains sections for each pairing of components. Each section consists of a section header which specifies which components are being paired, followed by the detailed pairings. The file can also contain C/C++ style comments. An example Map File is shown below:

// signal name mapping from comp1 to comp2
[comp1 : comp2]
comp1_sig1 : comp2_sig1
comp1_sig2 : comp2_sig2
comp1_sig3 : comp2_sig3
/* signal name mapping from comp2 to comp3 */
[comp2 : comp3]
comp2_sig1 : comp3_sig1
comp2_sig2 : comp3_sig2

Map Report: Select this control to produce a report listing of how X-Amin mapped the signals.

Use Hierarchical Signals: Select this control to produce output with all signals identified using their full hierarchical names. This can be helpful for large designs with similarly named signals in different instances.

 

compare Command

Comparison analysis can also be run using the compare command entered in the GUI Command Entry box or on the command line in command-line mode. The compare command format is:

SYNTAX
 (void) compare
   [-mapfile <mapfile>]
   [-mapreport]
   [-hier]
   <namespace1> <namespace2> OR <expr1> <expr2>
ARGUMENTS
 -mapfile <mapfile>
   Specifies an register/output mapfile to use. The
   compare function must pair all outputs and internal
   registers for the compare function. By default,
   pairing is done by name. If names are not the same
   between the two namespaces, a mapfile must be used
   to associate the registers and outputs. 
 -mapreport
   Causes a report of the mapping name associations to
   be generated.
 -hier Specifies that hierarchical names are to be used
   for all signals.
 <namespace1> <namespace2>
   Specifies the namespaces to be compared. All out­
   puts and internal registers will be compared.
 <expression1> <expression2>
   Specifies two expressions (typically outputs or
   internal registers) to be compared