protected override void DoCommandAction() { int tileCount = 0; foreach (Tile tile in FPGA.FPGA.Instance.GetAllTiles().Where(t => t.HasNonstopoverBlockedPorts)) { OutputManager.WriteOutput("Tile " + tile.Location + " already contains ports that are excluded from blocking"); } TileSet tilesWithBidirectionalWires = new TileSet(); foreach (Tile t in FPGA.FPGA.Instance.GetAllTiles()) { ProgressInfo.Progress = ProgressStart + ((int)((double)tileCount++ / (double)FPGA.FPGA.Instance.TileCount * ProgressShare)); if (t.WireList == null) { continue; } foreach (Wire wire in t.WireList) { Tile other = Navigator.GetDestinationByWire(t, wire); foreach (Wire otherWire in other.WireList.Where(w => w.LocalPip.Equals(wire.PipOnOtherTile))) { // bidirectional wire detected if (wire.LocalPipIsDriver && otherWire.LocalPipIsDriver) { if (!tilesWithBidirectionalWires.Contains(t)) { tilesWithBidirectionalWires.Add(t); } if (!tilesWithBidirectionalWires.Contains(other)) { tilesWithBidirectionalWires.Add(other); } //this.OutputManager.WriteOutput(this.GetType().Name + " Excluding " + wire.LocalPip + " from " + t.Location); //this.OutputManager.WriteOutput(this.GetType().Name + " Excluding " + otherWire.LocalPip + " from " + other.Location); t.BlockPort(wire.LocalPip, Tile.BlockReason.ExcludedFromBlocking); other.BlockPort(otherWire.LocalPip, Tile.BlockReason.ExcludedFromBlocking); } } } } foreach (Tile t in tilesWithBidirectionalWires) { OutputManager.WriteOutput("Excluded ports from blocking on " + t.Location); } }
protected override void DoCommandAction() { TileSet fence = new TileSet(); foreach (Tile tile in TileSelectionManager.Instance.GetSelectedTiles().Where(t => t.WireList != null)) { foreach (Wire wire in tile.WireList.Where(w => w.LocalPipIsDriver)) { foreach (Location loc in Navigator.GetDestinations(tile.Location, wire.LocalPip).Where(l => !TileSelectionManager.Instance.IsSelected(l.Tile))) { if (!fence.Contains(loc.Tile)) { fence.Add(loc.Tile); } } } } CommandExecuter.Instance.Execute(new Commands.Selection.ClearSelection()); foreach (Tile t in fence) { TileSelectionManager.Instance.AddToSelection(t.TileKey, false); } CommandExecuter.Instance.Execute(new Commands.Selection.ExpandSelection()); }
private void Button2_Click(object sender, EventArgs e) { OpenFileDialog dg = new OpenFileDialog { Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" }; if (dg.ShowDialog() != DialogResult.OK) { return; } HashSet <MapModel.TerrainTile> TileSet; bool mapAnalyzed = true; if ((TileList?.Count ?? 0) == 0) { mapAnalyzed = false; TileSet = new HashSet <MapModel.TerrainTile>(); } else { TileSet = new HashSet <MapModel.TerrainTile>(TileList); } TileList = new List <MapModel.TerrainTile>(); XmlDocument doc = new XmlDocument(); doc.Load(dg.FileName); foreach (XmlElement node in doc.ChildNodes[0].ChildNodes) { if (node.Name != "TerrainTile") { continue; } MapModel.TerrainTile temp = new MapModel.TerrainTile(node.Attributes[ShapeKey].Value, node.Attributes[AlignKey].Value, node.Attributes[NameKey].Value, node.Attributes[ColorKey].Value); if (mapAnalyzed && TileSet.Contains(temp)) { continue; } TileList.Add(temp); TileSet.Add(temp); } TileList.Sort(); CreateBitmaps(); ShowMapControls(); SetIndex(0); }