Example #1
0
        public override void setup()
        {
			if (Config.network_nrX != 4 && Config.network_nrY != 4)
				throw new Exception("buffered hierarchical ring only support 4x4 network");
			nics = new Router_NIC[Config.N];
			iris = new Router_IRI[4];
            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);
                nodes[n] = new Node(mapping, c);
				nics[n] = new Router_NIC(c);
                nodes[n].setRouter(nics[n]);
                nics[n].setNode(nodes[n]);
            }
			for (int n = 0; n < 4; n++)
			{
				iris[n] = new Router_IRI(n);
			}

			for (int group = 0; group < 4; group ++)
			{
				for (int i = 0; i < 4; i++)
				{
					if (i == 3) continue;
					int node = group * 4 + i;
					Link dirA = new Link(Config.router.switchLinkLatency - 1);
					links.Add(dirA);
					nics[node].linkOut[0] = dirA;
					nics[node+1].linkIn[0] = dirA;
				}

				Link dirD = new Link(Config.router.switchLinkLatency - 1);
				Link dirB = new Link(Config.router.switchLinkLatency - 1);
				links.Add(dirB);
				links.Add(dirD);
				nics[group*4 + 3].linkOut[0] = dirD;
				iris[group].LLinkIn[0] = dirD;	
				nics[group*4].linkIn[0] = dirB;
				iris[group].LLinkOut[0] = dirB;
				int next = (group + 1) % 4;
				Link dirC = new Link(Config.router.level1RingLinkLatency - 1);
				links.Add(dirC);
				iris[group].GLinkOut[0] = dirC;
				iris[next].GLinkIn[0] = dirC;
			}
       	} 
Example #2
0
        public override void setup()
        {
            if (Config.bBufferedRing)
            {
                nodeRouters = new Router_Node_Buffer[Config.N];
            }
            else
            {
                nodeRouters = new Router_Node[Config.N];
            }

            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);
                if (Config.bBufferedRing)
                {
                    nodeRouters[n] = new Router_Node_Buffer(RC_c, c);
                }
                else
                {
                    nodeRouters[n] = new Router_Node(RC_c, c);
                }
                nodes[n].setRouter(nodeRouters[n]);
                nodeRouters[n].setNode(nodes[n]);
            }
            // connect the network with Links
            for (int n = 0; n < Config.N; n++)
            {
                int  next = (n + 1) % Config.N;
                Link dirA = new Link(Config.router.switchLinkLatency - 1);
                Link dirB = new Link(Config.router.switchLinkLatency - 1);
                links.Add(dirA);
                links.Add(dirB);
                nodeRouters[n].linkOut[CW]     = dirA;
                nodeRouters[next].linkIn[CW]   = dirA;
                nodeRouters[n].linkIn[CCW]     = dirB;
                nodeRouters[next].linkOut[CCW] = dirB;
            }
        }
Example #3
0
      	public override void setup()
       	{
            if (Config.bBufferedRing)
                nodeRouters = new Router_Node_Buffer[Config.N];
            else
                nodeRouters = new Router_Node[Config.N];

            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);
                if (Config.bBufferedRing)
                    nodeRouters[n] = new Router_Node_Buffer(RC_c, c);
                else
                    nodeRouters[n] = new Router_Node(RC_c, c);
                nodes[n].setRouter(nodeRouters[n]);
                nodeRouters[n].setNode(nodes[n]);
            }
            // connect the network with Links
            for (int n = 0; n < Config.N; n++)
            {
				int next = (n + 1) % Config.N;
				Link dirA = new Link(Config.router.switchLinkLatency - 1);
				Link dirB = new Link(Config.router.switchLinkLatency - 1);
				links.Add(dirA);
				links.Add(dirB);
				nodeRouters[n].linkOut[CW] = dirA;
				nodeRouters[next].linkIn[CW] = dirA;
				nodeRouters[n].linkIn[CCW] = dirB;
				nodeRouters[next].linkOut[CCW] = dirB;
			}
       	}
        public override void setup()
        {
            // boilerplate
            nodes = new Node[Config.N];
            cache = new CmpCache();
            ParseFinish(Config.finish);
            workload = new Workload(Config.traceFilenames);
            mapping  = new NodeMapping_AllCPU_SharedCache();

            _nics = new List <BufRingMultiNetwork_NIC>();
            _iris = new List <BufRingMultiNetwork_IRI>();

            links    = new List <Link>();
            _routers = new BufRingMultiNetwork_Router[Config.N];

            //Console.WriteLine("setup: N = {0}", Config.N);

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord c = new Coord(n);
                nodes[n]    = new Node(mapping, c);
                _routers[n] = new BufRingMultiNetwork_Router(c);
                _routers[n].setNode(nodes[n]);
                nodes[n].setRouter(_routers[n]);
            }

            // for each copy of the network...
            for (int copy = 0; copy < Config.bufrings_n; copy++)
            {
                BufRingMultiNetwork_Coord c = new BufRingMultiNetwork_Coord(0, 0);
                BufRingMultiNetwork_IRI   iri;
                int count;
                setup_ring(c, 0, out iri, out count);
            }
        }
Example #5
0
        public override void setup()
        {
            nodeRouters = new Router_Node[Config.N];
            connectRouters = new Router_Connect[Config.N / 2]; // some of the connectRouters may be disabled
            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]);
            }
            // connectRouters are numbered by sweeping x, with y increase in steps
            // disable the routers not needed here. Different topologies can be realised. (mesh, torus)
            for (int n = 0; n < Config.N / 2 ; n++)
            {
            	connectRouters[n] = new Router_Connect(n);
				/*if (n == 0 || n == 1 || n == 2 || n == 3 || 
            		n == 32 || n == 33 || n == 34 || n == 35)
            		connectRouters[n].enable = false;
            	if (n == 4 || n == 12 || n == 20 || n == 28)
            		connectRouters[n].enable = false;*/
            }
			if(Config.RC_mesh)
			{
				for (int i = 0; i < Config.network_nrX / 2; i++)
					connectRouters[i].enable = false;
				for (int i = 0; i < Config.network_nrY / 2; i++)
					connectRouters[Config.network_nrX * i + Config.network_nrX / 2].enable = false;
			}
			if(Config.RC_Torus)
			{
				// all connection Routers are enabled. Both horizontally and vertically. 
				; 
			}
			if (Config.RC_x_Torus)
			{
				for (int i = 0; i < Config.network_nrX / 2; i++)
					connectRouters[i].enable = false;
			}

