\newpage
\section{The NETCMP network comparator}\index{network comparison}\index{NETCMP}

   The netlist files generated by the \NEWOL\ extractor can be compared
to a reference netlist (generated, for example, by the LOG/ANALOG schematic
capture system) using the NETCMP network comparison program.  This
program is external to \NEWOL, and must be run separately.  NETCMP
prompts for two .NTK files, and for a file into which to write the results
of the comparison.

  The comparator works by alternately considering transistors and nodes.
These are divided into {\em equivalence classes}; initially, transistors
are divided by type (p and n), and nodes are divided by fanout (number of n
and p gates and drain/sources).  The algorithm then subdivides the
transistors into classes whose terminals connect to nodes which are
themselves in the same classes.  The node classes are then subdivided
according to the transistor classes that connect to them.  This procedure
is repeated until no further subdivision is possible.  Ideally, at this
point, all equivalence classes have exactly two elements (one from each
circuit being compared).  In some cases, {\em automorphisms} exist where an
equivalence class contains an even number of indistinguishible elements
(e.g.  parallel driver transistor structures) -- by default, automorphisms
are not flagged as errors.  A true error exists if the subdivision
algorithm wants to fracture an equivalence class into classes with odd
numbers of elements.  These error classes are printed {\em in their
entirety} when the algorithm reaches its fixed-point.  Nodes are printed
with their fanouts (number of n-gates (ng), n-source/drains (ns), p-gates
(pg) and p-source/drains (ps)).

   The most effective way to use the comparator output is the following:
\begin{enumerate}
\item Make sure that both circuits contain the same number of transistors.
\item Make sure that both circuits contain the same number of nodes.
\item Get the fanout of the power nodes right.  These are easy to find:
   $V_{dd}$ connects to a {\em large} number of p-source/drains, and
   $Gnd$ connects to a similarly large number of n-source/drains.
\item Look for patterns in the outputs.  In general, it is easier to
   locate nodes with different transistor fan-outs.  It is often possible
   to identify two nodes in one circuit which, if they were connected, would
   sum up to one node in the other circuit.  Then go looking for missing
   wires in the geometry or schematic.
\item Look for differences between topologies and logic.  For example,
   on a logic diagram, the two inputs of a NAND gate are equivalent.  In
   a VLSI layout, however, they are not at all the same (think about the
   pull-down chain).
\item The hardest problems to find are in highly symmetric networks.  For
   example, taking the wrong output from a flip-flop is a serious logical
   error, but a subtle topological problem.
\end{enumerate}

Sample session with NETCMP:
\begin{verbatim}
NETCMP #1.04; compiled Sep 5, 1985 5:12 pm
  Enter output file name [/spool/apple.text/MASS]: (cr)
Enter input filename 1 : [.NTK] csrltcell
Parsing file: csrltcell.ntk
Found:  9 N Transistors,    9 P Transistors, 18 Total Transistors,
        11 Non-orphan Nodes, 0 Orphans,       11 Total Nodes.
Enter input filename 2 : [.NTK] csrltcell.lntk
Parsing file: csrltcell.lntk
Found:  9 N Transistors,    9 P Transistors, 18 Total Transistors,
        11 Non-orphan Nodes, 0 Orphans,       11 Total Nodes.
netcmp> ?
NETCMP command summary
   auto -- toggle display of automorphisms 
   comp -- compare the networks 
   quit -- exit the program 
   help -- print this list 
   dbug -- toggle debug mode 
   slow -- ALWAYS consider classes for subdivision
   long -- print extra long results
   dump -- dump data structure 
   node -- print info about node 
   read -- read .ntk files 
netcmp> comp
Iteration: 1; Transistor classes = 9 (+7); Node classes = 7 (+0)
  Memory left = 1762K; used = 23K

Iteration: 2; Transistor classes = 9 (+0); Node classes = 7 (+0)
  Memory left = 1762K; used = 23K

************  results of fixed-point iteration **************
1 difference found.
netcmp> quit

\end{verbatim}

Sample output from NETCMP:
\begin{verbatim}
Parsing file: netcmp.NTK
Found:  9 N Transistors,    9 P Transistors, 18 Total Transistors,
        11 Non-orphan Nodes, 0 Orphans,       11 Total Nodes.

Parsing file: netcmp2.NTK
Found:  9 N Transistors,    9 P Transistors, 18 Total Transistors,
        11 Non-orphan Nodes, 0 Orphans,       11 Total Nodes.

Iteration: 1; Transistor classes = 9 (+7); Node classes = 7 (+0)
Iteration: 2; Transistor classes = 9 (+0); Node classes = 7 (+0)
************  results of fixed-point iteration **************

-----------------------------------------------
   (2)  Node: _5 fanout:     pg=0 ng=0 ps=1 ns=2
   (1)  Node: MINUS fanout:  pg=0 ng=0 ps=1 ns=1
   (1)  Node: PLUS fanout:   pg=2 ng=2 ps=2 ns=2
   (2)  Node: _7 fanout:     pg=2 ng=2 ps=2 ns=1

1 difference found.
\end{verbatim}

   (Interpretation of above results:  a source/drain of a transistor
connecting to node 5 in the layout SHOULD have been connected to
node 6 instead.  This assumes that circuit (1) is the schematic
representation and is correct.)


