Пример #1
0
		public bool compare (Packet pkt) 
		{
			if (pkt.txn.mshr == _mshr && pkt.requesterID == _requesterID)
				return true;
			else
				return false;
		}
Пример #2
0
 public void addPacket(Packet pkt)
 {
     flitCount += pkt.nrOfFlits;
     Queue<Flit> q = queues[pkt.getQueue()];
     foreach (Flit f in pkt.flits)
         q.Enqueue(f);
 }
Пример #3
0
 public void addPacket(Packet pkt)
 {
     flitCount += pkt.nrOfFlits;
     if (pkt.requesterID == -1)
         queues[0].Enqueue(pkt);
     else
         queues[stc.priorities[pkt.requesterID]].Enqueue(pkt);
 }
Пример #4
0
		public Interference (Packet pkt)
		{
			_txn = pkt.txn;
			_mshr = pkt.txn.mshr;
			_request = pkt.request;
			_requesterID = pkt.requesterID;
			valid = true;
			interference_cycle = pkt.intfCycle;
		}
Пример #5
0
        public Packet process(Packet p)
        {
            if (p.flow_close)
            {
                Simulator.stats.flow_close.Add();
                m_slots++;
#if DEBUG
                Console.WriteLine("FLOW {0}: flow close on {1} (now {2} slots free)", m_n.coord, p, m_slots);
#endif
                checkQueue();
                return p;
            }
            else if (p.flow_open)
            {
                Simulator.stats.flow_open.Add();
#if DEBUG
                Console.WriteLine("FLOW {0}: flow open on {1}", m_n.coord, p);
#endif
                if (m_slots > 0)
                {
#if DEBUG
                    Console.WriteLine("FLOW {0}: granted", m_n.coord);
#endif
                    m_slots--;
                    return p;
                }
                else
                {
                    Simulator.stats.flow_retx.Add();

                    m_retx.Enqueue(p);
#if DEBUG
                    Console.WriteLine("FLOW {0}: queued: now {1} entries on queue", m_n.coord, m_retx.Count);
#endif
                    return null;
                }
            }
            else
            {
#if DEBUG
                Console.WriteLine("FLOW {0}: passthrough {1}", m_n.coord, p);
#endif
                return p;
            }
        }
Пример #6
0
        public void queuePacket(Packet p)
        {
#if PACKETDUMP
            if (m_coord.ID == 0)
            Console.WriteLine("queuePacket {0} at node {1} (cyc {2}) (queue len {3})",
                    p, coord, Simulator.CurrentRound, queueLens);
#endif
            if (p.dest.ID == m_coord.ID) // local traffic: do not go to net (will confuse router)
            {
                m_local.Enqueue(p);
                return;
            }

            if (Config.idealnet) // ideal network: deliver immediately to dest
                Simulator.network.nodes[p.dest.ID].m_local.Enqueue(p);
            else // otherwise: enqueue on injection queue
            {
                m_inj_pool.addPacket(p);
            }
        }
Пример #7
0
 public void sendRetx(Packet p)
 {
     p.nrOfArrivedFlits = 0;
     RetxPacket pkt = new RetxPacket(p.dest, p.src, p);
     queuePacket(pkt);
 }
Пример #8
0
        //private bool[] deflections;
        //private int deflectionsIndex;
        public Flit(Packet packet, int flitNr)
        {
            this.packet = packet;
            this.flitNr = flitNr;

            hasFlitArrived = false;
            this.Deflected = false;
			this.Bypassed = false;
			this.ackCount = 1;
			this.creationTime = Simulator.CurrentRound;
            //deflections = new bool[100];
            //deflectionsIndex = 0;
            if (packet != null)
                distance = Simulator.distance(packet.src, packet.dest);
            this.routingOrder = false;
			if (packet == null) return;
			int srcX = packet.src.ID / Config.network_nrY / 2;
			int destX = packet.dest.ID / Config.network_nrY / 2;

            if (Config.AllBiDirLink || Config.HR_NoBias || Config.topology != Topology.Mesh)
				parity = -1;
			if (Config.topology == Topology.MeshOfRings && Config.RC_mesh == true)
			{
				if (srcX == destX) 
					parity = -1;
				else if (destX > srcX)
					parity = 0;
				else  // destX < srcX
					parity = 1;
			}

			if (Config.SingleDirRing)
				parity = 0;

			preferredDirVector = new bool[5] {false, false, false, false, false};

			
            /*if ((srcCluster == 0 || srcCluster == 3) && 
            	(destCluster == 1 || destCluster == 2))
            	Simulator.stats.flitToUpper.Add();
            else if ((srcCluster == 1 || srcCluster == 2) &&
            	(destCluster == 0 || destCluster == 3))
            	Simulator.stats.flitToLower.Add();*/
        }
