-
Notifications
You must be signed in to change notification settings - Fork 13
ESYNet User Manual : Simulation Engine
ESYNet utilizes an event-driven simulation engine to perform the cycle-accurate simulation.
graph TD
A-->B
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 include routers and network interfaces.
The kernel of the simulation engine is the event queue which stores the events 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 corresponding simulation components to respond to the event. Simulation components receive the event and perform the correct function. After that, simulation components 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. The simulation stops if the event queue is empty.
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.
ESYNet provides EsynetEventQueue
as the event queue. Event queue inherits from STL multiset
so that it can automatically sort items within the event queue. The key is the time when to pop the event from the queue.
ESYNet provides EsynetSimBaseUnit
as the base-class for simulation components. The simulation components must inherit from EsynetSimBaseUnit
. Otherwise, they cannot be called by the event queue. Currently, ESYNet provides three simulation components:
-
EsynetFoundation
: Network platform, includes all routers and NIs. -
EsynetRouter
: Router structure. -
EsynetNI
: NI structure.
During the simulation, EsynetEventQueue
pops the first event from the event queue. Then, EsynetEventQueue
calls EsynetFoundation
to response this event. EsynetFoundation
distinguishes the type of the event and calls a corresponding router or NI to respond to the event. Further, EsynetRouter
and EsynetNI
perform the function related to the event. When handle event, simulation components may generate new events. These new events are collected and injected into the event queue as well.
ESYNet provides EsynetEvent
to store the information for different events.
Packet generation event (EVG) means a new packet should be injected into the network. The traffic generator or integration APIs generate EVG events.
EsynetEvent
provides EsynetEvent::generateEvgEvent
to generate a EVG event. EVG event should provides the following information.
Fields | Data type | Note |
---|---|---|
EsynetEvent::m_event_time |
double |
The injection time of the packet. |
EsynetEvent::m_event_type |
long |
EsynetEvent::EVG . |
EsynetEvent::m_src_id |
long |
Source router id. |
EsynetEvent::m_des_id |
long |
Destination router id. |
EsynetEvent::m_flit |
EsynetFlit |
The head flit of new packet. |
EsynetEvent::m_flit
should provide the following information.
Fields | Data type | Note |
---|---|---|
EsynetFlit::m_id |
long |
Packet id. |
EsynetFlit::m_pac_size |
long |
Packet size in flit. |
EsynetFlit::m_type |
FlitType |
EsynetFlit::FLIT_HEAD . |
EsynetFlit::m_src_ni |
long |
Source router id. |
EsynetFlit::m_des_ni |
long |
Destination router id. |
EsynetFlit::m_flag |
uint16_t |
Flit flags. |
EsynetFlit::m_flit_start_time |
double |
The injection time of the packet. |
EsynetFoundation
provides EsynetFoundation::receiveEvgMessage
method to handle EVG event. The network platform calls the NI specified by
EsynetEvent::m_des_id
to respond EVG event. NI generates all the flits for the packets and stores flits in the injection queue. See also Traffic generation for more information.
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. The simulation engine itself generates ROUTER events.
EsynetEvent
provides EsynetEvent::generateRouterEvent
to generate a ROUTER event. ROUTER event should provide the following information.
Fields | Data type | Note |
---|---|---|
EsynetEvent::m_event_time |
double |
The simulation cycle. |
EsynetEvent::m_pipe_time |
double |
The period of the pipeline in cycle. |
EsynetEvent::m_event_type |
long |
EsynetEvent::ROUTER . |
EsynetEvent::m_src_id |
long |
Specified router to respond this event. Default value is -1. |
ROUTER event is the first event in the event queue. When initializing the event queue, the event queue injects the first ROUTER event.
EsynetFoundation
provides EsynetFoundation::receiveRouterMessage
method to handle ROUTER event. During the simulation, the network platform generates the next ROUTER event when it responds to one ROUTER event. The simulation cycle of the next ROUTER is calculated by added EsynetEvent::m_pipe_time
to EsynetEvent::m_event_time
. By default, the network platform calls all the
routers and NIs to respond ROUTER event. Each router and NI does the pipeline once when they receive ROUTER event. See also Router pipeline and NI pipeline for more information.
ESYNet can support multi-clock-domains in NoC, which means simulation components may not respond ROUTER event at the same time. The basic clock period is 1.0 cycle. One ROUTER event with EsynetEvent::m_pipe_time
as 1.0 can trigger all routers and NIs within the base clock domain. Another clock period is measured by the basic clock period. One ROUTER event with EsynetEvent::m_pipe_time
not as 1.0 can only trigger the router and NI specified by EsynetEvent::m_src_id
.
The network platform also calls traffic generator in ROUTER events. The traffic generator is only called by the ROUTER event with EsynetEvent::m_pipe_time
as 1.0. See also Traffic generation for more information.
Link transmission event (WIRE) means a flit transmits through one link. WIRE events are generated by the link transmission stage in router pipeline.
EsynetEvent
provides EsynetEvent::generateWireEvent
to generate a WIRE event. One WIRE event means EsynetEvent::m_flit
transmits from EsynetEvent::m_src_vc
of EsynetEvent::m_src_pc
of EsynetEvent::m_src_id
to EsynetEvent::m_des_vc
of EsynetEvent::m_des_pc
of EsynetEvent::m_des_id
at EsynetEvent::m_event_time
. WIRE event should provides the following information.
Fields | Data type | Note |
---|---|---|
EsynetEvent::m_event_time |
double |
The time when the flit should be received by the destination router. |
EsynetEvent::m_event_type |
long |
EsynetEvent::WIRE . |
EsynetEvent::m_src_id |
long |
Source router. |
EsynetEvent::m_src_pc |
long |
Output physical port of source router. |
EsynetEvent::m_src_vc |
long |
Output virtual channel of source router. |
EsynetEvent::m_des_id |
long |
Destination router. |
EsynetEvent::m_des_pc |
long |
Input physical port of destination router. |
EsynetEvent::m_des_vc |
long |
Input virtual channel of destination router. |
EsynetEvent::m_flit |
EsynetFlit |
The transmitted packet. |
EsynetFoundation
provides EsynetFoundation::receiveWireMessage
method to handle WIRE event. The network platform calls the router or NI specified by EsynetEvent::m_des_id
to respond WIRE event. See also Receive flit in the router and [Receive flit in NI] for more information. The network platform also calls the router or NI specified by EsynetEvent::m_src_id
to clear the status of the link.
The source and destination id encode the routers and NIs in the same field. The lower part of the value is used to specified routers; the higher part of the value is used to specified NI. For example, for an 8x8 regular mesh topology, 0-63 is used to label routers; 64-127 is used to label NIs.
Credit transmission event (CREDIT) means a credit value transmits through one link. The credit means the number of free slots in the virtual channels of the input channels connected with the virtual channels of the output channels. In credit-based flow control, the credit is transmitted by the wires between routers as well. The CREDIT events are generated by the router pipeline as well. See [flow control] for more information.
EsynetEvent
provides EsynetEvent::generateCreditEvent
to generate a CREDIT event. CREDIT event should provides the following information.
Fields | Data type | Note |
---|---|---|
EsynetEvent::m_event_time |
double |
The time when the flit should be received by destination router. |
EsynetEvent::m_event_type |
long |
EsynetEvent::CREDIT . |
EsynetEvent::m_src_id |
long |
Source router. |
EsynetEvent::m_src_pc |
long |
Input physical port of source router. |
EsynetEvent::m_src_vc |
long |
Input virtual channel of source router. |
EsynetEvent::m_des_id |
long |
Destination router. |
EsynetEvent::m_des_pc |
long |
Output physical port of destination router. |
EsynetEvent::m_des_vc |
long |
Output virtual channel of destination router. |
EsynetEvent::m_flit
should provide the following information.
Fields | Data type | Note |
---|---|---|
EsynetEvent::m_flit.m_id |
long |
Credit value. |
EsynetFoundation
provides EsynetFoundation::receiveCreditMessage
method to handle CREDIT event. The network platform calls the router or NI specified by EsynetEvent::m_des_id
to respond CREDIT event. See also [flow control] for more information.
NI read event (NIREAD) means a packet should be ejected from the network. Network interfaces and the integration APIs generate NIREAD events.
EsynetEvent
provides EsynetEvent::generateNIReadEvent
to generate a NIREAD event. NIREAD event should provide the following information.
Fields | Data type | Note |
---|---|---|
EsynetEvent::m_event_time |
double |
The ejection time of the packet. |
EsynetEvent::m_event_type |
long |
EsynetEvent::NIREAD . |
EsynetEvent::m_src_id |
long |
The NI id. |
EsynetFoundation
provides EsynetFoundation::receiveNireadMessage
method to handle NIREAD event. The network platform calls the NI specified by EsynetEvent::m_des_id
to respond NIREAD event. NI ejects one packet out from the eject queue. See also NI pipeline for more information.
Copyright @ Junshi Wang