com.sun.electric.tool.ncc
Class NccGlobals

java.lang.Object
  extended by com.sun.electric.tool.ncc.NccGlobals
All Implemented Interfaces:
NccGlobalsReportable

public class NccGlobals
extends java.lang.Object
implements NccGlobalsReportable

I tried to make NCC thread safe. Therefore there are a minimum of static variables. Instead, most of what would have been NCC's global variables are stored in NccGlobals. A new NccGlobals is created every time NccEngine.compare() is started. Therefore two jobs can call NCC at the same time without interfering with each other.


Field Summary
 int passNumber
          pass number shared by strategies
 
Constructor Summary
NccGlobals(NccOptions options, Aborter aborter)
          The constructor initializes global root, parts, wires, and ports from net lists.
 
Method Summary
 boolean cantBuildNetlist()
           
 boolean[] cantBuildNetlistBits()
           
 void error(boolean pred, java.lang.String msg)
          Print a message and abort execution if pred is true.
 void error(java.lang.String msg)
          Print a message and abort execution
 void flush()
          Flush System.out
 BenchmarkResults getBenchmarkResults()
          Get result of benchmarking performance counters
 HierarchyEnumerator.NetNameProxy[][] getEquivalentNets()
           
 HierarchyEnumerator.NodableNameProxy[][] getEquivalentNodes()
           
 NccGuiInfo getNccGuiInfo()
          Get mismatches to be displayed in the GUI
 int getNumNetlistsBeingCompared()
          Say how many netlists are being compared.
 NccOptions getOptions()
          Get the NCC options.
 int[] getPartCounts()
           
 LeafEquivRecords getPartLeafEquivRecs()
          Get the leaf equivalence records of the Part equivalence record sub tree
 EquivRecord getParts()
          get the root of equivalence record subtree for Parts
 int[] getPortCounts()
           
 LeafEquivRecords getPortLeafEquivRecs()
          Get the leaf equivalence records of the Port equivalence record sub tree
 EquivRecord getPorts()
          get the root of the equivalence record subtree for Ports
 int getRandom()
          Generate non-recurring pseudo-random integers
 EquivRecord getRoot()
          get the root of the equivalence record tree
 java.lang.String[] getRootCellNames()
          get an array of root Cell Names, one per netlist.
 Cell[] getRootCells()
          get an array of root Cells, one per netlist
 VarContext[] getRootContexts()
          get an array of VarContexts, one per netlist
 int[] getWireCounts()
           
 LeafEquivRecords getWireLeafEquivRecs()
          Get the leaf equivalence records of the Wire equivalence record sub tree
 EquivRecord getWires()
          get the root of the equivalence record subtree for Wires
 void initLeafLists()
          Initialization.
 void pr(java.lang.String s)
          A conveniently terse method for printing to Electric's message window
 void prln(java.lang.String s)
          A conveniently terse method for printing to Electric's message window
 void setInitialNetlists(java.util.List<NccNetlist> nccNets)
          Build the initial equivalence record trees from the netlists that are to be compared.
 void status1(java.lang.String msg)
          Print more important status messages into the Electric messages window.
 void status2(java.lang.String msg)
          Print less important status messages into the Electric messages window.
 boolean userWantsToAbort()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

passNumber

public int passNumber
pass number shared by strategies

Constructor Detail

NccGlobals

public NccGlobals(NccOptions options,
                  Aborter aborter)
The constructor initializes global root, parts, wires, and ports from net lists.

Parameters:
options - the options controlling how NCC performs the comparison
aborter - an object that NCC queries to determine if the user wants to abort NCC in the middle of a run.
Method Detail

prln

public void prln(java.lang.String s)
A conveniently terse method for printing to Electric's message window


pr

public void pr(java.lang.String s)
A conveniently terse method for printing to Electric's message window


setInitialNetlists

public void setInitialNetlists(java.util.List<NccNetlist> nccNets)
Build the initial equivalence record trees from the netlists that are to be compared. In principle, NCC can compare more than two netlists at the same time, but in practice we've never found a use for this.

Parameters:
nccNets - two or more netlists that are supposed to be topologcially identical.

initLeafLists

public void initLeafLists()
Initialization. Tricky! initLeafLists() must be called AFTER series/parallel merging. and AFTER Local Partitioning!!! Both of those processes violate invariants assumed by LeafEquivRecords.


getRoot

public EquivRecord getRoot()
get the root of the equivalence record tree