//			Console.WriteLine("test");
            if (Config.RouterEvaluation)
                return;

            // connect the network with Links
            for (int y = 0; y < Y / 2; y++)
            {
            	for (int x = 0; x < X / 2; x++)
            	{
            		for (int z = 0; z < 4; z++)
            		{
            			int nextCRouter = -1;
						int preCRouter = -1;
            			switch (z)
            			{
            				case 0 : {nextCRouter = x + X*y + X/2; preCRouter = x + X*y; break;}
            				case 1 : {nextCRouter = (x + X*(y+1)) % (Config.N/2); preCRouter = x + X*y + X/2; break;}
            				case 2 : {nextCRouter = (x+1) % (X/2) + X*y + X/2; preCRouter = (x + X*(y+1)) % (Config.N/2); break;}
            				case 3 : {nextCRouter = x + X*y; preCRouter = (x+1) % (X/2) + X*y + X/2; break;}
            			}
						

		        		if (connectRouters[nextCRouter].enable) // clockwise: the connectRouter next to z = 0
		        		{	
		        			Link dirA = new Link(Config.router.linkLatency_N2R - 1);
		        			Link dirB = new Link(Config.router.linkLatency_N2R - 1);
		        			links.Add(dirA);
		        			links.Add(dirB);
							int port = ((z-1) < 0) ? z + 3 : z - 1;
						//	Console.WriteLine("x:{0},y:{1},z:{2}, ID:{3}", x, y, z, RC_Coord.getIDfromXYZ(x, y, z));
						//	Console.WriteLine("node:{0}, next_id:{1}, port{2}", RC_Coord.getIDfromXYZ(x, y, z), nextCRouter, port);
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CW] = dirA;							
		        			connectRouters[nextCRouter].linkIn[port] = dirA;
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CCW] = dirB;
		        			connectRouters[nextCRouter].linkOut[port] = dirB;
		        		}
		        		else  // the router is not enabled : does not exist
		        		{
		        			Link dirA = new Link(Config.router.linkLatency_N2N - 1);
		        			Link dirB = new Link(Config.router.linkLatency_N2N - 1);
		        			links.Add(dirA);
		        			links.Add(dirB);
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CW] = dirA;
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, (z+1) % 4)].linkIn[CW] = dirA;
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CCW] = dirB;
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, (z+1) % 4)].linkOut[CCW] = dirB;
							//Console.WriteLine("node:{0}, wire to node:{1}", RC_Coord.getIDfromXYZ(x, y, z), RC_Coord.getIDfromXYZ(x, y, (z+1) % 4));
		        		}		        		
		        		if (connectRouters[preCRouter].enable)
		        		{
		        			Link dirA = new Link(Config.router.linkLatency_N2R - 1);
		        			Link dirB = new Link(Config.router.linkLatency_N2R - 1);
		        			links.Add(dirA);
		        			links.Add(dirB);
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CCW] = dirA;
		        			connectRouters[preCRouter].linkIn[(z+1) % 4] = dirA;
		        			nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CW] = dirB;
		        			connectRouters[preCRouter].linkOut[(z+1) % 4] = dirB;
							//Console.WriteLine("node:{0}, pre_id:{1}, port{2}", RC_Coord.getIDfromXYZ(x, y, z), preCRouter, port);
		        		}
            		}
            	}
            }
			
        }
		public override void setup()
		{
			if (Config.sub_net <= 0) 
				throw new Exception ("No subnetwork is configured (sub_net <= 0)!");

			_routers = new MultiMeshRouter [Config.N];
			nodes = new Node[Config.N];
			links = new List<Link>();
			cache = new CmpCache();

			endOfTraceBarrier = new bool[Config.N];
			canRewind = false;

			ParseFinish(Config.finish);

			workload = new Workload(Config.traceFilenames);

			mapping = new NodeMapping_AllCPU_SharedCache();

			// create routers and nodes
			// each node contains router [sub_net * node, ... ,  sub_net*(node+1)-1]
			for (int n = 0; n < Config.N; n++)
			{
				Coord c = new Coord(n);
				nodes[n] = new Node(mapping, c);
				_routers [n] = new MultiMeshRouter (c);
				nodes [n].setRouter (_routers [n]);
				_routers [n].setNode (nodes [n]);
				endOfTraceBarrier[n] = false;
			}


			// create the Golden manager
			// NOT sure if needed
			golden = new Golden();

			// connect the network with Links
			for (int n = 0; n < Config.N; n++)
			{
				int x, y;
				Coord.getXYfromID(n, out x, out y);

				// inter-router links
				for (int dir = 0; dir < 4; dir++)
				{

					// Clockwise 0->3 map to N->E->S->W
					/* Coordinate Mapping (e.g. 16 nodes)
					 * (0,3) (1,3) .....     |||||    3  7 ...
					 * ...					 |||||	  2  6 ...
					 * ...					 |||||    1  5 ...
					 * (0,0) (1,0) ......	 |||||    0  4 ...
					 * */

					int oppDir = (dir + 2) % 4; // direction from neighbor's perspective

					// determine neighbor's coordinates
					int x_, y_;
					switch (dir)
					{
						case Simulator.DIR_UP: x_ = x; y_ = y + 1; break;
						case Simulator.DIR_DOWN: x_ = x; y_ = y - 1; break;
						case Simulator.DIR_RIGHT: x_ = x + 1; y_ = y; break;
						case Simulator.DIR_LEFT: x_ = x - 1; y_ = y; break;
						default: continue;
					}

					// If we are a torus, we manipulate x_ and y_
					if(Config.torus)
					{
						if(x_ < 0)
							x_ += X;
						else if(x_ >= X)
							x_ -= X;

						if(y_ < 0)
							y_ += Y;
						else if(y_ >= Y)
							y_ -= Y;
					}
					// mesh, not torus: detect edge
					else if (x_ < 0 || x_ >= X || y_ < 0 || y_ >= Y)
						continue;

					// ensure no duplication by handling a link at the lexicographically
					// first router
					if (x_ < x || (x_ == x && y_ < y)) continue;

					int ID, ID_neighbor; 
					ID = Coord.getIDfromXY(x, y);
					ID_neighbor = Coord.getIDfromXY(x_, y_);

					for (int m = 0; m < Config.sub_net; m++)
					{
						// Link param is *extra* latency (over the standard 1 cycle)
						Link dirA = new Link(Config.router.linkLatency - 1);
						Link dirB = new Link(Config.router.linkLatency - 1);
						links.Add(dirA);
						links.Add(dirB);

						_routers [ID].subrouter [m].linkOut [dir] = dirA;
						_routers [ID_neighbor].subrouter [m].linkIn [oppDir] = dirA;
						_routers [ID].subrouter [m].linkIn [dir] = dirB;
						_routers [ID_neighbor].subrouter [m].linkOut [oppDir] = dirB;
						_routers [ID].subrouter [m].neighbors++;
						_routers [ID_neighbor].subrouter [m].neighbors++;
						_routers [ID].subrouter [m].neigh [dir] = _routers [ID_neighbor].subrouter [m];
						_routers [ID_neighbor].subrouter [m].neigh [oppDir] = _routers [ID].subrouter [m];

					}
				}

				// connect the subrouters

				if (Config.bypass_enable && Config.bridge_subnet)
					for (int pi = 0; pi < Config.num_bypass; pi++)
						for (int m = 0; m < Config.sub_net; m++)
						{
							Link bypass = new Link(0);
							links.Add(bypass);
							_routers[n].subrouter[m].bypassLinkOut[pi] = bypass;
							_routers[n].subrouter[(m+1)%Config.sub_net].bypassLinkIn[pi] = bypass;
							_routers [n].subrouter[m].neighbors++;
							//_routers [n].subrouter [m].neigh [pi] = _routers [n].subrouter [(m+1)%Config.sub_net];
						}

				
			}

			if (Config.bypass_enable == true && Config.bridge_subnet == false)
				for (int i = 0; i < Config.sub_net; i++)
					for (int k = 0; k < Config.network_nrY; k++)
						for (int j = 0; j < Config.network_nrX; j++)
					{
						Link bypass = new Link(0);
						links.Add(bypass);
						_routers[k * Config.network_nrX+j%Config.network_nrX].subrouter[i].bypassLinkOut[0] = bypass;
						_routers[k * Config.network_nrX+(j+1)%Config.network_nrX].subrouter[i].bypassLinkIn[0] = bypass;
						_routers[k * Config.network_nrX+j%Config.network_nrX].subrouter [i].neighbors++;
					}


			// TORUS: be careful about the number of neighbors, which is based on if bypass is enabled. NOT tested.
			if (Config.torus)
				for (int i = 0; i < Config.N; i++)
					for (int j = 0; j < Config.sub_net; j++)
						if (_routers[i].subrouter [j].neighbors < 4)
							throw new Exception("torus construction not successful!");
		}
