Esempio n. 1
0
 private static String getUnitScale(double d) {
   String s = TextUtils.formatDoublePostFix(d);
   for (int i = 0; i < s.length(); i++) {
     char c = s.charAt(i);
     if (Character.isLetter(c)) return String.valueOf(c);
   }
   return "";
 }
Esempio n. 2
0
  /** Method to parse the arc cell in "np" and return an ArcInfo object that describes it. */
  static ArcInfo parseCell(Cell np) {
    // create and initialize the GRAPHICS structure
    ArcInfo aIn = new ArcInfo();
    aIn.name = np.getName().substring(4);

    // look at all nodes in the arc description cell
    for (Iterator<NodeInst> it = np.getNodes(); it.hasNext(); ) {
      NodeInst ni = it.next();
      Variable var = ni.getVar(OPTION_KEY);
      if (var == null) continue;
      String str = getValueOnNode(ni);

      switch (((Integer) var.getObject()).intValue()) {
        case ARCFUNCTION:
          aIn.func = ArcProto.Function.UNKNOWN;
          List<ArcProto.Function> allFuncs = ArcProto.Function.getFunctions();
          for (ArcProto.Function fun : allFuncs) {
            if (fun.toString().equalsIgnoreCase(str)) {
              aIn.func = fun;
              break;
            }
          }
          break;
        case ARCINC:
          aIn.angInc = TextUtils.atoi(str);
          break;
        case ARCFIXANG:
          aIn.fixAng = str.equalsIgnoreCase("yes");
          break;
        case ARCWIPESPINS:
          aIn.wipes = str.equalsIgnoreCase("yes");
          break;
        case ARCNOEXTEND:
          aIn.noExtend = str.equalsIgnoreCase("no");
          break;
        case ARCANTENNARATIO:
          aIn.antennaRatio = TextUtils.atof(str);
          break;
        case ARCWIDTHOFFSET:
          aIn.widthOffset = TextUtils.atof(str);
          break;
      }
    }
    return aIn;
  }
Esempio n. 3
0
 private void threeDValuesChanged(boolean set) {
   if (!set) initial3DTextChanging = true;
   else if (initial3DTextChanging) return;
   String layerName = (String) threeDLayerList.getSelectedValue();
   Layer layer = curTech.findLayer(layerName);
   if (layer == null) return;
   GenMath.MutableDouble thickness = threeDThicknessMap.get(layer);
   GenMath.MutableDouble height = threeDDistanceMap.get(layer);
   if (set) {
     thickness.setValue(TextUtils.atofDistance(threeDThickness.getText()));
     height.setValue(TextUtils.atofDistance(threeDHeight.getText()));
   } else {
     threeDHeight.setText(TextUtils.formatDistance(height.doubleValue()));
     threeDThickness.setText(TextUtils.formatDistance(thickness.doubleValue()));
   }
   if (!set) initial3DTextChanging = false;
   threeDSideView.repaint();
 }
Esempio n. 4
0
 /**
  * Method to get the transparent color information from a NodeInst.
  *
  * @param ni the NodeInst to examine.
  * @return an array of Color values. Returns null if no such data exists on the NodeInst.
  */
 public static Color[] getTransparentColors(NodeInst ni) {
   int opt = Manipulate.getOptionOnNode(ni);
   if (opt != TECHTRANSPCOLORS) return null;
   Variable var = ni.getVar(TRANSLAYER_KEY);
   String transparentColorsStr = (String) var.getObject();
   int colon = transparentColorsStr.indexOf(':');
   if (colon >= 0) transparentColorsStr = transparentColorsStr.substring(colon + 1);
   if (var == null) return null;
   Color[] colors = TextUtils.getTransparentColors(transparentColorsStr);
   return colors;
 }
Esempio n. 5
0
 public void mouseDragged(MouseEvent evt) {
   Dimension dim = getSize();
   String layerName = (String) dialog.threeDLayerList.getSelectedValue();
   Layer layer = dialog.curTech.findLayer(layerName);
   GenMath.MutableDouble height = threeDDistanceMap.get(layer);
   double newHeight =
       (double) (dim.height - evt.getY()) / dim.height * (highHeight - lowHeight) + lowHeight;
   if (height.doubleValue() != newHeight) {
     height.setValue(newHeight);
     dialog.threeDHeight.setText(TextUtils.formatDistance(newHeight));
     repaint();
   }
 }
