Exemple #1
0
        public Packet(Request request, ulong block, int nrOfFlits, Coord source, Coord dest)
        {
            _request = request;
            if (_request != null)
            {
                _request.beenToNetwork = true;
            }
            _block = block; // may not come from request (see above)
            _src   = source;
            _dest  = dest;

            _ringsrc  = new RingCoord(RingCoord.getRingIDfromID(source.ID));
            _ringdest = new RingCoord(RingCoord.getRingIDfromID(dest.ID));

            if (request != null)
            {
                request.setCarrier(this);
            }
            requesterID = -1;
            initialize(Simulator.CurrentRound, nrOfFlits);

            /* Prioritizing packets */
            if (Simulator.rand.Next(0, 100) < Config.randomPacketPrioPercent)
            {
                chip_prio = 1;
            }
            else
            {
                chip_prio = 0;
            }
        }
Exemple #2
0
 public Connector(RingCoord rc, bool isNode)
     : base(rc, isNode)
 {
     routerName          = "Ring Connector";
     ringCoord           = rc;
     connectionDirection = Simulator.DIR_NONE;
     injectPlaceholder   = 0;
     rBuf = new ResubBuffer(3);
 }
Exemple #3
0
 public RingRouter_Simple(RingCoord rc, bool isNode)
     : base(rc, isNode)
 {
     routerName    = "Simple Ring Router";
     m_injectSlot  = null;
     m_injectSlot2 = null;
     injectedCount = 0;
     blockCount    = 0;
 }
Exemple #4
0
        protected PreferredDirection determineDirection(Flit f, RingCoord current)
        {
            PreferredDirection pd;

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

            if (f.state == Flit.State.Placeholder)
            {
                return(pd);
            }

            //if (f.packet.ID == 238)
            //    Console.WriteLine("packet 238 at ID ({0},{1}), wants ({2},{3})", current.x, current.y, f.packet.ringdest.x, f.packet.ringdest.y);

            return(determineDirection(f.ringdest));
        }
Exemple #5
0
        public Router(RingCoord rc, bool isNode)
        {
            int id = RingCoord.getIDfromRingID(rc.ID);

            coord = new Coord(id);

            if (isNode)
            {
                m_n = Simulator.network.nodes[ID];
            }
            routerName = "Router";

            neighbors = 0;

            m_lastInj       = 0;
            last_starve     = 0;
            starve_interval = 0;

            qlen_win = new int[AVG_QLEN_WIN];
        }
Exemple #6
0
        //TODO: fix for ring coordinates, if I didn't already
        protected PreferredDirection determineDirection(RingCoord c)
        {
            PreferredDirection pd;

            pd.xDir = Simulator.DIR_NONE;
            pd.yDir = Simulator.DIR_NONE;
            pd.zDir = Simulator.DIR_NONE;
            pd.zDir = ((c.z - ringCoord.z) >= 0) ? 1 : 0;

            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 #7
0
 public RingRouter(RingCoord rc, bool isNode) : base(rc, isNode)
 {
     ringCoord  = rc;
     routerName = "RingRouter";
 }