コード例 #1
0
ファイル: Exec.java プロジェクト: imr/Electric8
    public void run() {
      if (Thread.currentThread() == this) {
        //                    Environment.setThreadEnvironment(launcherEnvironment);
        Job.setUserInterface(userInterface);
      }
      try {
        PrintWriter pw = null;
        if (redirect != null) pw = new PrintWriter(redirect);

        // read from stream
        InputStreamReader input = new InputStreamReader(in);
        BufferedReader reader = new BufferedReader(input);
        int read = 0;
        while ((read = reader.read(buf)) >= 0) {
          if (pw != null) {
            pw.write(buf, 0, read);
            pw.flush();
          }
        }

        reader.close();
        input.close();

      } catch (java.io.IOException e) {
        ActivityLogger.logException(e);
      }
    }
コード例 #2
0
ファイル: RiverTest.java プロジェクト: imr/Electric-VLSI
  /*
   * (non-Javadoc)
   *
   * @see com.sun.electric.tool.routing.AbstractRoutingBaseClass#testRouter()
   */
  @Override
  public void testRouter() throws Exception {
    Cell cell = this.loadCell("placementTests", "PlacementTest4");
    TstUserInterface testUI = (TstUserInterface) Job.getUserInterface();
    testUI.setCurrentCell(cell);

    River router = new River();
    List<ArcInst> allArcs = new ArrayList<ArcInst>();
    for (Iterator<ArcInst> it = cell.getArcs(); it.hasNext(); ) allArcs.add(it.next());
    router.river(cell, allArcs);
  }
コード例 #3
0
ファイル: AddRemove.java プロジェクト: imr/Electric-VLSI
 public void terminateOK() {
   if (exitVal != 0) {
     Job.getUserInterface()
         .showErrorMessage(
             "CVS "
                 + (add ? "Add" : "Remove")
                 + " Failed!  Please see messages window (exit status "
                 + exitVal
                 + ")",
             "CVS " + (add ? "Add" : "Remove") + " Failed!");
   }
 }
コード例 #4
0
ファイル: RoutingTab.java プロジェクト: imr/Electric8
 /**
  * Method called when either of the parallel sea-of-gate checkboxes changes. Checks this against
  * the number of processors and warns if not possible.
  */
 private void sogParallelChanged() {
   int numberOfProcessors = Runtime.getRuntime().availableProcessors();
   boolean twoPerRoute = sogParallelDij.isSelected();
   boolean parallelRouting = sogParallel.isSelected();
   if ((twoPerRoute || parallelRouting) && numberOfProcessors == 1 && !oneProcessorWarning) {
     oneProcessorWarning = true;
     Job.getUserInterface()
         .showInformationMessage(
             "This computer has only one processor and cannot do parallel routing.",
             "Not Enough Processors");
     return;
   }
   if ((twoPerRoute && parallelRouting) && numberOfProcessors == 2 && !twoProcessorWarning) {
     twoProcessorWarning = true;
     Job.getUserInterface()
         .showInformationMessage(
             "This computer has only two processors and so it can do either\n"
                 + "   'two processors per route' or 'multiple routes in parallel' but not both.\n"
                 + "It is recommended that two-processor machines use 'two processors per route'.",
             "Not Enough Processors");
     return;
   }
 }
コード例 #5
0
ファイル: LeafEquivRecords.java プロジェクト: imr/Electric8
 // 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);
 }
