示例#1
0
        public void doStep()
        {
            if (Config.synthGen)
            {
                synthGen(Config.synthRate);
            }

            while (m_local.Count > 0 &&
                   m_local.Peek().creationTime < Simulator.CurrentRound)
            {
                receivePacket(m_local.Dequeue());
            }

            if (m_cpu != null)
            {
                m_cpu.doStep();
            }
            if (m_mem != null)
            {
                m_mem.doStep();
            }

            Packet p = m_inj_pool.next();

            if (p != null)
            {
                foreach (Flit f in p.flits)
                {
                    m_injQueue_flit.Enqueue(f);
                }
            }

            if (m_injQueue_evict.Count > 0 && m_router.canInjectFlit(m_injQueue_evict.Peek()))
            {
                Flit f = m_injQueue_evict.Dequeue();
                m_router.InjectFlit(f);
            }

            else if (m_injQueue_flit.Count > 0 && m_router.canInjectFlit(m_injQueue_flit.Peek()))
            {
                Flit f = m_injQueue_flit.Dequeue();
#if PACKETDUMP
                if (f.flitNr == 0)
                {
                    if (m_coord.ID == 0)
                    {
                        Console.WriteLine("start to inject packet {0} at node {1} (cyc {2})",
                                          f.packet, coord, Simulator.CurrentRound);
                    }
                }
#endif
                m_router.InjectFlit(f);
            }
        }
示例#2
0
        public void doStep()
        {
            while (m_local.Count > 0 &&
                   m_local.Peek().creationTime < Simulator.CurrentRound)
            {
                receivePacket(m_local.Dequeue());
            }

            if (m_cpu != null)
            {
                m_cpu.doStep();
            }
            if (m_mem != null)
            {
                m_mem.doStep();
            }

            if (m_inj_pool.FlitInterface)
            {
                Flit f = m_inj_pool.peekFlit();
                if (f != null && m_router.canInjectFlit(f))
                {
                    m_router.InjectFlit(f);
                    m_inj_pool.takeFlit();
                }
            }
            else
            {
                Packet p = m_inj_pool.next();
                if (p != null)
                {
                    foreach (Flit f in p.flits)
                    {
                        m_injQueue_flit.Enqueue(f);
                    }
                }

                if (m_injQueue_evict.Count > 0 && m_router.canInjectFlit(m_injQueue_evict.Peek()))
                {
                    Flit f = m_injQueue_evict.Dequeue();
                    m_router.InjectFlit(f);
                }
                else if (m_injQueue_flit.Count > 0 && m_router.canInjectFlit(m_injQueue_flit.Peek()))
                {
                    Flit f = m_injQueue_flit.Dequeue();
#if PACKETDUMP
                    if (f.flitNr == 0)
                    {
                        if (m_coord.ID == 0)
                        {
                            Console.WriteLine("start to inject packet {0} at node {1} (cyc {2})",
                                              f.packet, coord, Simulator.CurrentRound);
                        }
                    }
#endif

                    m_router.InjectFlit(f);
                    // for Ring based Network, inject two flits if possible
                    for (int i = 0; i < Config.RingInjectTrial - 1; i++)
                    {
                        if (m_injQueue_flit.Count > 0 && m_router.canInjectFlit(m_injQueue_flit.Peek()))
                        {
                            f = m_injQueue_flit.Dequeue();
                            m_router.InjectFlit(f);
                        }
                    }
                }
            }
        }