Example #7
0
        public override void setup()
        {
            nodeRouters   = new Router_Node[Config.N];
            switchRouters = new Router_Switch[Config.N];
            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 < Config.N; n++)
            {
                switchRouters[n] = new Router_Switch(n);
            }

            if (Config.RouterEvaluation)
            {
                return;
            }

            // connect the network with Links
            for (int y = 0; y < Y / 2; y++)
            {
                for (int x = 0; x < X / 2; x++)
                {
                    for (int z = 0; z < 4; z++)
                    {
                        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);
                        int next = (RC_Coord.getIDfromXYZ(x, y, z) + 1) % 4 + RC_Coord.getIDfromXYZ(x, y, z) / 4 * 4;
                        //Console.WriteLine("Net/HR_Network. ID:{0}", RC_Coord.getIDfromXYZ(x, y, z));
                        nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CW] = dirA;
                        switchRouters[next].linkIn[Local_CW] = dirA;
                        nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CCW] = dirB;
                        switchRouters[next].linkOut[Local_CCW] = dirB;

                        nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CCW]        = dirC;
                        switchRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[Local_CCW] = dirC;
                        nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CW]          = dirD;
                        switchRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[Local_CW] = dirD;
                    }
                }
            }
            int [] xRingIndex = { 1, 3, 9, 11, 15, 13, 7, 5 };
            int [] yRingIndex = { 0, 8, 10, 12, 14, 6, 4, 2 };
            for (int n = 0; n < 8; n++)
            {
                Link dirA = new Link(Config.router.level1RingLinkLatency - 1);
                Link dirB = new Link(Config.router.level1RingLinkLatency - 1);
                switchRouters[xRingIndex[n]].linkOut[GL_CCW]          = dirA;
                switchRouters[xRingIndex[(n + 1) % 8]].linkIn[GL_CCW] = dirA;
                switchRouters[xRingIndex[n]].linkIn[GL_CW]            = dirB;
                switchRouters[xRingIndex[(n + 1) % 8]].linkOut[GL_CW] = dirB;

                Link dirC = new Link(Config.router.level1RingLinkLatency - 1);
                Link dirD = new Link(Config.router.level1RingLinkLatency - 1);
                switchRouters[yRingIndex[n]].linkOut[GL_CCW]          = dirC;
                switchRouters[yRingIndex[(n + 1) % 8]].linkIn[GL_CCW] = dirC;
                switchRouters[yRingIndex[n]].linkIn[GL_CW]            = dirD;
                switchRouters[yRingIndex[(n + 1) % 8]].linkOut[GL_CW] = dirD;
                links.Add(dirA);
                links.Add(dirB);
                links.Add(dirC);
                links.Add(dirD);
            }
        }
