Esempio n. 1
0
        public void CreateRouting(int[,] AdjacencyMatrix, int[,] Netlist, string Algorithm, string[] AlgorithmArguments)
        {
            int[,] Routing = new int[K, K];

            if (Algorithm == AlgorithmsTypes.Dijkstra)
            {
                for (int Vertex = 0; Vertex < K; Vertex++)
                {
                    Routing[Vertex, Vertex] = 4;
                }

                List <List <int> > PathForNode;
                PathForNode = Dijkstra.CreateRouting(AdjacencyMatrix, 0);
                Routing     = Dijkstra.FillRouting(0, Routing, PathForNode, Netlist);
                for (int Vertex = 1; Vertex < K; Vertex++)
                {
                    int[] PreviousRow = new int[K];
                    for (int Element = 0; Element < K; Element++)
                    {
                        PreviousRow[Element] = Routing[Vertex - 1, Element];
                    }

                    int[] ShiftedRow = Dijkstra.ShiftRight(PreviousRow);
                    for (int Element = 0; Element < K; Element++)
                    {
                        Routing[Vertex, Element] = ShiftedRow[Element];
                    }
                }
            }
            else
            {
                if (Algorithm == AlgorithmsTypes.PO)
                {
                    Routing = PO.CreateRouting(Netlist, K, S1, S2);
                }
                else
                {
                    if (Algorithm == AlgorithmsTypes.ROU)
                    {
                        int Iters = Int32.Parse(AlgorithmArguments[0]);
                        Routing = ROU.CreateRouting(Netlist, K, Iters, S1, S2);
                    }
                    else
                    {
                        if (Algorithm == AlgorithmsTypes.GreedyPromotion)
                        {
                            Routing = GreedyPromotion.CreateRouting(K, S1, S2, Netlist);
                        }
                    }
                }
            }

            SetRouting(Routing);
        }
Esempio n. 2
0
        // method for creating routing
        public void CreateRouting(string Algorithm)
        {
            int[,] NewRouting = new int[Vertices, Vertices];

            if (Algorithm == AlgorithmsTypes.MeshYX)
            {
                int CurrentRow, TargetRow;
                for (int Row = 0; Row < Vertices; Row++)
                {
                    for (int Col = 0; Col < Vertices; Col++)
                    {
                        CurrentRow = Row / M;
                        TargetRow  = Col / M;
                        if (Row < Col)
                        {
                            if (CurrentRow < TargetRow)
                            {
                                NewRouting[Row, Col] = 1;
                            }
                            else
                            {
                                NewRouting[Row, Col] = 2;
                            }
                        }
                        else if (Row > Col)
                        {
                            if (CurrentRow > TargetRow)
                            {
                                NewRouting[Row, Col] = 3;
                            }
                            else
                            {
                                NewRouting[Row, Col] = 0;
                            }
                        }
                        else
                        {
                            NewRouting[Row, Col] = 4;
                        }
                    }
                }
            }
            else if (Algorithm == AlgorithmsTypes.GreedyPromotion)
            {
                NewRouting = GreedyPromotion.CreateRouting(N, M, Netlist);
            }


            SetRouting(NewRouting);
        }