예제 #1
0
파일: Mnet.cs 프로젝트: Gl237man/mineroute
 public void ReadMnetFile(string FileName)
 {
     nodes = new List<Node>();
     wires = new List<Wire>();
     string[] tstr = System.IO.File.ReadAllLines(FileName);
     for (int i = 0; i < tstr.Length; i++)
     {
         if (tstr[i].Split(':')[0] == "NODE")
         {
             Node N = new Node();
             N.ReadFromString(tstr[i]);
             nodes.Add(N);
         }
         if (tstr[i].Split(':')[0] == "WIRE")
         {
             Wire W = new Wire();
             W.ReadFromString(tstr[i]);
             wires.Add(W);
         }
     }
 }
예제 #2
0
 private static void SortOptimize(Mnet MainNetwork)
 {
     for (int i = 0; i < MainNetwork.nodes.Count * OptimiseDeep; i++)
     {
         for (int j = 0; j < (MainNetwork.nodes.Count - 1); j++)
         {
             if (MainNetwork.nodes[j].NodeType != "INPort" && MainNetwork.nodes[j].NodeType != "OUTPort")
             {
                 List<Wire> Wlist1 = FindAllWiresTo(MainNetwork.wires, MainNetwork.nodes[j]);
                 //List<Wire> Wlist2 = FindAllWiresTo(MainNetwork.wires, MainNetwork.nodes[j+1]);
                 int ka = CalcWireLens(Wlist1, MainNetwork);
                 //int kb = CalcWireLens(Wlist2, MainNetwork);
                 if (ka < 0)
                 {
                     if (MainNetwork.nodes[j + 1].NodeType != "INPort" && MainNetwork.nodes[j + 1].NodeType != "OUTPort")
                     {
                         Node N = new Node();
                         N = MainNetwork.nodes[j];
                         MainNetwork.nodes[j] = MainNetwork.nodes[j + 1];
                         MainNetwork.nodes[j + 1] = N;
                     }
                 }
                 if (ka > 0)
                 {
                     if (MainNetwork.nodes[j - 1].NodeType != "INPort" && MainNetwork.nodes[j - 1].NodeType != "OUTPort")
                     {
                         Node N = new Node();
                         N = MainNetwork.nodes[j];
                         MainNetwork.nodes[j] = MainNetwork.nodes[j - 1];
                         MainNetwork.nodes[j - 1] = N;
                     }
                 }
             }
         }
     }
 }
예제 #3
0
 private static void PlaceSBNode(List<StarBoundNode> SBNodes, Node node)
 {
     SBNodes.Add(new StarBoundNode(node.NodeType, node.NodeName, tx * Step, ty * Step));
     ty++;
     if (ty == Height)
     {
         ty = 0;
         tx++;
     }
 }
예제 #4
0
 private static List<Wire> FindAllWiresTo(List<Wire> Wlist, Node node)
 {
     List<Wire> WO = new List<Wire>();
     for (int i = 0; i < Wlist.Count; i++)
     {
         if (Wlist[i].DistName == node.NodeName)
             WO.Add(Wlist[i]);
         if (Wlist[i].SrcName == node.NodeName)
             WO.Add(Wlist[i]);
     }
     return WO;
 }