コード例 #6
0
ファイル: NccGlobals.java プロジェクト: imr/Electric8
 /**
  * @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;
 }
コード例 #7
0
ファイル: NccGlobals.java プロジェクト: imr/Electric8
 /**
  * @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;
 }
コード例 #8
0
ファイル: Exec.java プロジェクト: imr/Electric8
  public void run() {
    if (Thread.currentThread() == this) {
      Environment.setThreadEnvironment(launcherEnvironment);
      Job.setUserInterface(userInterface);
    }
    if (outStreamRedir instanceof OutputStreamChecker) {
      ((OutputStreamChecker) outStreamRedir).setExec(this);
    }
    if (errStreamRedir instanceof OutputStreamChecker) {
      ((OutputStreamChecker) errStreamRedir).setExec(this);
    }

    try {
      Runtime rt = Runtime.getRuntime();

      ExecProcessReader outReader = null;
      ExecProcessReader errReader = null;

      // run program
      synchronized (this) {
        try {
          if (command != null) p = rt.exec(command, envVars, dir);
          else p = rt.exec(exec, envVars, dir);
        } catch (IOException e) {
          System.out.println("Error running " + command + ": " + e.getMessage());
          return;
        }

        // eat output (stdout) and stderr from program so it doesn't block
        outReader = new ExecProcessReader(p.getInputStream(), outStreamRedir);
        errReader = new ExecProcessReader(p.getErrorStream(), errStreamRedir);
        outReader.start();
        errReader.start();

        // attach to input of process
        processWriter = new PrintWriter(p.getOutputStream());
      }

      // wait for exit status
      exitVal = p.waitFor();

      // also wait for redir threads to die, if doing redir
      if (outStreamRedir != null) outReader.join();
      if (errStreamRedir != null) errReader.join();

      StringBuffer com = new StringBuffer();
      if (command != null) com.append(command);
      else {
        for (int i = 0; i < exec.length; i++) com.append(exec[i] + " ");
      }

      // System.out.println("Process finished [exit: "+exitVal+"]: "+com.toString());
      synchronized (finishedListeners) {
        FinishedEvent e = new FinishedEvent(this, com.toString(), dir, exitVal);
        ArrayList<FinishedListener> copy = new ArrayList<FinishedListener>();
        // make copy cause listeners may want to remove themselves if process finished
        for (FinishedListener l : finishedListeners) {
          copy.add(l);
        }
        for (FinishedListener l : copy) {
          l.processFinished(e);
        }
      }

      synchronized (this) {
        if (processWriter != null) {
          processWriter.close();
          processWriter = null;
        }
      }

    } catch (Exception e) {
      ActivityLogger.logException(e);
    }
  }
コード例 #9
0
ファイル: NccGlobals.java プロジェクト: imr/Electric8
 /**
  * Print a message and abort execution
  *
  * @param msg message to print when error occurs
  */
 public void error(String msg) {
   Job.error(true, msg);
 }
コード例 #10
0
ファイル: NccGlobals.java プロジェクト: imr/Electric8
 /**
  * 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);
 }
コード例 #11
0
ファイル: AddRemove.java プロジェクト: imr/Electric-VLSI
  /**
   * Add or Remove libs and cells from CVS.
   *
   * @param libs
   * @param cells
   * @param add true to add to cvs, false to remove from cvs
   * @param undo true to undo add/remove (boolean add ignored in this case).
   */
  public static void addremove(List<Library> libs, List<Cell> cells, boolean add, boolean undo) {
    if (libs == null) libs = new ArrayList<Library>();
    if (cells == null) cells = new ArrayList<Cell>();

    // make sure cells are part of a DELIB
    CVSLibrary.LibsCells bad = CVSLibrary.notFromDELIB(cells);
    if (bad.cells.size() > 0) {
      CVS.showError(
          "Error: the following Cells are not part of a DELIB library and cannot be acted upon individually",
          "CVS Add/Remove Error",
          bad.libs,
          bad.cells);
      return;
    }
    bad = CVSLibrary.getModified(libs, cells);
    if (bad.libs.size() > 0 || bad.cells.size() > 0) {
      CVS.showError(
          "Error: the following Libraries or Cells must be saved first",
          "CVS " + (add ? "Add" : "Remove") + " Error",
          bad.libs,
          bad.cells);
      return;
    }

    // delib cells must have library added first
    List<Library> assertLibsInCVS = new ArrayList<Library>();
    for (Cell cell : cells) {
      Library lib = cell.getLibrary();
      if (libs.contains(lib) || assertLibsInCVS.contains(lib)) continue;
      assertLibsInCVS.add(lib);
    }
    bad = CVSLibrary.getNotInCVS(assertLibsInCVS, null);
    if (bad.libs.size() > 0) {
      CVS.showError(
          "Error: cannot add DELIB cells if cell's DELIB library is not in cvs",
          "CVS " + (add ? "Add" : "Remove") + " Error",
          bad.libs,
          bad.cells);
      return;
    }

    // optimize a little, remove cells from cells list if cell's lib in libs list
    CVSLibrary.LibsCells good = CVSLibrary.consolidate(libs, cells);

    if (!undo) {
      // when job generates files to add/remove, it will do the check to see if they are in
      // cvs or not. Don't do it here because we may specify lib to add unadded cells.
      /*
                  if (add) {
                      good = CVSLibrary.getNotInCVS(libs, cells);
                  } else {
                      good = CVSLibrary.getInCVS(libs, cells);
                  }
      */
      // issue final warning for Remove
      if (!add) {
        StringBuffer list =
            new StringBuffer(
                "Warning! CVS Remove will delete disk files for these Libraries and Cells!!!");
        for (Library lib : good.libs) list.append("\n  " + lib.getName());
        for (Cell cell : good.cells) list.append("\n  " + cell.libDescribe());
        if (!Job.getUserInterface().confirmMessage(list.toString())) return;
      }

      (new AddRemoveJob(good.libs, good.cells, add)).startJob();
    } else {
      (new UndoAddRemoveJob(good.libs, good.cells)).startJob();
    }
  }