Example #8
0
        public override void setup()
        {
            if (Config.N != 1024)
            {
                throw new Exception("HR_16_8drop only suport 8x8 network");
            }
            nodeRouters     = new Router_Node[Config.N];
            L1bridgeRouters = new Router_Bridge[512];
            L2bridgeRouters = new Router_Bridge[128];
            L3bridgeRouters = new Router_Bridge[32];
            L4bridgeRouters = 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 < 512; n++)
            {
                L1bridgeRouters[n] = new Router_Bridge(n, 2, 1);
            }
            for (int n = 0; n < 128; n++)
            {
                L2bridgeRouters[n] = new Router_Bridge(n, 4, 2, 2, 8);
            }
            for (int n = 0; n < 32; n++)
            {
                L3bridgeRouters[n] = new Router_Bridge(n, 8, 4, 4, 16);
            }
            for (int n = 0; n < 8; n++)
            {
                L4bridgeRouters[n] = new Router_Bridge(n, 16, 8, 8, 32);
            }
            // connect the network with Links
            for (int n = 0; n < 256; 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;
                }
            }

            // connect L1 bridge Routers
            for (int n = 0; n < 512; n++)
            {
                int ID = n;
                int next, pre;
                if (ID % 8 == 0 || ID % 8 == 6)
                {
                    next = ID * 2 + 3; pre = ID * 2 + 2;
                }
                else if (ID % 8 == 1 || ID % 8 == 7)
                {
                    next = ID * 2 - 1; pre = ID * 2 - 2;
                }
                else
                {
                    next = ID * 2 + 1; pre = ID * 2;
                }

                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);
                L1bridgeRouters[n].LLinkOut[CW] = dirA;
                nodeRouters[next].linkIn[CW]    = dirA;
                L1bridgeRouters[n].LLinkIn[CCW] = dirB;
                nodeRouters[next].linkOut[CCW]  = dirB;

                L1bridgeRouters[n].LLinkOut[CCW] = dirC;
                nodeRouters[pre].linkIn[CCW]     = dirC;
                L1bridgeRouters[n].LLinkIn[CW]   = dirD;
                nodeRouters[pre].linkOut[CW]     = dirD;

                int nextL1 = (n + 1) % 8 + n / 8 * 8;
                if (ID % 8 == 1 || ID % 8 == 5)
                {
                    continue;
                }
                for (int i = 0; i < 2; i++)
                {
                    dirA = new Link(Config.router.level1RingLinkLatency - 1);
                    dirB = new Link(Config.router.level1RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    L1bridgeRouters[n].GLinkIn[i * 2 + 1]       = dirA;
                    L1bridgeRouters[nextL1].GLinkOut[i * 2 + 1] = dirA;
                    L1bridgeRouters[n].GLinkOut[i * 2]          = dirB;
                    L1bridgeRouters[nextL1].GLinkIn[i * 2]      = dirB;
                }
            }
            // connect L2 bridge Routers
            for (int n = 0; n < 128; n++)
            {
                int next, pre;
                if (n % 8 == 0 || n % 8 == 6)
                {
                    next = n * 4 + 6; pre = next - 1;
                }
                else if (n % 8 == 1 || n % 8 == 7)
                {
                    next = n * 4 - 2; pre = next - 1;
                }
                else
                {
                    next = n * 4 + 2; pre = next - 1;
                }

                for (int i = 0; i < 2; i++)
                {
                    Link dirA = new Link(Config.router.level1RingLinkLatency - 1);
                    Link dirB = new Link(Config.router.level1RingLinkLatency - 1);
                    Link dirC = new Link(Config.router.level1RingLinkLatency - 1);
                    Link dirD = new Link(Config.router.level1RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    links.Add(dirC);
                    links.Add(dirD);

                    L2bridgeRouters[n].LLinkOut[i * 2]        = dirA;
                    L1bridgeRouters[next].GLinkIn[i * 2]      = dirA;
                    L2bridgeRouters[n].LLinkIn[i * 2 + 1]     = dirB;
                    L1bridgeRouters[next].GLinkOut[i * 2 + 1] = dirB;

                    L2bridgeRouters[n].LLinkOut[i * 2 + 1]  = dirC;
                    L1bridgeRouters[pre].GLinkIn[i * 2 + 1] = dirC;
                    L2bridgeRouters[n].LLinkIn[i * 2]       = dirD;
                    L1bridgeRouters[pre].GLinkOut[i * 2]    = dirD;
                }
                int nextL2 = (n + 1) % 8 + n / 8 * 8;
                if (n % 8 == 1 || n % 8 == 5)
                {
                    continue;
                }
                for (int i = 0; i < 4; i++)
                {
                    Link dirA = new Link(Config.router.level2RingLinkLatency - 1);
                    Link dirB = new Link(Config.router.level2RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    L2bridgeRouters[n].GLinkIn[i * 2 + 1]       = dirA;
                    L2bridgeRouters[nextL2].GLinkOut[i * 2 + 1] = dirA;
                    L2bridgeRouters[n].GLinkOut[i * 2]          = dirB;
                    L2bridgeRouters[nextL2].GLinkIn[i * 2]      = dirB;
                }
            }
            //connect L3 bridge Routers
            for (int n = 0; n < 32; n++)
            {
                int next, pre;
                if (n % 8 == 0 || n % 8 == 6)
                {
                    next = n * 4 + 6; pre = next - 1;
                }
                else if (n % 8 == 1 || n % 8 == 7)
                {
                    next = n * 4 - 2; pre = next - 1;
                }
                else
                {
                    next = n * 4 + 2; pre = next - 1;
                }

                for (int i = 0; i < 4; i++)
                {
                    Link dirA = new Link(Config.router.level2RingLinkLatency - 1);
                    Link dirB = new Link(Config.router.level2RingLinkLatency - 1);
                    Link dirC = new Link(Config.router.level2RingLinkLatency - 1);
                    Link dirD = new Link(Config.router.level2RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    links.Add(dirC);
                    links.Add(dirD);

                    L3bridgeRouters[n].LLinkOut[i * 2]        = dirA;
                    L2bridgeRouters[next].GLinkIn[i * 2]      = dirA;
                    L3bridgeRouters[n].LLinkIn[i * 2 + 1]     = dirB;
                    L2bridgeRouters[next].GLinkOut[i * 2 + 1] = dirB;

                    L3bridgeRouters[n].LLinkOut[i * 2 + 1]  = dirC;
                    L2bridgeRouters[pre].GLinkIn[i * 2 + 1] = dirC;
                    L3bridgeRouters[n].LLinkIn[i * 2]       = dirD;
                    L2bridgeRouters[pre].GLinkOut[i * 2]    = dirD;
                }
                int nextL3 = (n + 1) % 8 + n / 8 * 8;
                if (n % 8 == 1 || n % 8 == 5)
                {
                    continue;
                }
                for (int i = 0; i < 8; i++)
                {
                    Link dirA = new Link(Config.router.level3RingLinkLatency - 1);
                    Link dirB = new Link(Config.router.level3RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    L3bridgeRouters[n].GLinkIn[i * 2 + 1]       = dirA;
                    L3bridgeRouters[nextL3].GLinkOut[i * 2 + 1] = dirA;
                    L3bridgeRouters[n].GLinkOut[i * 2]          = dirB;
                    L3bridgeRouters[nextL3].GLinkIn[i * 2]      = dirB;
                }
            }
            //connect L4 bridge Routers
            for (int n = 0; n < 8; n++)
            {
                int next, pre;
                if (n % 8 == 0 || n % 8 == 6)
                {
                    next = n * 4 + 6; pre = next - 1;
                }
                else if (n % 8 == 1 || n % 8 == 7)
                {
                    next = n * 4 - 2; pre = next - 1;
                }
                else
                {
                    next = n * 4 + 2; pre = next - 1;
                }

                for (int i = 0; i < 8; i++)
                {
                    Link dirA = new Link(Config.router.level3RingLinkLatency - 1);
                    Link dirB = new Link(Config.router.level3RingLinkLatency - 1);
                    Link dirC = new Link(Config.router.level3RingLinkLatency - 1);
                    Link dirD = new Link(Config.router.level3RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    links.Add(dirC);
                    links.Add(dirD);

                    L4bridgeRouters[n].LLinkOut[i * 2]        = dirA;
                    L3bridgeRouters[next].GLinkIn[i * 2]      = dirA;
                    L4bridgeRouters[n].LLinkIn[i * 2 + 1]     = dirB;
                    L3bridgeRouters[next].GLinkOut[i * 2 + 1] = dirB;

                    L4bridgeRouters[n].LLinkOut[i * 2 + 1]  = dirC;
                    L3bridgeRouters[pre].GLinkIn[i * 2 + 1] = dirC;
                    L4bridgeRouters[n].LLinkIn[i * 2]       = dirD;
                    L3bridgeRouters[pre].GLinkOut[i * 2]    = dirD;
                }
                int nextL4 = (n + 1) % 8 + n / 8 * 8;
                for (int i = 0; i < 16; i++)
                {
                    Link dirA = new Link(Config.router.level4RingLinkLatency - 1);
                    Link dirB = new Link(Config.router.level4RingLinkLatency - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    L4bridgeRouters[n].GLinkIn[i * 2 + 1]       = dirA;
                    L4bridgeRouters[nextL4].GLinkOut[i * 2 + 1] = dirA;
                    L4bridgeRouters[n].GLinkOut[i * 2]          = dirB;
                    L4bridgeRouters[nextL4].GLinkIn[i * 2]      = dirB;
                }
            }
        }
Example #9
0
        public override void setup()
        {
            // boilerplate
            nodes = new Node[Config.N];
            cache = new CmpCache();
            ParseFinish(Config.finish);
            workload = new Workload(Config.traceFilenames);
            mapping  = new NodeMapping_AllCPU_SharedCache();

            links    = new List <Link>();
            _routers = new BufRingNetwork_Router[Config.N];

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord c = new Coord(n);
                nodes[n]    = new Node(mapping, c);
                _routers[n] = new BufRingNetwork_Router(c);
                _routers[n].setNode(nodes[n]);
                nodes[n].setRouter(_routers[n]);
            }

            int B = Config.bufrings_branching;

            // create the NICs and IRIs
            _nics = new BufRingNetwork_NIC[Config.N * Config.bufrings_n];
            _iris = new BufRingNetwork_IRI[B * Config.bufrings_n];

            // for each copy of the network...
            for (int copy = 0; copy < Config.bufrings_n; copy++)
            {
                // for each local ring...
                for (int ring = 0; ring < B; ring++)
                {
                    // create global ring interface
                    _iris[copy * B + ring] = new BufRingNetwork_IRI(ring);

                    // create local NICs (ring stops)
                    for (int local = 0; local < B; local++)
                    {
                        _nics[copy * Config.N + ring * B + local] = new BufRingNetwork_NIC(ring, local);
                    }
                    // connect with links
                    for (int local = 1; local < B; local++)
                    {
                        Link l = new Link(Config.bufrings_locallat - 1);
                        links.Add(l);
                        _nics[copy * Config.N + ring * B + local - 1].setOutput(l,
                                                                                _nics[copy * Config.N + ring * B + local]);
                        _nics[copy * Config.N + ring * B + local].setInput(l);
                    }
                    Link iriIn = new Link(Config.bufrings_locallat - 1), iriOut = new Link(Config.bufrings_locallat - 1);
                    links.Add(iriIn);
                    links.Add(iriOut);
                    _nics[copy * Config.N + ring * B + B - 1].setOutput(iriIn,
                                                                        _iris[copy * B + ring]);
                    _nics[copy * Config.N + ring * B + 0].setInput(iriOut);

                    _iris[copy * B + ring].setLocalInput(iriIn);
                    _iris[copy * B + ring].setLocalOutput(iriOut,
                                                          _nics[copy * Config.N + ring * B + 0]);
                }

                // connect IRIs with links to make up global ring
                for (int ring = 0; ring < B; ring++)
                {
                    Link globalLink = new Link(Config.bufrings_globallat - 1);
                    links.Add(globalLink);
                    _iris[copy * B + ring].setGlobalOutput(globalLink,
                                                           _iris[copy * B + (ring + 1) % B]);
                    _iris[copy * B + (ring + 1) % B].setGlobalInput(globalLink);
                }

                // add the corresponding NIC to each node/router
                for (int id = 0; id < Config.N; id++)
                {
                    int ring, local;
                    BufRingNetwork_NIC.Map(id, out ring, out local);

                    _routers[id].addNIC(_nics[copy * Config.N + ring * B + local]);
                    _nics[copy * Config.N + ring * B + local].setRouter(_routers[id]);
                }
            }
        }
Example #10
0
      	public override void setup()
       	{
			if (Config.N != 16)
				throw new Exception("HR_Simple only suport 4x4 network");
            nodeRouters = new Router_Node[Config.N];
           	bridgeRouters = new Router_Bridge[4]; 
            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 < 4; 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 || ID == 6 || ID == 8 || ID == 12)
						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;
				}
			}
			for (int n = 0; n < 4; 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) % 4;

				for (int i = 0 ; i < Config.GlobalRingWidth; i++)
				{
					dirA = new Link(2 - 1);
					dirB = new Link(2 - 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;
				}
			}
       	}
Example #11
0
        public override void setup()
        {
            // boilerplate
            nodes = new Node[Config.N];
            cache = new CmpCache();
            ParseFinish(Config.finish);
            workload = new Workload(Config.traceFilenames);
            mapping = new NodeMapping_AllCPU_SharedCache();

            links = new List<Link>();
            _routers = new BufRingNetwork_Router[Config.N];

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord c = new Coord(n);
                nodes[n] = new Node(mapping, c);
                _routers[n] = new BufRingNetwork_Router(c);
                _routers[n].setNode(nodes[n]);
                nodes[n].setRouter(_routers[n]);
            }

            int B = Config.bufrings_branching;

            // create the NICs and IRIs
            _nics = new BufRingNetwork_NIC[Config.N * Config.bufrings_n];
            _iris = new BufRingNetwork_IRI[B * Config.bufrings_n];

            // for each copy of the network...
            for (int copy = 0; copy < Config.bufrings_n; copy++) {

                // for each local ring...
                for (int ring = 0; ring < B; ring++) {

                    // create global ring interface
                    _iris[copy*B + ring] = new BufRingNetwork_IRI(ring);

                    // create local NICs (ring stops)
                    for (int local = 0; local < B; local++)
                        _nics[copy*Config.N + ring*B + local] = new BufRingNetwork_NIC(ring, local);
                    // connect with links
                    for (int local = 1; local < B; local++)
                    {
                        Link l = new Link(Config.bufrings_locallat - 1);
                        links.Add(l);
                        _nics[copy*Config.N + ring*B + local - 1].setOutput(l,
                                _nics[copy*Config.N + ring*B + local]);
                        _nics[copy*Config.N + ring*B + local].setInput(l);
                    }
                    Link iriIn = new Link(Config.bufrings_locallat - 1), iriOut = new Link(Config.bufrings_locallat - 1);
                    links.Add(iriIn);
                    links.Add(iriOut);
                    _nics[copy*Config.N + ring*B + B-1].setOutput(iriIn,
                            _iris[copy*B + ring]);
                    _nics[copy*Config.N + ring*B + 0].setInput(iriOut);

                    _iris[copy*B + ring].setLocalInput(iriIn);
                    _iris[copy*B + ring].setLocalOutput(iriOut,
                            _nics[copy*Config.N + ring*B + 0]);

                }

                // connect IRIs with links to make up global ring
                for (int ring = 0; ring < B; ring++) {
                    Link globalLink = new Link(Config.bufrings_globallat - 1);
                    links.Add(globalLink);
                    _iris[copy*B + ring].setGlobalOutput(globalLink,
                            _iris[copy*B + (ring+1)%B]);
                    _iris[copy*B + (ring+1)%B].setGlobalInput(globalLink);
                }

                // add the corresponding NIC to each node/router
                for (int id = 0; id < Config.N; id++) {
                    int ring, local;
                    BufRingNetwork_NIC.Map(id, out ring, out local);

                    _routers[id].addNIC(_nics[copy * Config.N + ring*B + local]);
                    _nics[copy * Config.N + ring*B + local].setRouter(_routers[id]);
                }
            }

        }