Пример #9
0
        public void receivePacket(Packet p)
        {
#if PACKETDUMP
            if (m_coord.ID == 0)
            Console.WriteLine("receive packet {0} at node {1} (cyc {2}) (age {3})",
                p, coord, Simulator.CurrentRound, Simulator.CurrentRound - p.creationTime);
#endif

            if (p is RetxPacket)
            {
                p.retx_count++;
                p.flow_open = false;
                p.flow_close = false;
                queuePacket( ((RetxPacket)p).pkt );
            }
            else if (p is CachePacket)
            {
                CachePacket cp = p as CachePacket;
                m_cpu.receivePacket(cp);
            }
        }
Пример #10
0
 //private bool[] deflections;
 //private int deflectionsIndex;
 public Flit(Packet packet, int flitNr)
 {
     this.packet = packet;
     this.flitNr = flitNr;
     hasFlitArrived = false;
     this.Deflected = false;
     //deflections = new bool[100];
     //deflectionsIndex = 0;
     if (packet != null)
         distance = Simulator.distance(packet.src, packet.dest);
 }
Пример #11
0
 void ejectPacket(Packet p)
 {
     m_a(p);
 }
Пример #12
0
 public void addPacket(Packet pkt)
 {
     flitCount += pkt.nrOfFlits;
     HeapNode h = new HeapNode(pkt);
     heaps[pkt.getQueue()].Enqueue(h);
 }
Пример #13
0
 public void addPacket(Packet pkt)
 {
     flitCount += pkt.nrOfFlits;
     queues[pkt.getQueue()].Enqueue(pkt);
 }
Пример #14
0
		void multicastSynthGenMultiDst ()
		{
			double mc_rate = Config.mc_rate; // enforcing mc_rate = 0 is equivalent to running unicast
			double mc_degree = 1;
			List <Coord> sharerList = new List <Coord> ();
			int packet_size; 
			Coord dst;
			//Coord[] destArray = new Coord[] { };

			if (Simulator.rand.NextDouble () < mc_rate) {
				mc_degree = Simulator.rand.Next (Config.mc_degree - 2) + 2; // multicast; generate index 2-15
				//Console.WriteLine ("TIME={0} Node {1} send {2} MC_PKT", Simulator.CurrentRound, m_coord.ID, mc_degree);
			}
			else
				mc_degree = 1;

			if (mc_degree == 1) {
				// This is a unicast packet
				packet_size = PickPktSize (false, false); 
				unicastSynthGen (false, true);
				return;
			}
				
			while (mc_degree > 0) {
				// This is a MC packet
				// Generate the destination list
				// it will be used for packetization
				// Note: it is different from the destination list of a packet, 
				//       which may be a subset, depending on the network size and pakcet format.
				dst = PickDst();
				if (sharerList.Contains (dst)) // ensure no dst is added twice
					continue;
				sharerList.Add(dst);
				mc_degree--;
			}
			packet_size = PickPktSize (true, false); 
			Packet p = new Packet(null,0,packet_size,m_coord, sharerList);
			queuePacket(p);
			foreach (Coord dest in sharerList) {
				ScoreBoard.RegPacket (dest.ID, p.ID);
				p.creationTimeMC [dest.ID] = Simulator.CurrentRound; // it will be overriden everytime when replication occur, but only once.
			}
			
			Simulator.stats.generate_mc_packet.Add ();
			Simulator.stats.generate_packet.Add (sharerList.Count);
		}
Пример #15
0
        void ejectPacket(Packet p)
        {
            statsEjectPacket(p);

            m_n.receivePacket(p);
        }
