// Normally, notMatched should contain only leaf EquivRecords. However // partitioning might turn a leaf into an internal node. When that happens // we need to remove that internal node and find the descendents that are // leaves and add them to the appropriate lists. private void processInternalEquivRecords() { List<EquivRecord> newMatched = new ArrayList<EquivRecord>(); List<EquivRecord> newNotMatched = new ArrayList<EquivRecord>(); for (ListIterator<EquivRecord> it = notMatched.listIterator(); it.hasNext(); ) { EquivRecord er = it.next(); if (er.isLeaf()) { Job.error(er.isMatched(), "notMatched list has matched"); } else { // a leaf EquivRecord was partitioned and therefore isn't a // leaf anymore. Find the descendents of this node that are // leaves. it.remove(); new FindLeaves(newMatched, newNotMatched, er, globals); } } matched.addAll(newMatched); notMatched.addAll(newNotMatched); }
/** * @return 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. */ public NodableNameProxy[][] getEquivalentNodes() { int numDes = getNumNetlistsBeingCompared(); NodableNameProxy[][] equivParts = new NodableNameProxy[numDes][]; int numMatched = partLeafRecs.numMatched(); for (int i = 0; i < numDes; i++) { equivParts[i] = new NodableNameProxy[numMatched]; } int partNdx = 0; for (Iterator<EquivRecord> it = partLeafRecs.getMatched(); it.hasNext(); partNdx++) { EquivRecord er = it.next(); int cktNdx = 0; for (Iterator<Circuit> cit = er.getCircuits(); cit.hasNext(); cktNdx++) { Circuit ckt = cit.next(); Job.error(ckt.numNetObjs() != 1, "not matched?"); Part p = (Part) ckt.getNetObjs().next(); equivParts[cktNdx][partNdx] = p.getNameProxy().getNodableNameProxy(); } } return equivParts; }
/** * @return 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. */ public NetNameProxy[][] getEquivalentNets() { int numDes = getNumNetlistsBeingCompared(); NetNameProxy[][] equivNets = new NetNameProxy[numDes][]; int numMatched = wireLeafRecs.numMatched(); for (int i = 0; i < numDes; i++) { equivNets[i] = new NetNameProxy[numMatched]; } int wireNdx = 0; for (Iterator<EquivRecord> it = wireLeafRecs.getMatched(); it.hasNext(); wireNdx++) { EquivRecord er = it.next(); int cktNdx = 0; for (Iterator<Circuit> cit = er.getCircuits(); cit.hasNext(); cktNdx++) { Circuit ckt = cit.next(); Job.error(ckt.numNetObjs() != 1, "not matched?"); Wire w = (Wire) ckt.getNetObjs().next(); equivNets[cktNdx][wireNdx] = w.getNameProxy().getNetNameProxy(); } } return equivNets; }
/** * Print a message and abort execution * * @param msg message to print when error occurs */ public void error(String msg) { Job.error(true, msg); }
/** * Print a message and abort execution if pred is true. * * @param pred if true then an error has occurred * @param msg message to print when error occurs */ public void error(boolean pred, String msg) { Job.error(pred, msg); }