// A net has a string name and a width. // A net may be high z, dont know or contain an integer from 0 up to 2**width - 1. // A net has a list of driving and reading models. type value_t = V_n of int | V_z | V_x; type net_t = { net_name: string; // Unique name for this net. width: int; // Width in bits if a bus. current_value: value_t ref; // Current value as read by others net_inertia: int; // Delay before changing (commonly zero). sensitives: model_t list ref; // Models that must be notified if changed. }; // An event has a time, a net to change, the new value for that net and an // optional link to the next on the event queue: type event_t = EVENT of int * net_t * value_t * event_t option ref
This reference implementation of an event-driven simulation (EDS) kernel maintains an ordered queue of events commonly called the event list. The current simulation time, tnow, is defined as the time of the event at the head of this queue.
An event is a change in value of a net at some time in the future. Operation takes the next event from the head of the queue and dispatches it. Dispatch means changing the net to that value and chaining to the next event. All component models that are sensitive to changes on that net then run, potentially generating new events that are inserted into the event queue.
The full version of these notes covers two variations on the basic EDS algorithm: intertial delay and delta cycles. But these are not examinable CST 15/16 onwards.
43: (C) 2008-18, DJ Greaves, University of Cambridge, Computer Laboratory. |