Пример #16
0
		Packet packetization ()
		{

			int oldHsReq = Simulator.network.hsReqPerNode [m_coord.ID]; // use to determine if a hot spot packet is generated. Place it before PickDst()
			Coord c = PickDst ();
			bool gather = false;
			int packet_size;
			Packet p;

			if (Simulator.network.hsReqPerNode [m_coord.ID] == oldHsReq + 1)
				gather = true;

			packet_size = PickPktSize (false, gather);
			if (gather)
				p = new Packet (null,0,packet_size,m_coord, c, true);
			else
				p = new Packet(null,0,packet_size,m_coord, c);

#if PACKETDUMP
			Console.WriteLine ("#1 Time {0}, @ node {1} {2}", Simulator.CurrentRound, m_coord.ID, p.ToString());
#endif
			return p;
		}
Пример #17
0
		public int get_txn_intf (Packet new_inj_pkt) {
			int intfCycle = 0;
			string key = new_inj_pkt.requesterID.ToString() + (new_inj_pkt.txn.mshr + Config.N).ToString();
			if (m_inheritance_dict.ContainsKey (key)) {
				intfCycle = m_inheritance_dict [key];
				m_inheritance_dict.Remove (key);
			}
			/*
			foreach (Interference i in m_inheritance_table)
			{
				if (i.compare(new_inj_pkt))
				{
					intfCycle = i.intfCycle;
					m_inheritance_table.Remove(i);
					return intfCycle; 
				}
			}
			*/
			return intfCycle;
		}
Пример #18
0
        void sendTeardown(Flit f)
        {
//            Console.WriteLine("\tProc {3}:Teardown for ID {0}: inDir = {1}, nackWire = {2} (packet src {4}, dest {5})",
//                              f.packet.ID, f.inDir, f.nackWire, ID, f.packet.source.ID, f.packet.dest.ID);
            int nNr = nackNr(f.inDir, f.nackWire);
            Packet p = new Packet(f.packet.request, 0, 1, coord, f.packet.src);
            p.scarab_retransmit = f.packet; // don't actually retransmit, but keep this for debugging

            p.scarab_is_teardown = true;

/*
            // these two pieces of data are recorded to let a processor receiveing
            // a teardown whether it should look for an opp buffering slot to be cleared
            p.ID = f.packet.ID;
            p.source = f.packet.source;
 */


            nackOut[nNr].In = p.flits[0];   
        }
Пример #19
0
        void sendNack(Flit f)
        {
            int nNr = nackNr(f.inDir, f.nackWire);
//            Console.WriteLine("\tProc {4}:sendNack for ID {0}: inDir = {1}, nackWire = {2}, nNr = {3}",
//                              f.packet.ID, f.inDir, f.nackWire, nNr, ID);
            Packet p = new Packet(f.packet.request, 0, 1, coord, f.packet.src);
            p.scarab_retransmit = f.packet;
            f.packet.scarab_retransmit_count++;

            p.scarab_is_nack = true;

            nackOut[nNr].In = p.flits[0];
        }
Пример #20
0
        public void queuePacket(Packet p)
        {
#if PACKETDUMP
            if (m_coord.ID == 0)
            Console.WriteLine("queuePacket {0} at node {1} (cyc {2}) (queue len {3})",
                    p, coord, Simulator.CurrentRound, RequestQueueLen);
#endif

            if (Config.synthGen && !(p is SynthPacket))
                throw new Exception("non-synthetic packet generated in synthetic run!");

            if (p.dest.ID == m_coord.ID) // local traffic: do not go to net (will confuse router)
            {
                m_local.Enqueue(p);
                return;
            }

            if (Config.idealnet) // ideal network: deliver immediately to dest
                Simulator.network.nodes[p.dest.ID].m_local.Enqueue(p);
            else // otherwise: enqueue on injection queue
            {
                m_inj_pool.addPacket(p);
            }
        }
Пример #21
0
 public HeapNode(Packet p) { pkt = p; }
