Package edu.byu.ece.rapidSmith.router

Examples of edu.byu.ece.rapidSmith.router.Node


    // Checking for duplicate PIP sinks
    HashMap<Node,Net> pipSinks = new HashMap<Node, Net>();
    MessageGenerator.printHeader("CHECKING FOR DUPLICATE PIP SINKS ... ");
    for(Net net : design.getNets()){
      for(PIP pip : net.getPIPs()){
        Node n = new Node(pip.getTile(), pip.getEndWire(), null, 0);
        Net tmp = pipSinks.get(n);
        if(tmp == null){
          pipSinks.put(n, net);
        }
        else{
          System.out.print("  Duplicate PIP Sink: " + n.toString(design.getWireEnumerator()));
          System.out.println("  in nets: ");
          System.out.println("           " + net.getName());
          System.out.println("           " + tmp.getName());
        }
      }
View Full Code Here


     
      if(scene.tileXMap.get(p.getTile()) != null && scene.tileYMap.get(p.getTile()) != null){
        conns.add(new Connection(p));
      }
     
      Node start = new Node(p.getTile(), p.getStartWire(), null, 0);
      Node end = new Node(p.getTile(), p.getEndWire(), null, 0);
      nodeMap.put(start, start);
      nodeMap.put(end, end);
    }
    Node tmp = new Node();
    Node tmp2 = new Node();
    Node tmp3 = new Node();
    for(PIP p : net.getPIPs()){
      tmp.setTileAndWire(p.getTile(), p.getEndWire());
      //System.out.println("  " + tmp.toString(scene.getWireEnumerator()));
      if(tmp.getConnections() == null) continue;
      for(WireConnection w : tmp.getConnections()){
        tmp2.setTileAndWire(w.getTile(tmp.getTile()), w.getWire());
        //System.out.println("    " + tmp2.toString(scene.getWireEnumerator()));
        if(!tmp2.getTile().equals(tmp.getTile()) && tmp2.getConnections() != null){
          for(WireConnection w2 : tmp2.getConnections()){
            tmp3.setTileAndWire(w2.getTile(tmp2.getTile()), w2.getWire());
            //System.out.println("      " + tmp3.toString(scene.getWireEnumerator()));
            if(nodeMap.get(tmp3) != null){
              if(scene.tileXMap.get(tmp.getTile()) != null && scene.tileYMap.get(tmp2.getTile()) != null){
                Connection conn = new Connection(tmp.getTile(), tmp2.getTile(), tmp.getWire(), tmp2.getWire());
                conns.add(conn);
View Full Code Here

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    ArrayList<PIP> path =  new ArrayList<PIP>();
    ArrayList<PIP> pipList = new ArrayList<PIP>();

    Node currNode = null;
    WireConnection currWire;
    WireConnection[] wiresList = null;
    ArrayList<Node> choices;
   
    // This keeps track of all the possible starting points (or sources) that
    // we can use to route this net.
    ArrayList<Node> sources = new ArrayList<Node>();
   
    // Add the original source from the net
    sources.add(new Node(net.getSourceTile(), // Add the tile of the source
      dev.getPrimitiveExternalPin(net.getSource()), // wire on the source
      null, // This is used for retracing the route once it is completed
      0)); // Number of switches needed to reach this point in the route
   
    // In this loop we'll route each sink pin of the net separately
    for(Pin sinkPin : net.getPins()){
      if(sinkPin.isOutPin()) continue; // Don't try to route the source to the source
      boolean start = true;
      boolean finishedRoute = false;
     
      // Here is where we create the current sink that we intend to target in this
      //routing iteration. 
      Node sink = new Node(sinkPin.getTile(), // A node is a specific tile and wire pair
              dev.getPrimitiveExternalPin(sinkPin), // we need the external pin
                                  // name of the primitive pin
                                  // (ex: F1_PINWIRE0 vs. F1)
              null,                  // This is a parent node
              0);                    // This value is used to keep track
                                  // length in hops of the route.
     
      MessageGenerator.printHeader("Current Sink: " + sink.getTile() +
          " " + we.getWireName(sink.getWire()));

      // Almost all routes must pass through a particular switch matrix and wire to arrive
      // at the particular sink.  Here we obtain that information to help us target the routing.
      Node switchMatrixSink = sink.getSwitchBoxSink(dev);
      System.out.println("** Sink must pass through switch matrix: " + switchMatrixSink.getTile() +
          ", wire: " + we.getWireName(switchMatrixSink.getWire())+ " **");
     
      while(!finishedRoute){
        // Here we prompt the user to choose a source to start the route from.  If this
        // is the first tile we are routing in this net there will only be one choice.
        if(start){
          start = false;
          System.out.println("Sources:");
          for(int i=0; i < sources.size(); i++){
            Node src = sources.get(i);
            System.out.println("  " + i+". " + src.getTile() + " " + we.getWireName(src.getWire()));
          }
          System.out.print("Choose a source from the list above: ");
          try {
            choice = Integer.parseInt(br.readLine());
          } catch (Exception e){
            System.out.println("Error, could not get choice, defaulting to 0");
            choice = 0;
          }

          // Once we get the user's choice, we can determine what wires the source
          // can connect to by calling Tile.getWireConnections(int wire)
          currNode = sources.get(choice);
          wiresList = currNode.getTile().getWireConnections(currNode.getWire());
          if(wiresList == null || wiresList.length == 0){
            // We'll have to choose something else, this source had no other connections.
            System.out.println("Wire had no connections");
            continue;
          }
        }
       
        // Print out some information about the sink we are targeting
        if(sink.getTile().getSinks().get(sink.getWire()).switchMatrixSinkWire == -1){
          System.out.println("\n\nSINK: "
            + sink.getTile().getName()
            + " "
            + we.getWireName(sink.getWire())
            + " "
            + net.getName());       
        }
        else{
          System.out.println("\n\nSINK: "
            + sink.getTile().getName()
            + " "
            + we.getWireName(sink.getWire())
            + " "
            + net.getName()
            + " thru("
            + switchMatrixSink.getTile() + " "
            + we.getWireName(sink.getTile().getSinks().get(sink.getWire()).switchMatrixSinkWire) + ")");
        }
       
        // Print out a part of the corresponding PIP that we have chosen
        System.out.println("  pip " + currNode.getTile().getName() + " "
            + we.getWireName(currNode.getWire()) + " -> ");
       
        // Check if we have reached the sink node
        if (sink.getTile().equals(currNode.getTile())
            && sink.getWire() == currNode.getWire()){
          System.out.println("You completed the route!");
          // If we have, let's print out all the PIPs we used
          for (PIP pip : path){
            System.out.print(pip.toString(we));
            pipList.add(pip);
            finishedRoute = true;
          }
        }
        if(!finishedRoute){
          // We didn't find the sink yet, let's print out the set of
          // choices we can follow given our current wire
          choices = new ArrayList<Node>();
          for (int i = 0; i < wiresList.length; i++) {
            currWire = wiresList[i];
            choices.add(new Node(currWire.getTile(currNode.getTile()),
                currWire.getWire(), currNode, currNode.getLevel() + 1));

            System.out.println("    " + i + ". "
                + currWire.getTile(currNode.getTile()).getName()
                + " " + we.getWireName(currWire.getWire()) + " "
View Full Code Here

        queue.add(wc.createNode(t));
      }
    }
   
    while(!queue.isEmpty()){
      Node currNode = queue.poll();
      Integer i = reachabilityMap.get(currNode.getTile());
      if(i == null){
        i = new Integer(1);
        reachabilityMap.put(currNode.getTile(), i);
      }
      else{
        reachabilityMap.put(currNode.getTile(), i+1);           
      }
      if(currNode.getLevel() < hops-1){
        WireConnection[] connections = currNode.getConnections();
        if(connections != null){
          for(WireConnection wc : connections){
            queue.add(wc.createNode(currNode));
          }
        }
View Full Code Here

   * field is null and level is zero.
   */
  public Node getNodeFromPin(Pin pin){
    Integer wire = getPrimitiveExternalPin(pin);
    if(wire == null) return null;
    return new Node(pin.getTile(), wire, null, 0);
  }
View Full Code Here

   * field is null and level is zero.
   */
  public Node getNodeFromPin(Pin pin, Node parent, int level){
    Integer wire = getPrimitiveExternalPin(pin);
    if(wire == null) return null;
    return new Node(pin.getTile(), wire, parent, level);
  }
View Full Code Here

    SinkPin sp = tile.getSinks().get(extPin);
    if(sp == null) return null;
    int y = sp.switchMatrixTileOffset;
    int x = y >> 16;
    y = (y << 16) >> 16;
    Node n = new Node(getTile(tile.getRow()+y, tile.getColumn()+x),sp.switchMatrixSinkWire,null,0);
    return n;
  }
View Full Code Here

                    watchDog++;
                    Tile t1 = tileStack.pop();
                    WireConnection w1 = wireStack.pop();
                    if(debug) System.out.println("  POP: " + t1 + " " + we.getWireName(w1.getWire()));
                    WireConnection[] connections = t1.getWireHashMap().get(w1.getWire());
                    if(connections == null || visited.contains(new Node(t1,w1.getWire(),null,0))){
                      continue;
                    }
                    for (WireConnection wire2 : connections) {
                      if(setOfExternalPrimitivePins.contains(wire2.getWire())){
                        SinkPin found = wire2.getTile(t1).getSinks().get(wire2.getWire());
                        int xOffset = (tile.getColumn() - wire2.getTile(t1).getColumn());
                        int yOffset = (tile.getRow() - wire2.getTile(t1).getRow());
                       
                        if(found == null){
                          /*System.out.println("Null Sink: " + wire2.getTile(this, t1) + " " + we.getWireName(wire2.getWire()));
                          for(Integer sink : wire2.getTile(this, t1).getSinks().keySet()){
                            System.out.println("  " + we.getWireName(sink));
                          }
                          System.out.println("SOURCES: ");
                          for(Integer source : wire2.getTile(this, t1).getSources()){
                            System.out.println("  " + we.getWireName(source));
                          }*/
                          continue;
                        }
                       
                        found.switchMatrixSinkWire = currINTSinkWire;
                        found.switchMatrixTileOffset = (xOffset << 16) | (yOffset & 0xFFFF);

                        if(debug) System.out.println("  FOUND: " + wire2.getTile(t1) + " " + we.getWireName(wire2.getWire()) +" xOffset="+ xOffset + " yOffset=" + yOffset);
                       
                        if(debug) System.out.println("  SECOND: " + wire2.getTile(t1) + " " + we.getWireName(wire2.getWire()));
                        if(!visited.contains(new Node(t1,w1.getWire(),null,0))) {
                          tileStack.push(wire2.getTile(t1));
                          wireStack.push(wire2);                         
                        }
                      }
                      else if(wire2.getTile(t1) != null && !switchMatrixTileTypes.contains(wire2.getTile(t1).getType())){
                        if(debug) System.out.println("  POTENTIAL: " + wire2.getTile(t1) + " " + we.getWireName(wire2.getWire()));
                        if(!visited.contains(new Node(t1,w1.getWire(),null,0))) {
                          tileStack.push(wire2.getTile(t1));
                          wireStack.push(wire2);                         
                        }                     
                      }
                    }
                    visited.add(new Node(t1,w1.getWire(),null,0));
                  }
                  tileStack.clear();
                  wireStack.clear();
                }
              }
View Full Code Here

  public int getWire() {
    return wire;
  }
 
  public Node createNode(Node srcNode){
    return new Node(getTile(srcNode.getTile()), wire, srcNode, srcNode.getLevel()+1, isPIP);
  }
View Full Code Here

  public Node createNode(Node srcNode){
    return new Node(getTile(srcNode.getTile()), wire, srcNode, srcNode.getLevel()+1, isPIP);
  }
 
  public Node createNode(Tile currTile){
    return new Node(getTile(currTile), wire, null, 0, isPIP);
  }
View Full Code Here

TOP

Related Classes of edu.byu.ece.rapidSmith.router.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.