Exemple #1
0
 public Router_New_Exhaustive(Coord myCoord)
     : base(myCoord)
 {
 }
Exemple #2
0
        protected PreferredDirection determineDirection(Coord c)
        {
            PreferredDirection pd;

            pd.xDir = Simulator.DIR_NONE;
            pd.yDir = Simulator.DIR_NONE;
            pd.zDir = Simulator.DIR_NONE;

            if (Config.torus)
            {
                int  x_sdistance = Math.Abs(c.x - coord.x);
                int  x_wdistance = Config.network_nrX - Math.Abs(c.x - coord.x);
                int  y_sdistance = Math.Abs(c.y - coord.y);
                int  y_wdistance = Config.network_nrY - Math.Abs(c.y - coord.y);
                bool x_dright, y_ddown;

                x_dright = coord.x < c.x;
                y_ddown  = c.y < coord.y;

                if (c.x == coord.x)
                {
                    pd.xDir = Simulator.DIR_NONE;
                }
                else if (x_sdistance < x_wdistance)
                {
                    pd.xDir = (x_dright) ? Simulator.DIR_RIGHT : Simulator.DIR_LEFT;
                }
                else
                {
                    pd.xDir = (x_dright) ? Simulator.DIR_LEFT : Simulator.DIR_RIGHT;
                }

                if (c.y == coord.y)
                {
                    pd.yDir = Simulator.DIR_NONE;
                }
                else if (y_sdistance < y_wdistance)
                {
                    pd.yDir = (y_ddown) ? Simulator.DIR_DOWN : Simulator.DIR_UP;
                }
                else
                {
                    pd.yDir = (y_ddown) ? Simulator.DIR_UP : Simulator.DIR_DOWN;
                }
            }
            else
            {
                if (c.x > coord.x)
                {
                    pd.xDir = Simulator.DIR_RIGHT;
                }
                else if (c.x < coord.x)
                {
                    pd.xDir = Simulator.DIR_LEFT;
                }
                else
                {
                    pd.xDir = Simulator.DIR_NONE;
                }

                if (c.y > coord.y)
                {
                    pd.yDir = Simulator.DIR_UP;
                }
                else if (c.y < coord.y)
                {
                    pd.yDir = Simulator.DIR_DOWN;
                }
                else
                {
                    pd.yDir = Simulator.DIR_NONE;
                }
            }

            if (Config.dor_only && pd.xDir != Simulator.DIR_NONE)
            {
                pd.yDir = Simulator.DIR_NONE;
            }

            return(pd);
        }
Exemple #3
0
 public Router_New_Random(Coord myCoord)
     : base(myCoord)
 {
 }