Пример #22
0
        protected virtual void statsEjectPacket(Packet p)
        {
            ulong net_latency = Simulator.CurrentRound - p.injectionTime;
            ulong total_latency = Simulator.CurrentRound - p.creationTime;

            Simulator.stats.net_latency.Add(net_latency);
            Simulator.stats.total_latency.Add(total_latency);
            Simulator.stats.net_latency_bysrc[p.src.ID].Add(net_latency);
            Simulator.stats.net_latency_bydest[p.dest.ID].Add(net_latency);
            //Simulator.stats.net_latency_srcdest[p.src.ID, p.dest.ID].Add(net_latency);
            Simulator.stats.total_latency_bysrc[p.src.ID].Add(total_latency);
            Simulator.stats.total_latency_bydest[p.dest.ID].Add(total_latency);
            //Simulator.stats.total_latency_srcdest[p.src.ID, p.dest.ID].Add(total_latency);
            
           	
        }
Пример #23
0
 public void addPacket(Packet pkt)
 {
     flitCount += pkt.nrOfFlits;
     queue.Enqueue(pkt);
 }
Пример #24
0
        protected void statsEjectPacket(Packet p)
        {
            // Keep track of how many packets get ejected
            //ejectPacketCount++;

            ulong net_latency = Simulator.CurrentRound - p.injectionTime;
            ulong total_latency = Simulator.CurrentRound - p.creationTime;

            if (p.requesterID != ID)
            {
                // a request from some other node. Add this latency to their latency pair.
                Simulator.stats.totalPacketLatency[p.requesterID, ID].Add(total_latency);
            }
            else
            {
                // a reply back from some other node. Add this latency to my latency pair.
                Simulator.stats.totalPacketLatency[ID, p.src.ID].Add(total_latency);
            }

            Simulator.stats.net_latency.Add(net_latency);
            Simulator.stats.total_latency.Add(total_latency);
            Simulator.stats.net_latency_bysrc[p.src.ID].Add(net_latency);
            Simulator.stats.net_latency_bydest[p.dest.ID].Add(net_latency);
            //Simulator.stats.net_latency_srcdest[p.src.ID, p.dest.ID].Add(net_latency);
            Simulator.stats.total_latency_bysrc[p.src.ID].Add(total_latency);
            Simulator.stats.total_latency_bydest[p.dest.ID].Add(total_latency);
            //Simulator.stats.total_latency_srcdest[p.src.ID, p.dest.ID].Add(total_latency);
        }
Пример #25
0
        public void receivePacket(Packet p)
        {
#if PACKETDUMP
            if (m_coord.ID == 0)
            Console.WriteLine("receive packet {0} at node {1} (cyc {2}) (age {3})",
                p, coord, Simulator.CurrentRound, Simulator.CurrentRound - p.creationTime);
#endif

			// nothing happens for synthetic packet
			if (p is RetxPacket) {
				p.retx_count++;
				p.flow_open = false;
				p.flow_close = false;
				queuePacket (((RetxPacket)p).pkt);
			} else if (p is CachePacket) {
				CachePacket cp = p as CachePacket;// TODO: DONT CAST, CREATE NEW ONE
				m_cpu.receivePacket (cp); // by Xiyue: Local ejection
			} 
        }
Пример #26
0
        /**
         * Always call this initialization method before using a packet. All flits are also appropriately initialized
         */
        public void initialize(ulong creationTime, int nrOfFlits)
        {
            _ID = Packet.nrPackets;
            Packet.nrPackets++;

            batchID = (Simulator.CurrentRound / Config.STC_batchPeriod) % Config.STC_batchCount;

            this.nrOfFlits = nrOfFlits;

            flits = new Flit[nrOfFlits];
            for (int i = 0; i < nrOfFlits; i++)
                flits[i] = new Flit(this, i);

            flits[0].isHeadFlit = true;
            for (int i = 1; i < nrOfFlits; i++)
                flits[i].isHeadFlit = false;

            this.creationTime = creationTime;
            injectionTime = ulong.MaxValue;
            nrOfArrivedFlits = 0;

            for (int i = 0; i < nrOfFlits; i++)
            {
                flits[i].hasFlitArrived = false;
                flits[i].nrOfDeflections = 0;
            }


            for (int i = 0; i < nrOfFlits; i++)
            {
                flits[i].isTailFlit = false;
                flits[i].isHeadFlit = false;
            }

            flits[0].isHeadFlit = true;
            flits[nrOfFlits - 1].isTailFlit = true;

            flow_open = false;
            flow_close = false;
            retx_count = 0;

            scarab_retransmit_count = 0;
            scarab_retransmit = null;
            scarab_is_nack = false;
            scarab_is_teardown = false;
        }
