private Global globalInst(ImmutableNodeInst n) {
   if (!(n.protoId instanceof PrimitiveNodeId)) {
     return null;
   }
   PrimitiveNode pn = techPool.getPrimitiveNode((PrimitiveNodeId) n.protoId);
   if (pn == Schematics.tech().groundNode) {
     return Global.ground;
   }
   if (pn == Schematics.tech().powerNode) {
     return Global.power;
   }
   if (pn == Schematics.tech().globalNode) {
     String globalName = n.getVarValue(Schematics.SCHEM_GLOBAL_NAME, String.class);
     if (globalName != null) {
       return Global.newGlobal(globalName);
     }
   }
   return null;
 }
  void calcDrawnWidths() {
    Arrays.fill(drawnNames, null);
    Arrays.fill(drawnWidths, -1);

    for (int i = 0; i < numExports; i++) {
      int drawn = drawns[i];
      Name name = exports.get(i).name;
      int newWidth = name.busWidth();
      int oldWidth = drawnWidths[drawn];
      if (oldWidth < 0) {
        drawnNames[drawn] = name;
        drawnWidths[drawn] = newWidth;
        continue;
      }
      if (oldWidth != newWidth) {
        reportDrawnWidthError(
            /*cell.getPort(i), null,*/ drawnNames[drawn].toString(), name.toString());
        if (oldWidth < newWidth) {
          drawnNames[drawn] = name;
          drawnWidths[drawn] = newWidth;
        }
      }
    }
    for (int arcIndex = 0; arcIndex < numArcs; arcIndex++) {
      ImmutableArcInst a = arcs.get(arcIndex);
      int drawn = drawns[arcsOffset + arcIndex];
      if (drawn < 0) {
        continue;
      }
      Name name = a.name;
      if (name.isTempname()) {
        continue;
      }
      int newWidth = name.busWidth();
      int oldWidth = drawnWidths[drawn];
      if (oldWidth < 0) {
        drawnNames[drawn] = name;
        drawnWidths[drawn] = newWidth;
        continue;
      }
      if (oldWidth != newWidth) {
        reportDrawnWidthError(/*null, ai,*/ drawnNames[drawn].toString(), name.toString());
        if (oldWidth < newWidth) {
          drawnNames[drawn] = name;
          drawnWidths[drawn] = newWidth;
        }
      }
    }
    for (int arcIndex = 0; arcIndex < numArcs; arcIndex++) {
      int drawn = drawns[arcsOffset + arcIndex];
      if (drawn < 0) {
        continue;
      }
      ImmutableArcInst a = arcs.get(arcIndex);
      Name name = a.name;
      if (!name.isTempname()) {
        continue;
      }
      int oldWidth = drawnWidths[drawn];
      if (oldWidth < 0) {
        drawnNames[drawn] = name;
        if (a.protoId != busArc.getId()) {
          drawnWidths[drawn] = 1;
        }
      }
    }
    for (int i = 0; i < numNodes; i++) {
      ImmutableNodeInst n = nodes.get(i);
      //            NodeProto np = ni.getProto();
      if (n.protoId instanceof PrimitiveNodeId) {
        PrimitiveNode pn = techPool.getPrimitiveNode((PrimitiveNodeId) n.protoId);
        if (pn.getFunction().isPin()) {
          continue;
        }
        if (pn == Schematics.tech().offpageNode) {
          continue;
        }
      }
      int numPortInsts = getNumPorts(n.protoId);
      for (int j = 0; j < numPortInsts; j++) {
        PortInst pi = new PortInst(n.nodeId, getPortIdByIndex(n.protoId, j));
        int drawn = drawns[pi.getPortInstOffset()];
        if (drawn < 0) {
          continue;
        }
        int oldWidth = drawnWidths[drawn];
        int newWidth = 1;
        if (n.protoId instanceof CellId) {
          CellBackup subCell = snapshot.getCell((CellId) n.protoId);
          CellId subCellId = subCell.cellRevision.d.cellId;
          if (subCellId.isIcon() || subCellId.isSchematic()) {
            int arraySize = subCellId.isIcon() ? n.name.busWidth() : 1;
            int portWidth = subCell.cellRevision.exports.get(j).name.busWidth();
            if (oldWidth == portWidth) {
              continue;
            }
            newWidth = arraySize * portWidth;
          }
        }
        if (oldWidth < 0) {
          drawnWidths[drawn] = newWidth;
          continue;
        }
        if (oldWidth != newWidth) {
          String msg =
              "Network: Schematic "
                  + cellId
                  + " has net <"
                  + drawnNames[drawn]
                  + "> with width conflict in connection "
                  + pi.n.name
                  + " "
                  + pi.portId;
          System.out.println(msg);
          //                    networkManager.pushHighlight(pi);
          //                    networkManager.logError(msg, NetworkTool.errorSortNetworks);
        }
      }
    }
    for (int i = 0; i < drawnWidths.length; i++) {
      if (drawnWidths[i] < 1) {
        drawnWidths[i] = 1;
      }
      if (DEBUG) {
        System.out.println(
            "Drawn "
                + i
                + " "
                + (drawnNames[i] != null ? drawnNames[i].toString() : "")
                + " has width "
                + drawnWidths[i]);
      }
    }
  }