Esempio n. 6
0
  /**
   * Method called at the start of the dialog. Caches current values and displays them in the
   * Routing tab.
   */
  public void init() {
    // initilze for the stitcher that is running
    boolean initRoutMimicOn = Routing.isMimicStitchOn();
    boolean initRoutAutoOn = Routing.isAutoStitchOn();
    if (!initRoutMimicOn && !initRoutAutoOn) routNoStitcher.setSelected(true);
    else {
      if (initRoutMimicOn) routMimicStitcher.setSelected(true);
      else routAutoStitcher.setSelected(true);
    }

    // initialize the "default arc" setting
    for (Iterator<Technology> tIt = Technology.getTechnologies(); tIt.hasNext(); ) {
      Technology tech = tIt.next();
      routTechnology.addItem(tech.getTechName());
      sogRouteTechnology.addItem(tech.getTechName());
    }
    routTechnology.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            techChanged();
          }
        });

    // the sea-of-gates section
    sogFavorChecks = new HashMap<ArcProto, JCheckBox>();
    sogProhibitChecks = new HashMap<ArcProto, JCheckBox>();
    sogArcList = new JPanel();
    sogRouteArcOptions.setViewportView(sogArcList);
    sogRouteTechnology.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            sogTechChanged();
          }
        });
    sogRouteTechnology.setSelectedItem(Technology.getCurrent().getTechName());
    sogMaxArcWidth.setText(TextUtils.formatDistance(Routing.getSeaOfGatesMaxWidth()));
    sogComplexityLimit.setText(Integer.toString(Routing.getSeaOfGatesComplexityLimit()));
    sogParallel.setSelected(Routing.isSeaOfGatesUseParallelRoutes());
    sogParallel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            sogParallelChanged();
          }
        });
    sogParallelDij.setSelected(Routing.isSeaOfGatesUseParallelFromToRoutes());
    sogParallelDij.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            sogParallelChanged();
          }
        });

    routTechnology.setSelectedItem(Technology.getCurrent().getTechName());
    routOverrideArc.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            overrideChanged();
          }
        });
    String prefArcName = Routing.getPreferredRoutingArc();
    initRoutDefArc = null;
    if (prefArcName.length() > 0) {
      initRoutDefArc = ArcProto.findArcProto(prefArcName);
      routOverrideArc.setSelected(true);
    } else {
      routOverrideArc.setSelected(false);
    }
    overrideChanged();
    if (initRoutDefArc != null) {
      routTechnology.setSelectedItem(initRoutDefArc.getTechnology().getTechName());
      routDefaultArc.setSelectedItem(initRoutDefArc.getName());
    }

    // auot routing section
    routAutoCreateExports.setSelected(Routing.isAutoStitchCreateExports());

    // mimic routing section
    routMimicPortsMustMatch.setSelected(Routing.isMimicStitchMatchPorts());
    routMimicPortsWidthMustMatch.setSelected(Routing.isMimicStitchMatchPortWidth());
    routMimicNumArcsMustMatch.setSelected(Routing.isMimicStitchMatchNumArcs());
    routMimicNodeSizesMustMatch.setSelected(Routing.isMimicStitchMatchNodeSize());
    routMimicNodeTypesMustMatch.setSelected(Routing.isMimicStitchMatchNodeType());
    routMimicNoOtherArcs.setSelected(Routing.isMimicStitchNoOtherArcsSameDir());
    routMimicOnlyNewTopology.setSelected(Routing.isMimicStitchOnlyNewTopology());
    routMimicInteractive.setSelected(Routing.isMimicStitchInteractive());
    routMimicKeepPins.setSelected(Routing.isMimicStitchPinsKept());
  }
