|
|
|
|
|
|
|
|
|
|
|
Introduction to Events
|
|
|
The e language provides temporal constructs for specifying and verifying behavior over time. All e temporal language features depend on the occurrence of events, which are used to synchronize activity with a simulator and within the e program.
|
|
|
|
|
|
- If a path is provided, use the event defined in the struct instance pointed to by the path.
- If no path is provided, the event is resolved at compile time. The current struct instance is searched.
- If the event instance is not found, a compile-time error shall be issued.
|
|
|
|
|
|
An event named "clk" is defined to be the rising edge of a signal named "top.clk" at another event named "sim". The @ symbol is used with an event name, @event, to mean "when the event is true". The special @sim syntax means at a callback from the simulator. The rise() expression always causes a callback when the signal rises. Therefore, this event definition means "a rise of top.clk causes clk to occur". Occurrences of the "clk" event are represented by arrows.
|
|
|
|
|
|
|
|
|
|
|
|
Defining and Emitting Named Events
|
|
|
Events are defined as a part of a struct definition. When a struct is instantiated, each instance has its own event instances. Each event instance has its own schedule of occurrences. There is no relation between occurrences of event instances of the same type. All references to events are to event instances. The scoping rules for events are similar to other struct members, such as fields.
|
|
|
|
|
|
Events can be attached to temporal expressions, using the option is [only] temporal-expression syntax, or they can be unattached. An attached event is emitted automatically during any tick in which the temporal expression attached to it succeeds.
|
|
|
|
|
|
Syntax
|
Cause of Event
|
event a is (@b and @c)@d
|
Derived from other events.
|
event a is rise ('top.b') @sim
|
Derived from behavior of a simulated device.
|
event a is { @b; @c; @d }@e
|
A sequence of other events.
|
event a; meth_b() @c is { ... ; emit a; ... };
|
By the emit action in procedural code (see "emit").
|
|
|
|
|
|
|
You can use the emit action in any method to cause an event to occur, whether it has an attached temporal expression or not. The simplest usage of emit is to synchronize two TCMs, where one TCM waits for the named event and the other TCM emits it. Emitting an event causes the immediate evaluation of all temporal expressions that contain that event.
|
|
|
|
|
|
|
|
|
|
|
|
Example - Defining and Emitting Named Events
|
|
|
|
|
|
1 <'
2 struct eventEmit {
3 event clk is rise('top.clk') @sim;;
4 event nclk is fall('top.clk') @sim;
5 event startSim;
6
7 mainInit()@clk is {
8 // Do something here
9 wait [1] *cycle;
10 // Emit event
11 emit startSim;
12 // Do something here
13 };
14 };
15 '>
You could download file events_temp_ex1.e
here
|
|
|
|
|
|
Sampling Events Overview
|
|
|
Events are used to define the points at which temporal expressions and TCMs are sampled. An event attached to a temporal expression becomes the sampling event for the temporal expression. The event is attached using the @sampling-event syntax:
|
|
|
|
|
|
temporal-expression @sampling-event
|
|
|
|
|
|
The temporal expression is evaluated at every occurrence of the sampling event. The sampling period is the time from after one sampling event up to and including the next sampling event. All event occurrences within the same sampling period are considered simultaneous. Multiple occurrences of a particular event within one sampling period are considered to be one occurrence of that event.
|
|
|
|
|
|
Predefined Events Overview
|
|
|
Predefined events are events which are already defined in e language, they get emitted at pre defined point of time.
|
|
|
|
|
|
sys.any
|
Emitted on every tick.
|
sys.tick_start
|
Emitted at the start of every tick.
|
sys.tick_end
|
Emitted at the end of every tick.
|
session.start_of_test
|
Emitted once at test start.
|
session.end_of_test
|
Emitted once at test end.
|
struct.quit
|
Emitted when a struct's quit() method is called. Only exists in structs that contain events or have members that consume time (for example, time-consuming methods or on struct members).
|
sys.new_time
|
In stand-alone operation (no simulator), this event is emitted on every sys.any event. When a simulator is being used, this event is emitted whenever a callback occurs and the attached simulator's time has changed since the previous callback.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|