Пример #27
0
        public RetxPacket(Coord src, Coord dest, Packet p)
			: base(null, 0, 1, src, dest)
        {
            pkt = p;
        }
Пример #28
0
		public void queuePacket(Packet p) // By Xiyue: called by CmpCache::send_noc() 
        {
			if (p.dest.ID == m_coord.ID && p.mc == false) // local traffic: do not go to net (will confuse router) // by Xiyue: just hijack the packet if it only access the shared cache at the local node.
            {
                m_local.Enqueue(p);  // this is filter out
                return;
            }

			if (Config.idealnet && p.mc == false) // ideal network: deliver immediately to dest
                Simulator.network.nodes[p.dest.ID].m_local.Enqueue(p);
            else // otherwise: enqueue on injection queue
            {
                m_inj_pool.addPacket(p); //By Xiyue: Actual Injection.
            }
        }
Пример #29
0
		//end Xiyue






        /**
         * Always call this initialization method before using a packet. All flits are also appropriately initialized
         */
        public void initialize(ulong creationTime, int nrOfFlits)
        {

            _ID = Packet.nrPackets;
            Packet.nrPackets++;

            batchID = (Simulator.CurrentRound / Config.STC_batchPeriod) % Config.STC_batchCount;

            this.nrOfFlits = nrOfFlits;

            flits = new Flit[nrOfFlits];
            for (int i = 0; i < nrOfFlits; i++)
                flits[i] = new Flit(this, i);

            flits[0].isHeadFlit = true;
            for (int i = 1; i < nrOfFlits; i++)
                flits[i].isHeadFlit = false;

            this.creationTime = creationTime;
			//reqCreationTime = creationTime;
            injectionTime = ulong.MaxValue;
            nrOfArrivedFlits = 0;

            for (int i = 0; i < nrOfFlits; i++)
            {
				if (flits[i].packet.mc)
					flits[i].destList = new List <Coord> (destList);
                flits[i].hasFlitArrived = false;
                flits[i].nrOfDeflections = 0;
            }

            /* This is needed for wormhole routing in bidirectional ring.
             * Body flits have to take the same ring as the head.
             */
            pktParity = -1;

            for (int i = 0; i < nrOfFlits; i++)
            {
                flits[i].isTailFlit = false;
                flits[i].isHeadFlit = false;
            }

            flits[0].isHeadFlit = true;
            flits[nrOfFlits - 1].isTailFlit = true;

            flow_open = false;
            flow_close = false;
            retx_count = 0;

            scarab_retransmit_count = 0;
            scarab_retransmit = null;
            scarab_is_nack = false;
            scarab_is_teardown = false;
        }
Пример #30
0
        public void queuePacket(Packet p)
        {
#if PACKETDUMP
//            if (m_coord.ID == 0)
            Console.WriteLine("queuePacket {0} at node {1} (cyc {2}) (queue len {3}), from GPU = {4}",
                    p, coord, Simulator.CurrentRound, RequestQueueLen, p.from_GPU);
#endif

            if (Config.synthGen && !(p is SynthPacket))
                throw new Exception("non-synthetic packet generated in synthetic run!");

            if (p.dest.ID == m_coord.ID) // local traffic: do not go to net (will confuse router)
            {
                m_local.Enqueue(p);
                return;
            }

            if (Config.idealnet) // ideal network: deliver immediately to dest
                Simulator.network.nodes[p.dest.ID].m_local.Enqueue(p);
            else // otherwise: enqueue on injection queue
            {
                //[Fixed] TODO: Rachata, need to trace this, for some reason there is no requesterID
                //Console.WriteLine("Here1, adding packet P {0}",p);
                //Console.WriteLine("Here1, adding packet P {0}",p.request.requesterID);
                m_inj_pool.addPacket(p);
            }
        }