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 Router_Node(RC_Coord RC_c, Coord c) : base(c) { linkOut = new Link[2]; linkIn = new Link[2]; m_injectSlot_CW = null; m_injectSlot_CCW = null; ejectBuffer = new Queue<Flit> [2]; for (int i = 0; i < 2; i++) ejectBuffer[i] = new Queue<Flit>(); throttle[ID] = false; starved[ID] = false; starveCounter = 0; }
public Router_Node(RC_Coord RC_c, Coord c) : base(c) { linkOut = new Link[2]; linkIn = new Link[2]; m_injectSlot_CW = null; m_injectSlot_CCW = null; rc_coord = RC_c; ejectBuffer = new Queue <Flit> [2]; for (int i = 0; i < 2; i++) { ejectBuffer[i] = new Queue <Flit>(); } throttle[ID] = false; starved[ID] = false; starveCounter = 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 Router_Node_Buffer(RC_Coord RC_c, Coord c) : base(c) { linkOut = new Link[2]; linkIn = new Link[2]; m_injectSlot_CW = null; m_injectSlot_CCW = null; rc_coord = RC_c; ejectBuffer = new Queue <Flit> [2]; for (int i = 0; i < 2; i++) { ejectBuffer[i] = new Queue <Flit>(); } throttle[ID] = false; starved[ID] = false; starveCounter = 0; m_ringBuf = new WormholeBuffer[2]; for (int i = 0; i < 2; i++) { m_ringBuf[i] = new WormholeBuffer(Config.ringBufferSize); } }
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; } } }
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; } }
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() { 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); } }
public Router_Node_Buffer(RC_Coord RC_c, Coord c) : base(c) { linkOut = new Link[2]; linkIn = new Link[2]; m_injectSlot_CW = null; m_injectSlot_CCW = null; ejectBuffer = new Queue<Flit> [2]; for (int i = 0; i < 2; i++) ejectBuffer[i] = new Queue<Flit>(); throttle[ID] = false; starved[ID] = false; starveCounter = 0; m_ringBuf = new WormholeBuffer[2]; for (int i = 0; i < 2; i++) m_ringBuf[i] = new WormholeBuffer(Config.ringBufferSize); }
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; } } }
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; } } }
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; } } }
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; } } }