Example #12
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;
                }
            }
        }
Example #13
0
        public override void setup()
        {
            if (Config.N != 64)
            {
                throw new Exception("HR_8_16drop only suport 8x8 network");
            }
            nodeRouters   = new Router_Node[Config.N];
            bridgeRouters = new Router_Bridge[16];
            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 < 16; 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 < 8; i++)
                {
                    int ID = n * 8 + i;
                    if (ID % 2 == 1)
                    {
                        continue;
                    }
                    int  next = ID + 1;
                    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 [] Gnext = { 2, 5, 4, 1, 6, 7, 10, 9, 14, 11, 8, 15, 0, 3, 12, 13 };
            for (int n = 0; n < 16; n++)
            {
                int  next = n * 2;
                int  pre  = (next - 1 + 8) % 8 + n / 4 * 8;
                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[next].linkIn[CW]   = dirA;
                bridgeRouters[n].LLinkIn[CCW]  = dirB;
                nodeRouters[next].linkOut[CCW] = dirB;

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

                for (int i = 0; i < Config.GlobalRingWidth; i++)
                {
                    dirA = new Link(2 - 1);
                    dirB = new Link(2 - 1);
                    links.Add(dirA);
                    links.Add(dirB);
                    bridgeRouters[n].GLinkIn[i * 2 + 1]         = dirA;
                    bridgeRouters[Gnext[n]].GLinkOut[i * 2 + 1] = dirA;
                    bridgeRouters[n].GLinkOut[i * 2]            = dirB;
                    bridgeRouters[Gnext[n]].GLinkIn[i * 2]      = dirB;
                }
            }
        }
