Example #1
0
  /**
   * Method to return the function of this NodeProto. The Function is a technology-independent
   * description of the behavior of this NodeProto.
   *
   * @return function the function of this NodeProto.
   */
  public PrimitiveNode.Function getFunction(ImmutableNodeInst n) {
    if (n.protoId instanceof CellId) {
      return PrimitiveNode.Function.UNKNOWN;
    }

    PrimitiveNode np = techPool.getPrimitiveNode((PrimitiveNodeId) n.protoId);
    return np.getTechnology().getPrimitiveFunction(np, n.techBits);
  }
Example #2
0
 private void addToDrawn(PortInst pi) {
   assert stack.isEmpty();
   stack.add(pi);
   while (!stack.isEmpty()) {
     pi = stack.remove(stack.size() - 1);
     PortProtoId ppId = pi.portId;
     int numPorts = getNumPorts(ppId.getParentId());
     if (numPorts == 1 || ppId instanceof ExportId) {
       addToDrawn1(pi);
       continue;
     }
     PrimitivePort pp = techPool.getPrimitivePort((PrimitivePortId) ppId);
     PrimitiveNode pn = pp.getParent();
     int topology = pp.getTopology();
     for (int i = 0; i < numPorts; i++) {
       PrimitivePort pp2 = pn.getPort(i);
       if (pp2.getTopology() != topology) {
         continue;
       }
       addToDrawn1(new PortInst(pi.n.nodeId, pp2.getId()));
     }
   }
 }
Example #3
0
  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]);
      }
    }
  }
Example #4
0
 void makeDrawns() {
   Arrays.fill(drawns, -1);
   numDrawns = 0;
   for (int i = 0; i < numExports; i++) {
     if (drawns[i] >= 0) {
       continue;
     }
     drawns[i] = numDrawns;
     ImmutableExport export = exports.get(i);
     addToDrawn(new PortInst(export));
     numDrawns++;
   }
   numExportedDrawns = numDrawns;
   for (int i = 0; i < numArcs; i++) {
     if (drawns[arcsOffset + i] >= 0) {
       continue;
     }
     ImmutableArcInst a = arcs.get(i);
     ArcProto ap = techPool.getArcProto(a.protoId);
     if (ap.getFunction() == ArcProto.Function.NONELEC) {
       continue;
     }
     drawns[arcsOffset + i] = numDrawns;
     if (DEBUG) {
       System.out.println(numDrawns + ": " + a.name);
     }
     PortInst hpi = new PortInst(a, ImmutableArcInst.HEADEND);
     if (hpi.portId != busPinPortId || ap == busArc) {
       addToDrawn(hpi);
     }
     PortInst tpi = new PortInst(a, ImmutableArcInst.TAILEND);
     if (tpi.portId != busPinPortId || ap == busArc) {
       addToDrawn(tpi);
     }
     numDrawns++;
   }
   numConnectedDrawns = numDrawns;
   for (int i = 0; i < numNodes; i++) {
     ImmutableNodeInst n = nodes.get(i);
     if (n.protoId instanceof CellId) {
       if (isIconOfParent(n)) {
         continue;
       }
     } else {
       PrimitiveNode pn = techPool.getPrimitiveNode((PrimitiveNodeId) n.protoId);
       if (pn.getFunction() == PrimitiveNode.Function.ART && pn != Generic.tech().simProbeNode
           || pn == Artwork.tech().pinNode
           || pn == Generic.tech().invisiblePinNode) {
         continue;
       }
     }
     //            NodeProto np = ni.getProto();
     int numPortInsts = getNumPorts(n.protoId);
     for (int j = 0; j < numPortInsts; j++) {
       PortInst pi = new PortInst(n.nodeId, getPortIdByIndex(n.protoId, j));
       int piOffset = pi.getPortInstOffset();
       if (drawns[piOffset] >= 0) {
         continue;
       }
       if (n.protoId instanceof PrimitiveNodeId
           && techPool.getPrimitivePort((PrimitivePortId) pi.portId).isIsolated()) {
         continue;
       }
       addToDrawn(pi);
       numDrawns++;
     }
   }
 }