Previous Section Next Section

7.1 Defining Events

Events define occurrences of certain activity in Specman Elite or the HDL simulator. Events can be attached to temporal expressions (TEs), using the option is temporal-expression syntax, or they can be unattached. An attached event is emitted when a temporal expression defining it succeeds. The syntax for defining events is as follows:

event event-type [is [only] temporal-expression];

The components of an event definition are shown in Table 7-1.

Table 7-1. Components of an Event Definition

event-type

The name you give the event type. It can be any legal e identifier.

temporal-expression

An event or combination of events and temporal operators.

To use an event name alone as a temporal expression, you must prefix the event name with the @ sign.

Example 7-1 shows some event definitions. When an event is triggered, it is said to be emitted.

Example 7-1 Event Definition
Example that shows different types of event definitions.
All e events are triggered (emitted) in Specman Elite.
<'
struct m_str {
    event start_cnt; //This is a standalone event that will be
                     //triggered (emitted) manually when an occurrence
                    //of certain conditions happens.
    event top_clk is fall('~/top/r_clk') @sim;
                   //When a negedge of the HDL signal ~/top/r_clk
                     //occurs, an event top_clk is triggered (emitted)
                   //in Specman Elite. @sim is the sampling event
                    //that initiates a callback from the HDL simulator
                   //to Specman Elite.
    event stop_cnt is {@start_ct; [2]} @top_clk;
                    //The event stop_cnt is emitted when start_cnt
                    //is followed by two cycles of emissions of
                    //top_clk event (falling edge of ~/top/r_clk).
                    //In this case, top_clk
                    //is called the sampling event.
    event clk is rise('~/top/cpu_clk') @sim;
                    //When a posedge of the HDL signal ~/top/cpu_clk
                    //occurs, an event clk is triggered (emitted)
                    //in Specman Elite.
    event sim_ready is change('~/top/ready') @sim;
                    //When a posedge or negedge of the HDL signal
                    //~/top/ready occurs, an event sim_ready is
                    //triggered (emitted) in Specman Elite.
};
'>
Previous Section Next Section