ISSUE 436

Edit Proposal  Edit Class, Environment, or Release
Number 436
Category enhancement
Synopsis Non-blocking event trigger
State proposal
Class enhancement
Arrival-DateAug 22 2003
Originator Jay Lawrence - Cadence Design Systems
Release 2001b
Environment
Description


The triggering of named events in Verilog can often lead to race conditions. The following example shows the problem.

module events;

event e, go;

always @(go)
begin
$display($time,,"Always 1 - triggering e");
-> e;
end

always @(go)
begin
$display($time,,"Always 2 - about to wait on e");
@(e) $display($time,,"Always 2 - wakeup on e");
$finish;
end

always #5 ->go;

endmodule


The runtime output of this description could either be:


5 Always 1 - triggering e
5 Always 2 - about to wait on e
10 Always 1 - triggering e
10 Always 2 - wakeup on e
or

5 Always 2 - about to wait on e
5 Always 1 - triggering e
5 Always 2 - wakeup on e


Note: The output above was generated by running Verilog-XL on the above module with the order of the declaration of the always blocks once as shown, and then with them reversed!

This ambiguity is created because event triggers act like blocking assignments. They immediately trigger the event at the point at which the trigger is executed. The solution to this problem is to allow a non-blocking trigger operator.
Fix


Add in section 9.7.3:

The effect of a non-blocking event trigger operator is that the statement executes without blocking. It shall create a non-blocking assign update event in the time when the delay control expires, or the event-control occurs. The effect of this update event would be to trigger the referenced event.

An example of a module where a non-blocking trigger can be used to get deterministic results is as follows:

module events;

event e, go;

always @(go)
begin
$display($time,,"Always 1 - triggering e");
->> e; // non-blocking trigger guaranteed to run after
// both always blocks
end

always @(go)
begin
$display($time,,"Always 2 - about to wait on e");
@(e) $display($time,,"Always 2 - wakeup on e");
$finish;
end

always #5 ->go;

endmodule


The legal outcomes of the above description are:

5 Always 2 - about to wait on e
5 Always 1 - triggering e
5 Always 2 - wakeup on e

or
5 Always 1 - triggering e
5 Always 2 - about to wait on e
5 Always 2 - wakeup on e

Note that although the order of the always blocks is still arbitrary both orderings cause the wakeup on event 'e' to occur at time 5.

Audit-Trail
Unformatted



Hosted by Boyd Technology