Example #14
0
        public override void setup()
        {
            if (Config.network_nrX != 4 && Config.network_nrY != 4)
            {
                throw new Exception("buffered hierarchical ring only support 4x4 network");
            }
            nics  = new Router_NIC[Config.N];
            iris  = new Router_IRI[4];
            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);
                nodes[n] = new Node(mapping, c);
                nics[n]  = new Router_NIC(c);
                nodes[n].setRouter(nics[n]);
                nics[n].setNode(nodes[n]);
            }
            for (int n = 0; n < 4; n++)
            {
                iris[n] = new Router_IRI(n);
            }

            for (int group = 0; group < 4; group++)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (i == 3)
                    {
                        continue;
                    }
                    int  node = group * 4 + i;
                    Link dirA = new Link(Config.router.switchLinkLatency - 1);
                    links.Add(dirA);
                    nics[node].linkOut[0]    = dirA;
                    nics[node + 1].linkIn[0] = dirA;
                }

                Link dirD = new Link(Config.router.switchLinkLatency - 1);
                Link dirB = new Link(Config.router.switchLinkLatency - 1);
                links.Add(dirB);
                links.Add(dirD);
                nics[group * 4 + 3].linkOut[0] = dirD;
                iris[group].LLinkIn[0]         = dirD;
                nics[group * 4].linkIn[0]      = dirB;
                iris[group].LLinkOut[0]        = dirB;
                int  next = (group + 1) % 4;
                Link dirC = new Link(Config.router.level1RingLinkLatency - 1);
                links.Add(dirC);
                iris[group].GLinkOut[0] = dirC;
                iris[next].GLinkIn[0]   = dirC;
            }
        }
Example #15
0
        public override void setup()
        {
            nodeRouters    = new Router_Node[Config.N];
            connectRouters = new Router_Connect[Config.N / 2]; // some of the connectRouters may be disabled
            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]);
            }
            // connectRouters are numbered by sweeping x, with y increase in steps
            // disable the routers not needed here. Different topologies can be realised. (mesh, torus)
            for (int n = 0; n < Config.N / 2; n++)
            {
                connectRouters[n] = new Router_Connect(n);

                /*if (n == 0 || n == 1 || n == 2 || n == 3 ||
                 * n == 32 || n == 33 || n == 34 || n == 35)
                 * connectRouters[n].enable = false;
                 * if (n == 4 || n == 12 || n == 20 || n == 28)
                 * connectRouters[n].enable = false;*/
            }
            if (Config.RC_mesh)
            {
                for (int i = 0; i < Config.network_nrX / 2; i++)
                {
                    connectRouters[i].enable = false;
                }
                for (int i = 0; i < Config.network_nrY / 2; i++)
                {
                    connectRouters[Config.network_nrX * i + Config.network_nrX / 2].enable = false;
                }
            }
            if (Config.RC_Torus)
            {
                // all connection Routers are enabled. Both horizontally and vertically.
                ;
            }
            if (Config.RC_x_Torus)
            {
                for (int i = 0; i < Config.network_nrX / 2; i++)
                {
                    connectRouters[i].enable = false;
                }
            }