Esempio n. 7
0
  /** Method called when the "OK" panel is hit. Updates any changed fields in the Routing tab. */
  public void term() {
    boolean curMimic = routMimicStitcher.isSelected();
    if (curMimic != Routing.isMimicStitchOn()) {
      Routing.setMimicStitchOn(curMimic);
      MenuCommands.menuBar().updateAllButtons();
    }
    boolean curAuto = routAutoStitcher.isSelected();
    if (curAuto != Routing.isAutoStitchOn()) {
      Routing.setAutoStitchOn(curAuto);
      MenuCommands.menuBar().updateAllButtons();
    }

    // pick up sea-of-gates preferences
    for (Iterator<ArcProto> it = sogFavorChecks.keySet().iterator(); it.hasNext(); ) {
      ArcProto ap = it.next();
      JCheckBox check = sogFavorChecks.get(ap);
      if (check.isSelected() != Routing.isSeaOfGatesFavor(ap))
        Routing.setSeaOfGatesFavor(ap, check.isSelected());
    }
    for (Iterator<ArcProto> it = sogProhibitChecks.keySet().iterator(); it.hasNext(); ) {
      ArcProto ap = it.next();
      JCheckBox check = sogProhibitChecks.get(ap);
      if (check.isSelected() != Routing.isSeaOfGatesPrevent(ap))
        Routing.setSeaOfGatesPrevent(ap, check.isSelected());
    }
    double curSOGMaxWid = TextUtils.atofDistance(sogMaxArcWidth.getText());
    if (curSOGMaxWid != Routing.getSeaOfGatesMaxWidth())
      Routing.setSeaOfGatesMaxWidth(curSOGMaxWid);
    int curSOGComplexity = TextUtils.atoi(sogComplexityLimit.getText());
    if (curSOGComplexity != Routing.getSeaOfGatesComplexityLimit())
      Routing.setSeaOfGatesComplexityLimit(curSOGComplexity);

    boolean curSOGParallel = sogParallel.isSelected();
    if (curSOGParallel != Routing.isSeaOfGatesUseParallelRoutes())
      Routing.setSeaOfGatesUseParallelRoutes(curSOGParallel);
    curSOGParallel = sogParallelDij.isSelected();
    if (curSOGParallel != Routing.isSeaOfGatesUseParallelFromToRoutes())
      Routing.setSeaOfGatesUseParallelFromToRoutes(curSOGParallel);

    ArcProto ap = null;
    if (routOverrideArc.isSelected()) {
      String techName = (String) routTechnology.getSelectedItem();
      Technology tech = Technology.findTechnology(techName);
      if (tech != null) {
        String curArcName = (String) routDefaultArc.getSelectedItem();
        ap = tech.findArcProto(curArcName);
      }
    }
    if (ap != initRoutDefArc) {
      String newArcName = "";
      if (ap != null) newArcName = ap.getTechnology().getTechName() + ":" + ap.getName();
      Routing.setPreferredRoutingArc(newArcName);
    }

    boolean cur = routMimicPortsMustMatch.isSelected();
    if (cur != Routing.isMimicStitchMatchPorts()) Routing.setMimicStitchMatchPorts(cur);

    cur = routMimicPortsWidthMustMatch.isSelected();
    if (cur != Routing.isMimicStitchMatchPortWidth()) Routing.setMimicStitchMatchPortWidth(cur);

    cur = routMimicNumArcsMustMatch.isSelected();
    if (cur != Routing.isMimicStitchMatchNumArcs()) Routing.setMimicStitchMatchNumArcs(cur);

    cur = routMimicNodeSizesMustMatch.isSelected();
    if (cur != Routing.isMimicStitchMatchNodeSize()) Routing.setMimicStitchMatchNodeSize(cur);

    cur = routMimicNodeTypesMustMatch.isSelected();
    if (cur != Routing.isMimicStitchMatchNodeType()) Routing.setMimicStitchMatchNodeType(cur);

    cur = routMimicNoOtherArcs.isSelected();
    if (cur != Routing.isMimicStitchNoOtherArcsSameDir())
      Routing.setMimicStitchNoOtherArcsSameDir(cur);

    cur = routMimicOnlyNewTopology.isSelected();
    if (cur != Routing.isMimicStitchOnlyNewTopology()) Routing.setMimicStitchOnlyNewTopology(cur);

    cur = routMimicInteractive.isSelected();
    if (cur != Routing.isMimicStitchInteractive()) Routing.setMimicStitchInteractive(cur);

    cur = routMimicKeepPins.isSelected();
    if (cur != Routing.isMimicStitchPinsKept()) Routing.setMimicStitchPinsKept(cur);

    cur = routAutoCreateExports.isSelected();
    if (cur != Routing.isAutoStitchCreateExports()) Routing.setAutoStitchCreateExports(cur);
  }