Package edu.byu.ece.rapidSmith.design

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


            offset = 1;
          }
         
          currElement.setDelay(Float.parseFloat(parts[4+offset]));
          if(design != null){
            Net net = design.getNet(parts[5+offset]);
            if(net == null){
              MessageGenerator.briefErrorAndExit("This net \"" + parts[4+offset] +
              "\" is null.");
            }
            ((RoutingPathElement)currElement).setNet(net);
            for(Pin p : net.getPins()){
              if(p.getName().equals(pinName) && p.getInstance().getPrimitiveSiteName().equals(primitiveSiteName)){
                currElement.setPin(p);
                break;
              }
            }
View Full Code Here


   
    Design design = new Design();
   
    design.loadXDLFile(args[0]);
       
    Net gnd = new Net("GLOBAL_LOGIC0",NetType.GND);
    Net vcc = new Net("GLOBAL_LOGIC1",NetType.VCC);
   
    ArrayList<Net> netsToRemove = new ArrayList<Net>();
   
    for(Net net : design.getNets()){
      if(net.isStaticNet()){
        netsToRemove.add(net);
        if(net.getSource() != null && net.getSource().getInstance() != null){
          design.getInstanceMap().remove(net.getSource().getInstance().getName());
        }
        if(net.getType().equals(NetType.GND)){
          for(Pin pin : net.getPins()){
            if(pin.isOutPin()) continue;
            gnd.addPin(pin);
          }
        }
        else if(net.getType().equals(NetType.VCC)){
          for(Pin pin : net.getPins()){
            if(pin.isOutPin()) continue;
            vcc.addPin(pin);
          }
        }
      }
    }
   
View Full Code Here

                newPort = new Port("GLOBAL_LOGIC"+type+"_"+(uniqueGL++)+"_inport" + num,p);
                hardMacro.getPorts().add(newPort);
              }
             
              // Create a new net for each pin created
              Net newNet = new Net();
              if(net.getName().charAt(12) == '0'){
                newNet.setName("GLOBAL_LOGIC0_" + diff++);
              }
              else{
                newNet.setName("GLOBAL_LOGIC1_" + diff++);
              }
              newNet.getPins().add(p);
              netsToAdd.add(newNet);
              p.setPort(newPort);
            }
            num++;
          }
View Full Code Here

            failGracefully("This design contains tri-state IO, which is not yet supported by the HMG.");
          }
          instancesToRemove.add(pin.getInstance());
         
          // 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);
View Full Code Here

    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
View Full Code Here

    // Check for duplicate PIPs
    HashMap<PIP,Net> pipMap = new HashMap<PIP, Net>();
    MessageGenerator.printHeader("CHECKING FOR DUPLICATE PIPS ... ");
    for(Net net : design.getNets()){
      for(PIP pip : net.getPIPs()){
        Net tmp = pipMap.get(pip);
        if(tmp == null){
          pipMap.put(pip, net);
        }
        else{
          System.out.print("  Duplicate PIP: " + pip.toString(design.getWireEnumerator()));
          System.out.println("  in nets: " + net.getName());
          System.out.println("           " + tmp.getName());
        }
      }
    }
   
    // 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 (!nets.removeAll(vccNets)) {
      System.out.println("Problem separating VCC nets");
    }
   
   
    Net gndNet = new Net();
    gndNet.setName("GLOBAL_LOGIC0");
    gndNet.setType(NetType.GND);
    for(Net net : gndNets){
      for(Pin pin : net.getPins()) {
        if(!pin.isOutPin()) {
          gndNet.addPin(pin);
        }
      }
    }
   
    Net vccNet = new Net();
    vccNet.setName("GLOBAL_LOGIC1");
    vccNet.setType(NetType.VCC);
    for(Net net : vccNets){
      for(Pin pin : net.getPins()) {
        if(!pin.isOutPin()) {
          vccNet.addPin(pin);
        }
      }
    }
   
    newNets.addAll(nets);