//			Console.WriteLine("test");
            if (Config.RouterEvaluation)
            {
                return;
            }

            // connect the network with Links
            for (int y = 0; y < Y / 2; y++)
            {
                for (int x = 0; x < X / 2; x++)
                {
                    for (int z = 0; z < 4; z++)
                    {
                        int nextCRouter = -1;
                        int preCRouter  = -1;
                        switch (z)
                        {
                        case 0: { nextCRouter = x + X * y + X / 2; preCRouter = x + X * y; break; }

                        case 1: { nextCRouter = (x + X * (y + 1)) % (Config.N / 2); preCRouter = x + X * y + X / 2; break; }

                        case 2: { nextCRouter = (x + 1) % (X / 2) + X * y + X / 2; preCRouter = (x + X * (y + 1)) % (Config.N / 2); break; }

                        case 3: { nextCRouter = x + X * y; preCRouter = (x + 1) % (X / 2) + X * y + X / 2; break; }
                        }


                        if (connectRouters[nextCRouter].enable)                 // clockwise: the connectRouter next to z = 0
                        {
                            Link dirA = new Link(Config.router.linkLatency_N2R - 1);
                            Link dirB = new Link(Config.router.linkLatency_N2R - 1);
                            links.Add(dirA);
                            links.Add(dirB);
                            int port = ((z - 1) < 0) ? z + 3 : z - 1;
                            //	Console.WriteLine("x:{0},y:{1},z:{2}, ID:{3}", x, y, z, RC_Coord.getIDfromXYZ(x, y, z));
                            //	Console.WriteLine("node:{0}, next_id:{1}, port{2}", RC_Coord.getIDfromXYZ(x, y, z), nextCRouter, port);
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CW] = dirA;
                            connectRouters[nextCRouter].linkIn[port] = dirA;
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CCW] = dirB;
                            connectRouters[nextCRouter].linkOut[port] = dirB;
                        }
                        else                  // the router is not enabled : does not exist
                        {
                            Link dirA = new Link(Config.router.linkLatency_N2N - 1);
                            Link dirB = new Link(Config.router.linkLatency_N2N - 1);
                            links.Add(dirA);
                            links.Add(dirB);
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CW]            = dirA;
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, (z + 1) % 4)].linkIn[CW]   = dirA;
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CCW]            = dirB;
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, (z + 1) % 4)].linkOut[CCW] = dirB;
                            //Console.WriteLine("node:{0}, wire to node:{1}", RC_Coord.getIDfromXYZ(x, y, z), RC_Coord.getIDfromXYZ(x, y, (z+1) % 4));
                        }
                        if (connectRouters[preCRouter].enable)
                        {
                            Link dirA = new Link(Config.router.linkLatency_N2R - 1);
                            Link dirB = new Link(Config.router.linkLatency_N2R - 1);
                            links.Add(dirA);
                            links.Add(dirB);
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkOut[CCW] = dirA;
                            connectRouters[preCRouter].linkIn[(z + 1) % 4]           = dirA;
                            nodeRouters[RC_Coord.getIDfromXYZ(x, y, z)].linkIn[CW]   = dirB;
                            connectRouters[preCRouter].linkOut[(z + 1) % 4]          = dirB;
                            //Console.WriteLine("node:{0}, pre_id:{1}, port{2}", RC_Coord.getIDfromXYZ(x, y, z), preCRouter, port);
                        }
                    }
                }
            }
            int PHnumber = Config.PlaceHolderNum;

            while (PHnumber > 0)
            {
                PHnumber--;
                Flit f1 = new Flit(null, 0);                  // generate a placeholder flit
                Flit f2 = new Flit(null, 0);
                f1.state = Flit.State.Placeholder;
                f2.state = Flit.State.Placeholder;
                nodeRouters[PHnumber].linkOut[0].In = f1;
                nodeRouters[PHnumber].linkOut[1].In = f2;
            }
        }
