Package edu.byu.ece.rapidSmith.design

Examples of edu.byu.ece.rapidSmith.design.Pin


            ((LogicPathElement)currElement).setInstance(instance);
            if(instance == null){
              MessageGenerator.briefErrorAndExit("This instance \"" + parts[4] +
              "\" is null.");
            }
            Pin p = instance.getPin(pinName);
            if(p == null){
              //System.out.println("Problem Getting Pin: " + parts[1]);
              //System.out.println("Line: " + line);
              //System.exit(1);
            }
View Full Code Here


   * This is a helper method to convertToHardMacro which iterates through the nets
   * to turn the design into a hard macro
   */
  private void handleNets(){
    // Iterate through all nets to turn design into hard macro
    Pin pin = null;
    for(Net net: design.getNets()){
      ArrayList<Pin> pins = null;
     
      //check for forbidden pips and unroute
      boolean clearPips = false;
      for(PIP p : net.getPIPs()){
        if(forbiddenPips.contains(p.getStartWireName(design.getWireEnumerator()))
            ||forbiddenPips.contains(p.getEndWireName(design.getWireEnumerator()))){
          clearPips = true;
          break;
        }
      }
      if(clearPips){
        net.getPIPs().clear();
      }
     
      if(net.hasAttributes()){
        netsToRemove.add(net);
      }
      else if((pins = isNetConnectedToIOB(net)).size() > 0){
        handleIOBs(net, pins);
      }
      // Handle BUFG
      else if((pin = isNetOutputofBUFG(net)) != null){
       
        //check to see if the BUFG has an IOBSource before removing
        boolean IOBSource = false;
        for(Net n : pin.getInstance().getNetList()){
          if(n.getSource().getInstance().getType().equals(PrimitiveType.IOB)){
            IOBSource = true;
            break;
          }
        }
       
        if(IOBSource){
         
          // Remove BUFG and source pin
          instancesToRemove.add(pin.getInstance());
          net.getPins().remove(pin);
          net.getPIPs().clear();
         
          // Arbitrarily choose an inpin as the new port
          Pin port = net.getPins().get(0);
          String clkname = pin.getInstance().getName();
          String[] parts = clkname.split("_");
          clkname = "";
          for(String p : parts){
            if(p.contains("IBUF") || p.contains("BUFG")){
              break;
            }
            else{
              clkname += p + "_";
            }
          }
          if(clkname.endsWith("_")){
            clkname = clkname.substring(0, clkname.length()-1);
          }
         
          Port newPort = new Port(clkname +"_inport",port);
          hardMacro.getPorts().add(newPort);
          port.setPort(newPort);
         
        }

      }
      // Rip out DCMs/PMV
View Full Code Here

         
          // Create New Net and static SLICE source with Pin connected to static SLICE
          Net newNet = new Net(pin.getInstance().getName() +"_"+ net.getType(), NetType.WIRE);
          Instance inst = createStaticSliceSource(net.getType());
          placeStaticSlice(inst, true);
          Pin newPin = null;
          if(design.getExactFamilyName().contains("virtex4")){
             newPin = new Pin(true,"Y",inst);
          }else if(design.getExactFamilyName().contains("virtex5")){
            //TODO V5
            newPin = new Pin(true,"D",inst);
          }
          newNet.replaceSource(newPin);
          netsToAdd.add(newNet);
          instancesToAdd.add(inst);
          Port newPort = new Port(pin.getInstance().getName()+"_outport",newPin);
          hardMacro.getPorts().add(newPort);
          newPin.setPort(newPort);
        }
      }
    }
    else{ // This is just a single IOB
      // There should only be 1 pin
      Pin pin = pins.get(0);
      // Remove IOB
      if(isTriState(pin.getInstance())){
        failGracefully("Sorry, this design contains tri-state IO.  Tri-state IO is not yet supported by the HMG.");
      }
      instancesToRemove.add(pin.getInstance());
      net.getPins().remove(pin);
      net.getPIPs().clear();
     
      if(pin.isOutPin()){
        // Check if this net drives the BUFG, if so, we don't want to create any ports
        // We'll do that with the output of the BUFG
        for(Pin p : net.getPins()){
          if(p.getInstance().getType().equals(PrimitiveType.BUFG)){
            netsToRemove.add(net);
            return;
          }
        }
        // CASE 1:
        // CASE 2:
        // Now create a port, we just choose an arbitrary one if there are more than one
        Pin p = net.getPins().get(0);
        //XDL_Pin p = pins.get(0); -- This is wrong here because we already removed this pin
        Port newPort = new Port(pin.getInstance().getName()+"_inport",p);
        hardMacro.addPort(newPort);
        p.setPort(newPort);
      }
      else{
        // Check if this is a static net
        if(net.isStaticNet()){
          if(!net.getSource().getInstance().getType().equals(PrimitiveType.TIEOFF)){
            failAndExit("2. This case is unexpected. Talk to Chris about getting it implemented.");
          }
         
          instancesToRemove.add(net.getSource().getInstance());
          netsToRemove.add(net);
         
          // Create New Net and static SLICE source with Pin connected to static SLICE
          Net newNet = new Net(pin.getInstance().getName() + "_" + net.getType(),NetType.WIRE);
          Instance inst = createStaticSliceSource(net.getType());
          placeStaticSlice(inst, true);
          Pin newPin = null;
          if(design.getExactFamilyName().contains("virtex4")){
             newPin = new Pin(true,"Y",inst);
          }else if(design.getExactFamilyName().contains("virtex5")){
            //TODO V5
            newPin = new Pin(true,"D",inst);
          }
          newNet.getPins().add(newPin);
          newNet.replaceSource(newPin);
          netsToAdd.add(newNet);
          instancesToAdd.add(inst);
          Port newPort = new Port(pin.getInstance().getName()+"_outport",newPin);
          hardMacro.getPorts().add(newPort);
          newPin.setPort(newPort);
        }
        else{
         
          // CASE 3:
          // CASE 4:
          Pin p = net.getSource();
          Port newPort = new Port(pin.getInstance().getName()+"_outport",p);
          hardMacro.getPorts().add(newPort);
          p.setPort(newPort);
        }
      }
    }
  }