getParts

public EquivRecord getParts()
get the root of equivalence record subtree for Parts


getWires

public EquivRecord getWires()
get the root of the equivalence record subtree for Wires


getPorts

public EquivRecord getPorts()
get the root of the equivalence record subtree for Ports


getNumNetlistsBeingCompared

public int getNumNetlistsBeingCompared()
Say how many netlists are being compared. This will usually be two. In principle NCC can compare any number of netlists but we've never found a use for this feature.


getRootCells

public Cell[] getRootCells()
get an array of root Cells, one per netlist

Specified by:
getRootCells in interface NccGlobalsReportable

getRootContexts

public VarContext[] getRootContexts()
get an array of VarContexts, one per netlist

Specified by:
getRootContexts in interface NccGlobalsReportable

getRootCellNames

public java.lang.String[] getRootCellNames()
get an array of root Cell Names, one per netlist.

Specified by:
getRootCellNames in interface NccGlobalsReportable

status1

public void status1(java.lang.String msg)
Print more important status messages into the Electric messages window. The user selects how verbose NCC is using the howMuchStatus option.

Parameters:
msg - the message to be printed.

status2

public void status2(java.lang.String msg)
Print less important status messages into the Electric messages window. The user selects how verbose NCC is using the howMuchStatus option.

Parameters:
msg - the message to be printed.

flush

public void flush()
Flush System.out


error

public void error(boolean pred,
                  java.lang.String msg)
Print a message and abort execution if pred is true.

Parameters:
pred - if true then an error has occurred
msg - message to print when error occurs

error

public void error(java.lang.String msg)
Print a message and abort execution

Parameters:
msg - message to print when error occurs

getOptions

public NccOptions getOptions()
Get the NCC options.

Specified by:
getOptions in interface NccGlobalsReportable

getRandom

public int getRandom()
Generate non-recurring pseudo-random integers


getPartLeafEquivRecs

public LeafEquivRecords getPartLeafEquivRecs()
Get the leaf equivalence records of the Part equivalence record sub tree


getWireLeafEquivRecs

public LeafEquivRecords getWireLeafEquivRecs()
Get the leaf equivalence records of the Wire equivalence record sub tree


getPortLeafEquivRecs

public LeafEquivRecords getPortLeafEquivRecs()
Get the leaf equivalence records of the Port equivalence record sub tree


getEquivalentNets

public HierarchyEnumerator.NetNameProxy[][] getEquivalentNets()
Specified by:
getEquivalentNets in interface NccGlobalsReportable
Returns:
an NetNameProxy[][]. NetNameProxy[d][n] gives the nth net of the dth design. NetNameProxy[a][n] is NCC equivalent to NetNameProxy[b][n] for all a and b.

getEquivalentNodes

public HierarchyEnumerator.NodableNameProxy[][] getEquivalentNodes()
Specified by:
getEquivalentNodes in interface NccGlobalsReportable
Returns:
an NodableNameProxy[][]. NodableNameProxy[d][n] gives the nth net of the dth design. NetNameProxy[a][n] is NCC equivalent to NetNameProxy[b][n] for all a and b.

getNccGuiInfo

public NccGuiInfo getNccGuiInfo()
Get mismatches to be displayed in the GUI

Specified by:
getNccGuiInfo in interface NccGlobalsReportable
Returns:
an object with mismatches to be displayed in GUI

cantBuildNetlist

public boolean cantBuildNetlist()
Returns:
true if some netlist can't be built

cantBuildNetlistBits

public boolean[] cantBuildNetlistBits()
Specified by:
cantBuildNetlistBits in interface NccGlobalsReportable
Returns:
true if ith netlist can't be built

getPartCounts

public int[] getPartCounts()
Specified by:
getPartCounts in interface NccGlobalsReportable
Returns:
array of Part counts. One array element per Circuit

getWireCounts

public int[] getWireCounts()
Specified by:
getWireCounts in interface NccGlobalsReportable
Returns:
array of Wire counts. One array element per Circuit

getPortCounts

public int[] getPortCounts()
Specified by:
getPortCounts in interface NccGlobalsReportable
Returns:
array of Port counts. One array element per Circuit

userWantsToAbort

public boolean userWantsToAbort()
Returns:
true if user wants to abort

getBenchmarkResults

public BenchmarkResults getBenchmarkResults()
Get result of benchmarking performance counters

Specified by:
getBenchmarkResults in interface NccGlobalsReportable