예제 #1
0
        private static Mnet MnetComb(Mnet lnet, Mnet lnetC)
        {
            NodeShiftRename(lnetC);
            int dupC = 0;
            //Удаление Одинаковых Портов
            var nodeToRemove = new List<Node>();
            foreach (Node node in lnet.Nodes)
            {
                nodeToRemove.AddRange(lnetC.Nodes.Where(t => node.NodeName == t.NodeName));
            }
            foreach (Node node in nodeToRemove)
            {
                lnetC.RemoveNode(node.NodeName);
            }

            //Поиск Дублирующих Линий

            var wireToRemove = new List<Wire>();

            for (int i = 0; i < lnet.Wires.Count; i++)
            {
                for (int j = 0; j < lnetC.Wires.Count; j++)
                {
                    if (lnet.Wires[i].SrcName == lnetC.Wires[j].SrcName)
                    {
                        if (lnet.Wires[i].SrcPort == lnetC.Wires[j].SrcPort)
                        {
                            //Создание Dup
                            lnet.Nodes.Add(new Node {NodeName = "DUPC" + dupC, NodeType = "DUP2"});
                            lnet.Wires.Add(new Wire
                            {
                                SrcName = "DUPC" + dupC,
                                SrcPort = "O0",
                                DistName = lnet.Wires[i].DistName,
                                DistPort = lnet.Wires[i].DistPort
                            });
                            lnet.Wires.Add(new Wire
                            {
                                SrcName = "DUPC" + dupC,
                                SrcPort = "O1",
                                DistName = lnetC.Wires[j].DistName,
                                DistPort = lnetC.Wires[j].DistPort
                            });
                            lnet.Wires[i].DistName = "DUPC" + dupC;
                            lnet.Wires[i].DistPort = "I0";
                            wireToRemove.Add(lnetC.Wires[j]);
                            dupC++;
                        }
                    }
                }
            }
            //Удаление Дублирующих линий
            foreach (Wire wire in wireToRemove)
            {
                lnetC.RemoveWireFrom(wire.SrcName, wire.SrcPort);
            }
            //Слияние
            for (int i = 0; i < lnetC.Wires.Count; i++)
            {
                lnet.Wires.Add(lnetC.Wires[i]);
            }

            for (int i = 0; i < lnetC.Nodes.Count; i++)
            {
                lnet.Nodes.Add(lnetC.Nodes[i]);
            }

            return lnet;
        }
예제 #2
0
 private static void RemoveLutFromMainNet(Mnet mainNet, IEnumerable<Node> luts)
 {
     foreach (Node node in luts)
     {
         mainNet.RemoveNode(node.NodeName);
     }
 }