Exemple #4
0
        public override void setup()
        {
            if (Config.N != 16)
            {
                throw new Exception("HR_8drop only suport 4x4 network");
            }
            nodeRouters   = new Router_Node[Config.N];
            bridgeRouters = new Router_Bridge[8];
            nodes         = new Node[Config.N];
            links         = new List <Link>();
            cache         = new CmpCache();

            ParseFinish(Config.finish);

            workload = new Workload(Config.traceFilenames);

            mapping = new NodeMapping_AllCPU_SharedCache();

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord    c    = new Coord(n);
                RC_Coord RC_c = new RC_Coord(n);

                nodes[n]       = new Node(mapping, c);
                nodeRouters[n] = new Router_Node(RC_c, c);
                nodes[n].setRouter(nodeRouters[n]);
                nodeRouters[n].setNode(nodes[n]);
            }
            for (int n = 0; n < 8; n++)
            {
                bridgeRouters[n] = new Router_Bridge(n, Config.GlobalRingWidth);
            }
            // connect the network with Links
            for (int n = 0; n < 4; n++)
            {
                for (int i = 0; i < 4; i++)
                {
                    int ID = n * 4 + i;
                    if (ID % 2 == 0)
                    {
                        continue;
                    }
                    int  next = (i + 1) % 4 + n * 4;
                    Link dirA = new Link(Config.router.switchLinkLatency - 1);
                    Link dirB = new Link(Config.router.switchLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    nodeRouters[ID].linkOut[CW]    = dirA;
                    nodeRouters[next].linkIn[CW]   = dirA;
                    nodeRouters[ID].linkIn[CCW]    = dirB;
                    nodeRouters[next].linkOut[CCW] = dirB;
                }
            }
            int [] CWnext  = { 3, 1, 5, 7, 9, 11, 15, 13 };
            int [] CCWnext = { 2, 0, 4, 6, 8, 10, 14, 12 };
            for (int n = 0; n < 8; n++)
            {
                Link dirA = new Link(Config.router.switchLinkLatency - 1);
                Link dirB = new Link(Config.router.switchLinkLatency - 1);
                Link dirC = new Link(Config.router.switchLinkLatency - 1);
                Link dirD = new Link(Config.router.switchLinkLatency - 1);
                links.Add(dirA);
                links.Add(dirB);
                links.Add(dirC);
                links.Add(dirD);
                bridgeRouters[n].LLinkOut[CW]       = dirA;
                nodeRouters[CWnext[n]].linkIn[CW]   = dirA;
                bridgeRouters[n].LLinkIn[CCW]       = dirB;
                nodeRouters[CWnext[n]].linkOut[CCW] = dirB;

                bridgeRouters[n].LLinkOut[CCW]      = dirC;
                nodeRouters[CCWnext[n]].linkIn[CCW] = dirC;
                bridgeRouters[n].LLinkIn[CW]        = dirD;
                nodeRouters[CCWnext[n]].linkOut[CW] = dirD;

                int next = (n + 1) % 8;

                for (int i = 0; i < Config.GlobalRingWidth; i++)
                {
                    dirA = new Link(Config.router.level1RingLinkLatency - 1);
                    dirB = new Link(Config.router.level1RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    bridgeRouters[n].GLinkIn[i * 2 + 1]     = dirA;
                    bridgeRouters[next].GLinkOut[i * 2 + 1] = dirA;
                    bridgeRouters[n].GLinkOut[i * 2]        = dirB;
                    bridgeRouters[next].GLinkIn[i * 2]      = dirB;
                }
            }
        }
Exemple #5
0
 public SimpleNode(NodeMapping n, Coord c) : base(n, c)
 {
 }
Exemple #6
0
 public RetxPacket(Coord src, Coord dest, Packet p)
     : base(null, 0, 1, src, dest)
 {
     pkt = p;
 }
Exemple #7
0
 public SynthPacket(Coord src, Coord dest)
     : base(null, 0, 1, src, dest)
 {
     requesterID = src.ID;
     m_class     = computeClass();
 }
Exemple #8
0
        void route()
        {
            Flit[] temp = new Flit[6];
            for (int i = 0; i < 6; i++)
            {
                temp[i] = input[i];
            }

            int dir;

            if (clockwise)
            {
                dir = Simulator.DIR_CCW;
            }
            else
            {
                dir = Simulator.DIR_CW;
            }

            if (injectPlaceholder > 0)
            {
                injectPlaceholder--;
                if (temp[connectionDirection] != null)
                {
                    rBuf.addFlit(temp[connectionDirection]);
                }

                temp[connectionDirection] = null;

                int tempX = 0;
                int tempY = 0;
                switch (injectPlaceholder % 4)
                {
                case 0:
                    tempX = 4; tempY = 3; break;

                case 1:
                    tempX = 0; tempY = 0; break;

                case 2:
                    tempX = 1; tempY = 2; break;

                case 3:
                    tempX = 2; tempY = 4; break;
                }
                Coord tempCoord = new Coord(tempX, tempY);

                temp[connectionDirection]          = new Flit(new Packet(null, 1337, 1337, tempCoord, tempCoord), 1337);
                temp[connectionDirection].initPrio = -1;
                                #if INEJ
                Console.WriteLine("!!!!!!!!!! INJECTING PLACEHOLDER {0}.{1} at node {2} cyc {3} !!!!!!!!!!!", temp[connectionDirection].packet.ID, temp[connectionDirection].flitNr, ringCoord, Simulator.CurrentRound);
                                #endif

                /*injectPlaceholder--;
                 * temp[dir] = new Flit(new Packet(null, 1337, 1337, new Coord(4,4), new Coord(4,4)), 1337);
                 * temp[dir].initPrio = -1;
                 */
            }

            if (connectionDirection == dir)
            {
                throw new Exception("Connection direction should not be clockwise or counter clockwise");
            }

            // If there is something coming in, try to pull it in.
            if (temp[connectionDirection] != null)
            {
                if (isDestRing(temp[connectionDirection]))
                {
                    if (temp[dir] == null)
                    {
                                                #if INTERCONNECT
                        Console.WriteLine("|Moving Into Ring|   \t \tflit {0}.{1} at node {2} cyc {3} \t | dest: {4}", temp[connectionDirection].packet.ID, temp[connectionDirection].flitNr, ringCoord, Simulator.CurrentRound, temp[connectionDirection].packet.ringdest);
                                                #endif
                        temp[dir] = temp[connectionDirection];
                        temp[connectionDirection] = null;
                    }
                    else
                    {
                        if (isRingProductive(temp[dir], connectionDirection))
                        {
                            Flit tempFlit;
                                                        #if INTERCONNECT
                            Console.WriteLine("|Swapping outside-inside|\tflit {0}.{1} && flit {2}.{3} at node {4} cyc {5} \t \n| dest1: {6} dest2: {7}", temp[connectionDirection].packet.ID, temp[connectionDirection].flitNr, temp[dir].packet.ID, temp[dir].flitNr, ringCoord, Simulator.CurrentRound, temp[connectionDirection].packet.ringdest, temp[dir].packet.ringdest);
                                                        #endif
                            tempFlit  = temp[dir];
                            temp[dir] = temp[connectionDirection];
                            temp[connectionDirection] = tempFlit;
                            getNeighborXY(out temp[connectionDirection].tempX, out temp[connectionDirection].tempY);
                        }
                                                #if INTERCONNECT
                        else
                        {
                            Console.WriteLine("!Deflected outside ring!\tflit {0}.{1} at node{2} cyc {3} \t | dest: {4}", temp[connectionDirection].packet.ID, temp[connectionDirection].flitNr, ringCoord, Simulator.CurrentRound, temp[connectionDirection].packet.ringdest);
                            Console.WriteLine("!!!! DEFLECTED another outside ring!!!\t flit{0}.{1} at node{2} cyc {3} \t | dest: {4}\t Flit {5}.{6} dest:{7}", temp[dir].packet.ID, temp[dir].flitNr, ringCoord, Simulator.CurrentRound, temp[dir].packet.ringdest, temp[connectionDirection].packet.ID, temp[connectionDirection].flitNr, temp[connectionDirection].ringdest);
                        }
                                                #endif
                    }
                }
            }
            // Otherwise, try to push something into the connection.
            else
            {
                if (temp[dir] != null && isRingProductive(temp[dir], connectionDirection))
                {
                                        #if INTERCONNECT
                    Console.WriteLine("|Moving Out of Ring|\t \tflit {0}.{1} at node {2} cyc {3} \t | dest: {4}", temp[dir].packet.ID, temp[dir].flitNr, ringCoord, Simulator.CurrentRound, temp[dir].packet.ringdest);
                                        #endif
                    temp[connectionDirection] = temp[dir];
                    temp[dir] = null;
                    getNeighborXY(out temp[connectionDirection].tempX, out temp[connectionDirection].tempY);
                }
                                #if INTERCONNECT
                else if (temp[dir] != null)
                {
                    Console.WriteLine("!Deflected inside ring!\tflit {0}.{1} at node{2} cyc {3}\t | dest: {4}", temp[dir].packet.ID, temp[dir].flitNr, ringCoord, Simulator.CurrentRound, temp[dir].packet.ringdest);
                }
                                #endif
            }
            input[connectionDirection] = temp[connectionDirection];

            if (clockwise)
            {
                input[Simulator.DIR_CW]  = temp[Simulator.DIR_CCW];
                input[Simulator.DIR_CCW] = null;
            }
            else
            {
                input[Simulator.DIR_CCW] = temp[Simulator.DIR_CW];
                input[Simulator.DIR_CW]  = null;
            }
        }
Exemple #9
0
 public RingRouter(Coord myCoord) : base(myCoord)
 {
     throw new Exception("You really can't make a ring router with a normal coordinate..., defeats the purpose of ringCoord");
 }
Exemple #10
0
 public Connector_Direct_GP(Coord myCoord)
     : base(myCoord)
 {
 }
Exemple #11
0
 public Connector_Direct_ClosestFirst(Coord myCoord)
     : base(myCoord)
 {
 }
Exemple #12
0
 public Connector_Direct_Random(Coord myCoord)
     : base(myCoord)
 {
 }