Package edu.byu.ece.rapidSmith.device.helper

Examples of edu.byu.ece.rapidSmith.device.helper.WireHashMap


   
    if(intArray == null){
      return null;
    }
       
    WireHashMap newMap = new WireHashMap((int)(intArray.length*1.3f));

    for(int i : intArray){
      WireArrayConnection wc = wireConnections.get(i);
      newMap.put(wc.wire, wires.get(wc.wireArrayEnum));
    }

    return newMap;
  }
View Full Code Here


    for(Tile tile : dev.getTileMap().values()) {
      if (tile.getWireHashMap() == null)
        continue;

      // create a safe wire map to modify
      WireHashMap wireHashMap = new WireHashMap(tile.getWireHashMap());

      // Create a set of wires that can be driven by other wires within the tile
      // We need this to do a fast look up later on
      Set<Integer> sourceWires = getSourceWiresOfTile(we, tile);

      // Identify any wire connections that are not a "source" wire to "sink" wire
      // connection.
      Set<Integer> wires = new HashSet<>(tile.getWires());
      List<Connection> wiresToBeRemoved = new ArrayList<>();
      for (Integer wire : wires) {
        for (WireConnection wc : tile.getWireConnections(wire)) {
          // never remove PIPs.  We only are searching for different names
          // of the same wire.  A PIP connect unique wires.
          if (wc.isPIP())
            continue;
          if (!sourceWires.contains(wire) ||
              !wireIsSink(we, wc.getTile(tile), wc.getWire())) {
            wiresToBeRemoved.add(new Connection(wire, wc));
          }
        }
      }

      // Remove the edges by creating a new WireConnection arrays sans the
      // connection of interest.
      for (Connection c : wiresToBeRemoved) {
        WireConnection[] currentWires = wireHashMap.get(c.getWire());
        currentWires = removeWire(currentWires, c.getDestinationWire());
        wireHashMap.put(c.getWire(), currentWires);
      }
      // Update the tile with the new wire map.  Search for possible reuse.
      tile.setWireHashMap(tileWiresPool.add(wireHashMap));
    }
  }
View Full Code Here

    for (Tile tile : dev.getTileMap().values()) {
      if (tile.getWireHashMap() == null)
        continue;

      // Create a safe copy to playaround with without messing up any other tiles wires
      WireHashMap whm = new WireHashMap(tile.getWireHashMap());

      // Traverse all non-PIP wire connections starting at this source wire.  If any
      // such wire connections lead to a sink wire that is not already a connection of
      // the source wire, mark it to be added as a connection
      for (Integer wire : whm.keySet()) {
        Set<WireConnection> wcToAdd = new HashSet<>();
        Set<WireConnection> checkedConnections = new HashSet<>();
        Queue<WireConnection> connectionsToFollow = new LinkedList<>();

        // Add the wire to prevent building a connection back to itself
        checkedConnections.add(new WireConnection(wire, 0, 0, false));
        for (WireConnection wc : whm.get(wire)) {
          if (!wc.isPIP()) {
            checkedConnections.add(wc);
            connectionsToFollow.add(wc);
          }
        }

        while (!connectionsToFollow.isEmpty()) {
          WireConnection midwc = connectionsToFollow.remove();
          Tile midTile = midwc.getTile(tile);
          Integer midWire = midwc.getWire();

          // Dead end checks
          if (midTile.getWireHashMap() == null || midTile.getWireConnections(midWire) == null)
            continue;

          for (WireConnection sinkwc : midTile.getWireConnections(midWire)) {
            if (sinkwc.isPIP()) continue;

            Integer sinkWire = sinkwc.getWire();
            Tile sinkTile = sinkwc.getTile(midTile);
            int colOffset = midwc.getColumnOffset() + sinkwc.getColumnOffset();
            int rowOffset = midwc.getRowOffset() + sinkwc.getRowOffset();

            // This represents the wire connection from the original source to the sink wire
            WireConnection source2sink = new WireConnection(sinkWire, rowOffset, colOffset, false);
            boolean wirePreviouslyChecked = !checkedConnections.add(source2sink);

            // Check if we've already processed this guy and process him if we haven't
            if (wirePreviouslyChecked)
              continue;
            connectionsToFollow.add(source2sink);

            // Only add the connection if the wire is a sink.  Other connections are
            // useless for wire traversing.
            if (wireIsSink(we, sinkTile, sinkWire))
              wcToAdd.add(source2sink);
          }
        }

        // If there are wires to add, add them here by creating a new WireConnection array
        // combining the old and new wires.
        if (!wcToAdd.isEmpty()) {
          List<WireConnection> newConnections = new ArrayList<>(Arrays.asList(whm.get(wire)));
          newConnections.addAll(wcToAdd);
          WireConnection[] arrView = newConnections.toArray(
              new WireConnection[newConnections.size()]);
          whm.put(wire, arrView);
        }
      }
    }
  }
View Full Code Here

              bw.write("  Source: " + we.getWireName(key) + nl);
            }
          }
         
          // Wires
          WireHashMap tmp2 = t.getWireHashMap();
          if(tmp2 != null){
            Integer[] wireKeys = new Integer[tmp2.size()];
            wireKeys = tmp2.keySet().toArray(wireKeys);
            Arrays.sort(wireKeys);
            for(Integer key : wireKeys){
              bw.write("  Wire: " + we.getWireName(key) + nl);
              WireConnection[] connections = tmp2.get(key);
              Arrays.sort(connections);
              for(WireConnection w : connections){
                bw.write("    -> " + w.toString(we) + nl);
              }
            }
View Full Code Here

        dev.setRows(Integer.parseInt(parts.get(1)));
        dev.setColumns(Integer.parseInt(parts.get(2)));
        dev.createTileArray();
        for(Tile[] tiles : dev.tiles){
          for(Tile tile : tiles){
            tile.setWireHashMap(new WireHashMap());
            tile.setSinks(new HashMap<Integer, SinkPin>());
          }
        }
        dev.populateTileMap(DeviceFilesCreator.createDeviceTileMap(dev.getPartName()));
      }
View Full Code Here

TOP

Related Classes of edu.byu.ece.rapidSmith.device.helper.WireHashMap

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.