public static void StoreAndShareWireList(Tile tile, WireList wireList) { // reached end of wire statements -> // clean up after switch matrix is read in // no need to remove wires, as the filtering takes place during wire parsing //wires.RemoveNonExistingWires(tile); bool equalWLFound = false; // try finding an equal wire list foreach (WireList other in FPGA.FPGA.Instance.GetAllWireLists().Where(wl => wl.GetHashCode() == wireList.GetHashCode())) { if (other.Equals(wireList)) { wireList.Key = other.Key; equalWLFound = true; break; } } if (!equalWLFound) { foreach (WireList other in FPGA.FPGA.Instance.GetAllWireLists().Where(wl => wl.Count == wireList.Count)) { if (other.Equals(wireList)) { wireList.Key = other.Key; equalWLFound = true; break; } } } if (!equalWLFound) { wireList.Key = FPGA.FPGA.Instance.WireListCount; } // promote wire list key to tile tile.WireListHashCode = wireList.Key; // now share common wire list if (!FPGA.FPGA.Instance.ContainsWireList(tile.WireListHashCode)) { FPGA.FPGA.Instance.Add(tile.WireListHashCode, wireList); } else { } }