Example #16
0
      	public override void setup()
       	{
			if (Config.N != 1024)
				throw new Exception("HR_16_8drop only suport 8x8 network");
            nodeRouters = new Router_Node[Config.N];
           	L1bridgeRouters = new Router_Bridge[512];
			L2bridgeRouters = new Router_Bridge[128];
			L3bridgeRouters = new Router_Bridge[32];
			L4bridgeRouters = 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 < 512; n++)
            	L1bridgeRouters[n] = new Router_Bridge(n, 2, 1);
			for (int n = 0; n < 128; n++)
				L2bridgeRouters[n] = new Router_Bridge(n, 4, 2, 2, 8);
			for (int n = 0; n < 32; n++)
				L3bridgeRouters[n] = new Router_Bridge(n, 8, 4, 4, 16);
			for (int n = 0; n < 8; n++)
				L4bridgeRouters[n] = new Router_Bridge(n, 16, 8, 8, 32);
            // connect the network with Links
            for (int n = 0; n < 256; 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;
				}
			}

			// connect L1 bridge Routers
			for (int n = 0; n < 512; n++)
			{
				int ID = n;
				int next, pre;
				if (ID % 8 == 0 || ID % 8 == 6) { next = ID * 2 + 3; pre = ID * 2 + 2; }
				else if (ID % 8 == 1 || ID % 8 == 7) {next = ID * 2 - 1; pre = ID * 2 - 2; }
				else { next = ID * 2 + 1; pre = ID * 2;}

				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);
				L1bridgeRouters[n].LLinkOut[CW] = dirA;
				nodeRouters[next].linkIn[CW] = dirA;
				L1bridgeRouters[n].LLinkIn[CCW] = dirB;
				nodeRouters[next].linkOut[CCW] = dirB;

				L1bridgeRouters[n].LLinkOut[CCW] = dirC;
				nodeRouters[pre].linkIn[CCW] = dirC;
				L1bridgeRouters[n].LLinkIn[CW] = dirD;
				nodeRouters[pre].linkOut[CW] = dirD;
				
				int nextL1 = (n + 1) % 8 + n / 8 * 8;
				if (ID % 8 == 1 || ID % 8 == 5)
					continue;
				for (int i = 0 ; i < 2; i++)
				{
					dirA = new Link(Config.router.level1RingLinkLatency - 1);
					dirB = new Link(Config.router.level1RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					L1bridgeRouters[n].GLinkIn[i*2+1] = dirA;
					L1bridgeRouters[nextL1].GLinkOut[i*2+1] = dirA;
					L1bridgeRouters[n].GLinkOut[i*2] = dirB;
					L1bridgeRouters[nextL1].GLinkIn[i*2] = dirB;
				}
			}			
			// connect L2 bridge Routers
			for (int n = 0; n < 128; n++)
			{
				int next, pre;
				if (n % 8 == 0 || n % 8 == 6) {next = n * 4 + 6; pre = next - 1; }
				else if (n % 8 == 1 || n % 8 == 7) {next = n * 4 - 2; pre = next - 1;}
				else {next = n * 4 + 2; pre = next - 1;}
				
				for (int i = 0; i < 2; i++)
				{
					Link dirA = new Link(Config.router.level1RingLinkLatency - 1);
					Link dirB = new Link(Config.router.level1RingLinkLatency - 1);
					Link dirC = new Link(Config.router.level1RingLinkLatency - 1);
					Link dirD = new Link(Config.router.level1RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					links.Add(dirC);
					links.Add(dirD);
	
					L2bridgeRouters[n].LLinkOut[i * 2] = dirA;
					L1bridgeRouters[next].GLinkIn[i * 2] = dirA;
					L2bridgeRouters[n].LLinkIn[i * 2 + 1] = dirB;
					L1bridgeRouters[next].GLinkOut[i * 2 + 1] = dirB;

					L2bridgeRouters[n].LLinkOut[i * 2 + 1] = dirC;
					L1bridgeRouters[pre].GLinkIn[i * 2 + 1] = dirC;
					L2bridgeRouters[n].LLinkIn[i * 2] = dirD;
					L1bridgeRouters[pre].GLinkOut[i * 2] = dirD;
				}
				int nextL2 = (n + 1) % 8 + n / 8 * 8;
				if (n % 8 == 1 || n % 8 == 5)
					continue;
				for (int i = 0; i < 4; i++)
				{
					Link dirA = new Link(Config.router.level2RingLinkLatency - 1);
					Link dirB = new Link(Config.router.level2RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					L2bridgeRouters[n].GLinkIn[i*2+1] = dirA;
					L2bridgeRouters[nextL2].GLinkOut[i*2+1] = dirA;
					L2bridgeRouters[n].GLinkOut[i*2] = dirB;
					L2bridgeRouters[nextL2].GLinkIn[i*2] = dirB;
				}
			}			
			//connect L3 bridge Routers
			for (int n = 0; n < 32; n++)
			{
				int next, pre;
				if (n % 8 == 0 || n % 8 == 6) {next = n * 4 + 6; pre = next - 1;}
				else if (n % 8 == 1 || n % 8 == 7) {next = n * 4 - 2; pre = next - 1;}
				else {next = n * 4 + 2; pre = next - 1;}

				for (int i = 0; i < 4; i++)
				{	
					Link dirA = new Link(Config.router.level2RingLinkLatency - 1);
					Link dirB = new Link(Config.router.level2RingLinkLatency - 1);
					Link dirC = new Link(Config.router.level2RingLinkLatency - 1);
					Link dirD = new Link(Config.router.level2RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					links.Add(dirC);
					links.Add(dirD);

					L3bridgeRouters[n].LLinkOut[i*2] = dirA;
					L2bridgeRouters[next].GLinkIn[i*2] = dirA;
					L3bridgeRouters[n].LLinkIn[i*2+1] = dirB;
					L2bridgeRouters[next].GLinkOut[i*2+1] = dirB;

					L3bridgeRouters[n].LLinkOut[i * 2 + 1] = dirC;
					L2bridgeRouters[pre].GLinkIn[i * 2 + 1] = dirC;
					L3bridgeRouters[n].LLinkIn[i * 2] = dirD;
					L2bridgeRouters[pre].GLinkOut[i * 2] = dirD;
				}				
				int nextL3 = (n+1) % 8 + n / 8 * 8;
				if (n % 8 == 1 || n % 8 == 5)
					continue;
				for (int i = 0; i < 8; i++)
				{
					Link dirA = new Link(Config.router.level3RingLinkLatency - 1);
					Link dirB = new Link(Config.router.level3RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					L3bridgeRouters[n].GLinkIn[i*2+1] = dirA;
					L3bridgeRouters[nextL3].GLinkOut[i*2+1] = dirA;
					L3bridgeRouters[n].GLinkOut[i*2] = dirB;
					L3bridgeRouters[nextL3].GLinkIn[i*2] = dirB;
				}
			}
			//connect L4 bridge Routers
			for (int n = 0; n < 8; n++)
			{
				int next, pre;
				if (n % 8 == 0 || n % 8 == 6) {next = n * 4 + 6; pre = next - 1;}
				else if (n % 8 == 1 || n % 8 == 7) {next = n * 4 - 2; pre = next - 1;}
				else {next = n * 4 + 2; pre = next - 1;}

				for (int i = 0; i < 8; i++)
				{	
					Link dirA = new Link(Config.router.level3RingLinkLatency - 1);
					Link dirB = new Link(Config.router.level3RingLinkLatency - 1);
					Link dirC = new Link(Config.router.level3RingLinkLatency - 1);
					Link dirD = new Link(Config.router.level3RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					links.Add(dirC);
					links.Add(dirD);

					L4bridgeRouters[n].LLinkOut[i*2] = dirA;
					L3bridgeRouters[next].GLinkIn[i*2] = dirA;
					L4bridgeRouters[n].LLinkIn[i*2+1] = dirB;
					L3bridgeRouters[next].GLinkOut[i*2+1] = dirB;

					L4bridgeRouters[n].LLinkOut[i * 2 + 1] = dirC;
					L3bridgeRouters[pre].GLinkIn[i * 2 + 1] = dirC;
					L4bridgeRouters[n].LLinkIn[i * 2] = dirD;
					L3bridgeRouters[pre].GLinkOut[i * 2] = dirD;
				}				
				int nextL4 = (n+1) % 8 + n / 8 * 8;
				for (int i = 0; i < 16; i++)
				{
					Link dirA = new Link(Config.router.level4RingLinkLatency - 1);
					Link dirB = new Link(Config.router.level4RingLinkLatency - 1);
					links.Add(dirA);
					links.Add(dirB);
					L4bridgeRouters[n].GLinkIn[i*2+1] = dirA;
					L4bridgeRouters[nextL4].GLinkOut[i*2+1] = dirA;
					L4bridgeRouters[n].GLinkOut[i*2] = dirB;
					L4bridgeRouters[nextL4].GLinkIn[i*2] = dirB;
				}
			}

       	}
Example #17
0
        public override void setup()
        {
            // boilerplate
            nodes = new Node[Config.N];
            cache = new CmpCache();
            ParseFinish(Config.finish);
            workload = new Workload(Config.traceFilenames);
            mapping = new NodeMapping_AllCPU_SharedCache();

            _nics = new List<BufRingMultiNetwork_NIC>();
            _iris = new List<BufRingMultiNetwork_IRI>();

            links = new List<Link>();
            _routers = new BufRingMultiNetwork_Router[Config.N];

            //Console.WriteLine("setup: N = {0}", Config.N);

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord c = new Coord(n);
                nodes[n] = new Node(mapping, c);
                _routers[n] = new BufRingMultiNetwork_Router(c);
                _routers[n].setNode(nodes[n]);
                nodes[n].setRouter(_routers[n]);
            }

            // for each copy of the network...
            for (int copy = 0; copy < Config.bufrings_n; copy++) {
                BufRingMultiNetwork_Coord c = new BufRingMultiNetwork_Coord(0, 0);
                BufRingMultiNetwork_IRI iri;
                int count;
                setup_ring(c, 0, out iri, out count);
            }

        }