View Full Code Here

         
          //check netList
          HashMap<String,Net> netMap = xdl2.getNetMap();
          for(Net net1:xdl2.getNets()){
            if(netMap.containsKey(net1.getName())){
              Net net2 = netMap.remove(net1.getName());
              if(net1.toString().compareTo(net2.toString()) != 0){
                status("Net "+net1.getName()+" from design " + xdl1.getName() + " was configured differently in design " + xdl2.getName() + ".");
                return false;
              }
            }else{
              status("Net "+net1.getName()+" from design " + xdl1.getName() + " was not found in design " + xdl2.getName() + ".");
View Full Code Here

        if(token.equals(INST)|| token.equals(INSTANCE)){
          currInstance = new Instance();
          state = ParserState.INSTANCE_NAME;
        }
        else if(token.equals(NET)){
          currNet = new Net();
          state = ParserState.NET_NAME;
        }
        else if(token.equals(MODULE)){
          currModule = new Module();
          modPinMap = new HashMap<String, Pin>();
          portNames = new ArrayList<String>();
          portInstanceNames = new ArrayList<String>();
          portPinNames = new ArrayList<String>();
          state = ParserState.MODULE_NAME;
        }
        else if(token.equals(ENDMODULE)){
          state = ParserState.END_MODULE_NAME;
        }
        else{
          expect("inst, net, module or endmodule", token, ParserState.XDL_STATEMENT);
        }
        break;
      case INSTANCE_NAME:
        currInstance.setName(pool.getUnique(token));
        currInstance.setDesign(design);
        if(currModule == null){
          design.addInstance(currInstance);
        }
        else{
          currModule.addInstance(currInstance);
          currInstance.setModuleTemplate(currModule);
          if(currInstance.getName().equals(currModuleAnchorName)){
            currModule.setAnchor(currInstance);
          }
        }
        state = ParserState.INSTANCE_TYPE;
        break;
      case INSTANCE_TYPE:
          PrimitiveType t = Utils.createPrimitiveType(token);
          if(t == null){
            MessageGenerator.briefErrorAndExit("XDL Design Parser Error in file: "+ fileName +", Failed parsing Instance type: \"" + token + "\"");
          }
          currInstance.setType(t);
          state = ParserState.INSTANCE_PLACED;
        break;
      case INSTANCE_PLACED:
        if(token.equals(PLACED)) state = ParserState.INSTANCE_TILE;
        else if(token.equals(UNPLACED)) state = ParserState.INSTANCE_BONDED;
        else expect("placed or unplaced", token, ParserState.INSTANCE_PLACED);
        break;
      case INSTANCE_TILE:
        Tile tile = dev.getTile(token);
        if(tile == null){
          MessageGenerator.briefErrorAndExit("XDL Design Parser Error in file: "+ fileName +", Invalid tile " +
              token + " on line " + lineNumber);
        }
        state = ParserState.INSTANCE_SITE;
        break;
      case INSTANCE_SITE:
        PrimitiveSite site = dev.getPrimitiveSite(token);
        if(site == null){
          MessageGenerator.briefErrorAndExit("XDL Design Parser Error in file: "+ fileName +", Invalid primitive site " +
              token + " on line " + lineNumber);
        }
        if(currModule != null){
          currInstance.setSite(dev.getPrimitiveSite(token));
        }else{
          currInstance.place(dev.getPrimitiveSite(token));         
        }
        state = ParserState.MODULE_INSTANCE_TOKEN;
        break;
      case INSTANCE_BONDED:
        if(token.equals(COMMA)){
          state = ParserState.MODULE_INSTANCE_TOKEN;
        }
        else if(token.equals(CFG)){
          state = ParserState.ATTRIBUTE;
        }
        else if(token.equals(MODULE)){
          state = ParserState.MODULE_INSTANCE_NAME;
        }
        else if(token.equals(BONDED)){
          currInstance.setBonded(true);
          state = ParserState.MODULE_INSTANCE_TOKEN;
        }
        else if(token.equals(UNBONDED)){
          currInstance.setBonded(false);
          state = ParserState.MODULE_INSTANCE_TOKEN;
        }
        else{
          expect("bonded, unbonded or ,", token, ParserState.INSTANCE_BONDED);
        }
        break;
      case MODULE_INSTANCE_TOKEN:
        if(token.equals(CFG)) state = ParserState.ATTRIBUTE;
        else if(token.equals(MODULE)) state = ParserState.MODULE_INSTANCE_NAME;
        else expect("cfg or module", token, ParserState.MODULE_INSTANCE_TOKEN);
        break;
      case MODULE_INSTANCE_NAME:
        currModuleInstanceName = pool.getUnique(token);
        state = ParserState.MODULE_TEMPLATE_NAME;
        break;
      case MODULE_TEMPLATE_NAME:
        currInstance.setModuleTemplate(design.getModule(token));
        state = ParserState.MODULE_TEMPLATE_INSTANCE_NAME;
        break;
      case MODULE_TEMPLATE_INSTANCE_NAME:
        currInstance.setModuleTemplateInstance(currInstance.getModuleTemplate().getInstance(token));
        ModuleInstance moduleInstance = design.addInstanceToModuleInstances(currInstance, currModuleInstanceName);
        if(currInstance.getModuleTemplateInstance().equals(currInstance.getModuleTemplate().getAnchor())){
          moduleInstance.setAnchor(currInstance);
        }
        state = ParserState.CFG_STRING;
        break;
      case NET_NAME:
        currNet.setName(pool.getUnique(token));
        if(currModule == null) design.addNet(currNet);
        else currModule.addNet(currNet);
        state = ParserState.NET_TYPE;
        break;
      case NET_TYPE:
        if(token.equals(COMMA) || token.equals(WIRE)){
          currNet.setType(NetType.WIRE);
        }
        else if(token.equals(CFG)){
          state = ParserState.ATTRIBUTE;
          break;
        }
        else if(token.equals(GND) || token.equals(GROUND)){
          currNet.setType(NetType.GND);
        }
        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;
        }
        else if(token.equals(SEMICOLON)){
          state = ParserState.XDL_STATEMENT;
        }
        else if(token.equals(CFG)){
          state = ParserState.ATTRIBUTE;
        }
        break;
      case PIN_INSTANCE_NAME:
        Instance inst;
        if(currModule == null) inst = design.getInstance(token);
        else inst = currModule.getInstance(token);
        if(inst == null){
          MessageGenerator.briefErrorAndExit("ERROR: Could not find instance " +
            token + " on line " + lineNumber);
        }
        currPin.setInstance(inst);
        inst.addToNetList(currNet);
        state = ParserState.PIN_NAME;
        break;
      case PIN_NAME:
        currPin.setPinName(pool.getUnique(token));
        currPin.getInstance().addPin(currPin);
        if(currModule != null){
            modPinMap.put(currPin.getInstanceName() + currPin.getName(), currPin);
        }
        state = ParserState.NET_STATEMENT;
        break;
      case PIP_TILE:
        Tile pipTile = dev.getTile(token);
        if(pipTile == null){
          MessageGenerator.briefErrorAndExit("Invalid tile " +
              token + " on line " + lineNumber);
        }
        currPIP.setTile(pipTile);
        state = ParserState.PIP_WIRE0;
        break;
      case PIP_WIRE0:
        int wire0 = we.getWireEnum(token);
        if(wire0 == -1) {
          MessageGenerator.briefErrorAndExit("ERROR: Invalid wire: " +
              token + " found on line " + lineNumber);
        }
        currPIP.setStartWire(wire0);
        state = ParserState.PIP_CONN_TYPE;
        break;
      case PIP_CONN_TYPE:
        if(token.equals(PIP0) || token.equals(PIP1) || token.equals(PIP2) || token.equals(PIP3)){
          state = ParserState.PIP_WIRE1;
        }
        else{
          expect("->, =-, ==, or =>", token, ParserState.PIP_CONN_TYPE);
        }
        break;
      case PIP_WIRE1:
        int wire1 = we.getWireEnum(token);
        if(wire1 == -1) {
          MessageGenerator.briefErrorAndExit("XDL Design Parser Error in file: "+ fileName +", Invalid wire: " +
              token + " found on line " + lineNumber);
        }
        currPIP.setEndWire(wire1);
        state = ParserState.NET_STATEMENT;
        break;
      case MODULE_NAME:
        currModule.setName(pool.getUnique(token));
        state = ParserState.MODULE_ANCHOR_NAME;
        break;
      case MODULE_ANCHOR_NAME:
        currModuleAnchorName = pool.getUnique(token);
        state = ParserState.CFG_STRING;
        break;
      case MODULE_STATEMENT:
        if(token.equals(PORT)){
          state = ParserState.PORT_NAME;
        }
        if(token.equals(INST)|| token.equals(INSTANCE)){
          currInstance = new Instance();
          state = ParserState.INSTANCE_NAME;
        }
        else if(token.equals(NET)){
          currNet = new Net();
          state = ParserState.NET_NAME;
        }
        else if(token.equals(ENDMODULE)){
          state = ParserState.END_MODULE_NAME;
        }
View Full Code Here

      ArrayList<Connection> conns = new ArrayList<Connection>();
      for(PathElement pe : pd.getMaxDataPath()){
        if(pe.getType().equals("net")){
          if(pe.getClass().equals(RoutingPathElement.class)){
            RoutingPathElement rpe = (RoutingPathElement) pe;
            Net net = rpe.getNet();
            conns.addAll(getAllConnections(net));
            /*for(Connection conn : conns){
              scn.drawWire(conn);
              //System.out.println(conn.toString(scene.getWireEnumerator()));
            }*/
 
View Full Code Here

TOP

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

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.