View Full Code Here

   */
  private void handlePassThruIOBs(Net net, ArrayList<Pin> pins) {
    System.out.println("WARNING: Design contains wires only connected to IOBs, net: " + net.getName());
    System.out.println("         This net has been divided by a LUT. Performance of signal will go down.");
    net.getPIPs().clear();
    Pin inPin = null;
   
    for(Pin pin : pins){
      // For each output IOB, create a new LUT and net
      if(!pin.isOutPin()){
        Net newOutputNet = new Net();
        Instance newLUT = createPassThruSlice();
        placeStaticSlice(newLUT, true);
        instancesToAdd.add(newLUT);
        newOutputNet.setName(net.getName() + "_OUTPUT");
        Pin newLUTPin = null;
        if(design.getExactFamilyName().contains("virtex4")){
           newLUTPin = new Pin(true,"Y",newLUT);
        }else if(design.getExactFamilyName().contains("virtex5")){
          //TODO V5
          newLUTPin = new Pin(true,"D",newLUT);
        }
        newOutputNet.getPins().add(newLUTPin);
        Pin newPin = null;
        if(design.getExactFamilyName().contains("virtex4")){
           newPin = new Pin(false,"G1",newLUT);
        }else if(design.getExactFamilyName().contains("virtex5")){
          //TODO V5
          newPin = new Pin(false,"D1",newLUT);
        }
        net.getPins().add(newPin);
        Port newPort = new Port(pin.getInstance().getName()+"_outport",
            newLUTPin);
        hardMacro.getPorts().add(newPort);
        newLUTPin.setPort(newPort);
      }
      else{
        inPin = pin;
      }
     
      // Remove the IOB instance
      instancesToRemove.add(pin.getInstance());
      net.getPins().remove(pin);
   
    if(net.getPins().size() < 1){
      failAndExit("ERROR: Check net: " + net.getName());
    }
    boolean containsBUFG = false;
    Pin bufgPin = null;
    for(Pin p : net.getPins()){
      if(p.getInstance().getType().equals(PrimitiveType.BUFG)){
        containsBUFG = true;
        bufgPin = p;
      }
View Full Code Here

        }
        else if(token.equals(VCC) || token.equals(POWER)){
          currNet.setType(NetType.VCC);
        }
        else if(token.equals(INPIN)){
          currPin = new Pin();
          currPin.setIsOutputPin(false);
          currNet.addPin(currPin);
          state = ParserState.PIN_INSTANCE_NAME;
          break;
        }
        else if(token.equals(OUTPIN)){
          currPin = new Pin();
          currPin.setIsOutputPin(true);
          if(currNet.getSource() != null){
            MessageGenerator.briefErrorAndExit("XDL Design Parser Error in file: "+ fileName +", The net " +
              currNet.getName() + " has two or more outpins (line " +
              lineNumber + ")");
          }
          currNet.addPin(currPin);
          state = ParserState.PIN_INSTANCE_NAME;
          break;
        }
        else if(token.equals(INOUT)){
          currPin = new Pin();
          currPin.setPinType(PinType.INOUT);
          currNet.addPin(currPin);
          state = ParserState.PIN_INSTANCE_NAME;
          break;
        }
        else{
          expect("wire, vcc or power, gnd or ground or ,",token, ParserState.NET_TYPE);
        }
        state = ParserState.NET_STATEMENT;
        break;
      case NET_STATEMENT:
        if(token.equals(PIP)){
          currPIP = new PIP();
          currNet.addPIP(currPIP);
          state = ParserState.PIP_TILE;
        }
        else if(token.equals(INPIN)){
          currPin = new Pin();
          currPin.setIsOutputPin(false);
          currNet.addPin(currPin);
          state = ParserState.PIN_INSTANCE_NAME;
        }
        else if(token.equals(OUTPIN)){
          currPin = new Pin();
          currPin.setIsOutputPin(true);
          if(currNet.getSource() != null){
            MessageGenerator.briefErrorAndExit("XDL Design Parser Error in file: "+ fileName +", The net " +
              currNet.getName() + " has two or more outpins (line " +
              lineNumber + ")");
          }
          currNet.addPin(currPin);
          state = ParserState.PIN_INSTANCE_NAME;
        }
        else if(token.equals(INOUT)){
          currPin = new Pin();
          currPin.setPinType(PinType.INOUT);
          currNet.addPin(currPin);
          state = ParserState.PIN_INSTANCE_NAME;
          break;
        }
View Full Code Here

  /**
   * This method routes all the connections within a net. 
   * @param i The number of the net (in sequence from the beginning)
   */
  public void routeNet(int i){
    Pin currSource = currNet.getSource();
    ArrayList<Node> sources = new ArrayList<Node>();
    currSources = new HashSet<Node>();
    boolean firstConnection = true;
   
    // Route each pin by itself
    for(Pin currSinkPin : currNet.getPins()){
      // Ignore the source pin
      if (currSinkPin.isOutPin()) continue;

      // This will print out until the Virtex 5 patch is complete
      if(dev.getPrimitiveExternalPin(currSinkPin) == null){
        MessageGenerator.printHeader("Pin Missing from V5 Patch: " + currNet.getName() + " " + currSinkPin.getName()
            + " " +currSinkPin.getInstance().getTile() + " " + currSinkPin.getInstance().getType());
        continue;
      }
     
      // Populate the current sink node
      currSink.tile = currSinkPin.getInstance().getTile();
      currSink.wire = dev.getPrimitiveExternalPin(currSinkPin);

      // Is this source from a buffer (likely a clock net)?
      boolean currNetOutputFromBUF = currSource.getInstance().getType().toString().contains("BUF");
     
      isCurrSinkAClkWire = (we.getWireDirection(currSink.wire).equals(WireDirection.CLK) ||
                  currSinkPin.getName().contains("CLK") ||
                  currSinkPin.getName().equals("C")) &&
                 (currNetOutputFromBUF ||
                  currSinkPin.getInstance().getType().toString().contains("BUF")
                 );

      // Add additional sources if this is not the first sink of the net being routed
      if(firstConnection){
        // Error checking
        if(dev.getPrimitiveExternalPin(currSource) == null){
          MessageGenerator.briefErrorAndExit("ERROR: Could not find valid external source pin name: " +
              currSource + " " + currSource.getInstance().getType());
        }
       
        // just add the original source
        Node n = new Node(currSource.getInstance().getTile(),
            dev.getPrimitiveExternalPin(currSource), null, 0);
        sources.add(n);
        currSources.add(n);
      }
      else{
View Full Code Here

   */
  private boolean addReservedGNDVCCNode(Node node, Pin pin){
    if(router.usedNodes.contains(node)){
      LinkedList<Net> nets = router.usedNodesMap.get(node);
      if(nets == null){
        Pin p = reservedGNDVCCResources.get(node);
        if(p == null){
          return false;
        }
        else if(!p.getNet().getType().equals(pin.getNet().getType())){
          return false;
        }
      }
      else if(!nets.get(0).getType().equals(pin.getNet().getType())){
        return false;
View Full Code Here

    }
    nets.add(net);
  }
 
  public Node getSwitchBoxWire(Net net){
    Pin source = net.getSource();
    if(source.getName().contains("COUT") && net.getPins().size() == 2){
      Pin sink = net.getPins().get(1).equals(source) ? net.getPins().get(0) : net.getPins().get(1);
      if(sink.getName().contains("CIN")){
        return null;
      }
    }
   
    Node curr = new Node(source.getTile(), dev.getPrimitiveExternalPin(source), null, 0);
View Full Code Here

   * wires for heavily congested switch matrices.
   */
  private void reserveVirtex4SpecificResources(ArrayList<Net> netList){
    HashMap<Tile, ArrayList<Net>> sourceCount = new HashMap<Tile, ArrayList<Net>>();
    for(Net net : netList){
      Pin p = net.getSource();
      if(p == null) continue;
      ArrayList<Net> nets = sourceCount.get(p.getTile());
      if(nets == null){
        nets = new ArrayList<Net>();
        sourceCount.put(p.getTile(), nets);
      }
      nets.add(net);
    }
    HashMap<Tile, ArrayList<Net>> switchMatrixSources = new HashMap<Tile, ArrayList<Net>>();
    for(Tile t : sourceCount.keySet()){
View Full Code Here

            newNet.addPin(currStaticSourcePin);
          }
          else{
            router.design.addInstance(currInst);
            currInst.addToNetList(newNet);
            Pin source = new Pin(true, slicePin, currInst);
            newNet.addPin(source);         
          }
        }
        if(vccs.size() > 0){
          // Create the new net
          Net newNet = createNewNet(NetType.VCC, vccs);
          finalStaticNets.add(newNet);

          // Create new instance of SLICE primitive to get source
          Instance currInst = findClosestAvailableSLICE(ps.useSLICE.get(0).switchMatrixSink.tile, NetType.VCC);

          if(currStaticSourcePin != null){
            currInst.addToNetList(newNet);
            newNet.addPin(currStaticSourcePin);
          }
          else{
            router.design.addInstance(currInst);
            currInst.addToNetList(newNet);
            Pin source = new Pin(true, slicePin, currInst);
            newNet.addPin(source);
          }
        }
      }
    }
   
   
    //===================================================================//
    // Step 4: Finalize node reservations and re-order and assemble nets
    //         for router
    //===================================================================//
    for(Node n : reservedGNDVCCResources.keySet()){
      Pin pinToReserve = reservedGNDVCCResources.get(n);
      addReservedNode(n, pinToReserve.getNet());
   
   
    finalStaticNets = orderGNDNetsFirst(finalStaticNets);
    finalStaticNets.addAll(netList);
    router.netList = finalStaticNets;
View Full Code Here

TOP

Related Classes of edu.byu.ece.rapidSmith.design.Pin

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.