Skip to content

ESYNet User Manual : Simulation Engine

wangeddie67 edited this page May 1, 2019 · 34 revisions

ESYNet utilizes an event-driven simulation engine to perform the cycle-accurate simulation. In this chapter, we first introduce the conception of event-driven simulation. After that, we introduce how ESYNet implements the simulation engine.

Event-driven Simulation

The event-driven simulator consists of a simulation engine and simulation components. Simulation engine drives the simulation process forward while simulation components store the status and do the operations. In ESYNet, simulation components contain the components in the NoC.

The kernel of the simulation engine is the event queue which stores in the event in the order of increasing time. The event is an abstraction of simulation operations. The time determines when the simulation engine should respond to the specified event.

During the simulation, the simulation engine takes out the first event in the event queue and calls suitable simulation components to respond to the event. Simulation components receive the event and change their status and generate new events if necessary. The new events are inserted back to the event queue.

The simulation engine continues the iteration until all the events in the event queue have been responded. Thus, if the event queue is empty, the simulation is finished. When the simulation starts, the first event should be inserted to the event queue so that the simulation can start. If the event queue is empty, the simulation is finished.

The simulation time depends on the number of events. For example, if the NoC is not under heavy traffic, the simulation time can be very fast because there is not much event. On the other hand, the simulation accuracy depends on the fine-grain of event definitions.

Event definition in ESYNet

ESYNet defines five events, includes: packet generation (EVG), router pipeline (ROUTER), link transmission (WIRE), credit transmission (CREDIT) and NI read (NIREAD).

ESYNet provides EsynetMessEvent to define the event structure. The class is defined in esynet_mess_event.h and esynet_mess_event.cc. m_event_time means the time when the simulation engine should respond to this event. The events are ordered by this field. m_mess_type means the event type. The group of m_src_id, m_src_pc and m_src_vc as well as the group of m_des_id, m_des_pc and m_des_vc specify which simulation component should be called to respond this event. Each event structure contains a field of flit structure to store more information. The flit structure is defined in esynet_flit.h and described in .

Packet generation event

Packet generation event (EVG) means a new packet should be injected into the network. EVG events are generated by the traffic generator or integration API.

EsynetMessEvent provides generateEvgMessage to generate a EVG event. It should provides following information.

Fields Data type NOTE
m_event_time double The injection time of the packet.
m_mess_type long EVG.
m_src_id long Source router id.
m_des_id long Destination router id.
m_flit EsynetFlit The head flit of new packet.
m_flit.m_flit_id long Packet id.
m_flit.m_flit_size long Packet size in flit.
m_flit.m_flit_type FlitType EsynetFlit::FLIT_HEAD.
m_flit.m_sor_addr long Source router id.
m_flit.m_des_addr long Destination router id.
m_flit.m_des_addr long Destination router id.
m_flit.m_flit_flag long Flit flags. Set FLIT_ACK if the packet is acknowledge packet.
m_flit.m_flit_start_time double The injection time of the packet.
m_flit.m_e2e_start_time double The end-to-end injection time of the packet. If the packet is a ACK packet, the end-to-end injection time is the injection time of the first packet; if the packet is retransmission packet, the end-to-end injection time should be the injection time of the first-time transmission.
m_flit.m_ack_packet long The id of the normal packet if this packet is a ACK packet.

The simulation enigne calls the NI connects to the router specified by m_des_id to respond EVG event. NI will generate all the flits for the packets and stored flits in the injection queue. See also for more information.

Router pipeline

Router pipeline event (ROUTER) means one clock cycle for the pipeline in the router. ROUTER event provides the ability for ESYNet to perform the cycle-accuracy simulation. ROUTER events are gnerated by the simulation engine itself.

EsynetMessEvent provides generateRouterMessage to generate a ROUTER event. It should provides following information.

Fields Data type NOTE
m_event_time double The simulation cycle.
m_pipe_time double The period of the pipeline in cycle.
m_mess_type long ROUTER.
m_src_id long Specified router to respond this event. Default value is -1.

ROUTER event is the first event in the event queue and it is inserted when the simulation starts. During the simulation, simulation engine generates next ROUTER event when it responds to one ROUTER event. The simulation cycle of the next ROUTER is calculated by added m_pipe_time to m_event_time. By default, the simulation engine calls all the routers and NIs to respond ROUTER event. Each router and NI does the pipeline once when they receives ROUTER event. See also for more information.

ESYNet can support multi-clock-domains in NoC which means simulation components should not respond ROUTER event at the same time. ESYNet designs following rules to handle multi-clock-domains:

  • The basic clock period is 1.0 cycle. One ROUTER event with m_pipe_time as 1.0 can trigger all routers and NIs within the base clock domain.
  • Other clock period is measured by the basic clock period. One ROUTER event with m_pipe_time not as 1.0 can only trigger the router and NI specified by m_src_id.