public BufRingMultiNetwork_IRI(BufRingMultiNetwork_Coord c) { _coord = c; //Console.WriteLine("new IRI: coord {0}", c); _bufGL = new Queue <Flit>(); _bufLG = new Queue <Flit>(); _bufL = new Queue <Flit>(); _bufG = new Queue <Flit>(); _creditGL = Config.bufrings_G2L; _creditLG = Config.bufrings_L2G; _creditL = Config.bufrings_localbuf; _creditG = Config.bufrings_globalbuf; _localBack = new BufRingMultiNetwork_IRI_LocalPort(this); _globalBack = new BufRingMultiNetwork_IRI_GlobalPort(this); }
public BufRingMultiNetwork_IRI(BufRingMultiNetwork_Coord c) { _coord = c; //Console.WriteLine("new IRI: coord {0}", c); _bufGL = new Queue<Flit>(); _bufLG = new Queue<Flit>(); _bufL = new Queue<Flit>(); _bufG = new Queue<Flit>(); _creditGL = Config.bufrings_G2L; _creditLG = Config.bufrings_L2G; _creditL = Config.bufrings_localbuf; _creditG = Config.bufrings_globalbuf; _localBack = new BufRingMultiNetwork_IRI_LocalPort(this); _globalBack = new BufRingMultiNetwork_IRI_GlobalPort(this); }
public bool doStep() { bool somethingMoved = false; // handle inputs // global input if (_gin.Out != null) { Flit f = _gin.Out; _gin.Out = null; MyTracer.trace(f, "IRI global input", _coord); somethingMoved = true; if (_coord.routeL(f.bufrings_coord)) { _bufGL.Enqueue(f); MyTracer.trace(f, String.Format("IRI global->local transfer, queue length {0}", _bufLG.Count), _coord); Simulator.stats.bufrings_iri_enqueue_gl[_coord.level].Add(); } else { _bufG.Enqueue(f); Simulator.stats.bufrings_iri_enqueue_g[_coord.level].Add(); } } // local input if (_lin.Out != null) { Flit f = _lin.Out; _lin.Out = null; MyTracer.trace(f, "IRI local input", _coord); somethingMoved = true; if (_coord.routeG(f.bufrings_coord)) { _bufLG.Enqueue(f); MyTracer.trace(f, String.Format("IRI local->global transfer, queue length {0}", _bufLG.Count), _coord); Simulator.stats.bufrings_iri_enqueue_lg[_coord.level].Add(); } else { _bufL.Enqueue(f); Simulator.stats.bufrings_iri_enqueue_l[_coord.level].Add(); } } // handle outputs // global output (on-ring traffic) if (_gout.In == null && _bufG.Count > 0) { Flit f = _bufG.Peek(); if (_downstreamG.getCredit(f, 0)) { _bufG.Dequeue(); Simulator.stats.bufrings_iri_dequeue_g[_coord.level].Add(); _creditG++; _gout.In = f; somethingMoved = true; } } // global output (transfer traffic) if (_gout.In == null && _bufLG.Count > 0) { Flit f = _bufLG.Peek(); if (_downstreamG.getCredit(f, (_coord.coord.Length - _coord.level))) // bubble flow control: black magic { _bufLG.Dequeue(); Simulator.stats.bufrings_iri_dequeue_lg[_coord.level].Add(); _creditLG++; _gout.In = f; somethingMoved = true; } } // local output (transfer traffic) if (_lout.In == null && _bufGL.Count > 0) { Flit f = _bufGL.Peek(); if (_downstreamL.getCredit(f, 0)) { _bufGL.Dequeue(); Simulator.stats.bufrings_iri_dequeue_gl[_coord.level].Add(); _creditGL++; _lout.In = f; somethingMoved = true; } else { BufRingMultiNetwork_IRI_GlobalPort i = _downstreamL as BufRingMultiNetwork_IRI_GlobalPort; #if DEBUG Console.WriteLine("GL block at IRI {0} flit {1}.{2} cycle {3} downstream is IRI {4}", _coord, f.packet.ID, f.flitNr, Simulator.CurrentRound, (i != null) ? i._iri._coord.ToString() : "(nic)"); #endif } } // local output (on-ring traffic) if (_lout.In == null && _bufL.Count > 0) { Flit f = _bufL.Peek(); if (_downstreamL.getCredit(f, 0)) { _bufL.Dequeue(); Simulator.stats.bufrings_iri_dequeue_l[_coord.level].Add(); _creditL++; _lout.In = f; somethingMoved = true; } } if (_gout.In != null) { Simulator.stats.bufrings_link_traverse[_coord.level].Add(); } if (_lout.In != null) { Simulator.stats.bufrings_link_traverse[_coord.level + 1].Add(); } Simulator.stats.bufrings_iri_occupancy_g[_coord.level].Add(_bufG.Count); Simulator.stats.bufrings_iri_occupancy_l[_coord.level].Add(_bufL.Count); Simulator.stats.bufrings_iri_occupancy_gl[_coord.level].Add(_bufGL.Count); Simulator.stats.bufrings_iri_occupancy_lg[_coord.level].Add(_bufLG.Count); Simulator.stats.bufrings_ring_util[_coord.level].Add(_gout.In != null ? 1 : 0); return(somethingMoved); }