quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif event

In Verilog, named events are static objects that can be triggered via the -> operator, and processes can wait for an event to be triggered via the @ operator. SystemVerilog events support the same basic operations, but enhance Verilog events in several ways. The most salient enhancement is that the triggered state of Verilog named events has no duration, whereas in SystemVerilog this state persists throughout the time-step in which the event triggered. Also, SystemVerilog events act as handles to synchronization queues, thus, they can be passed as arguments to tasks, and they can be assigned to one another or compared.

   

space.gif

Syntax

   

space.gif

event_trigger ::=
-> hierarchical_event_identifier ;
| ->> [ delay_or_event_control ] hierarchical_event_identifier ;
   

space.gif

  ../images/main/bullet_star_pink.gif Triggering an event

Named events are triggered via the -> operator. This is same as in Verilog. Triggering an event unblocks all processes currently waiting on that event.

   

space.gif

  ../images/main/bullet_star_pink.gif Nonblocking event trigger

Nonblocking events are triggered using the ->> operator. The effect of the ->> operator is that the statement executes without blocking and it creates a nonblocking assign update event in the time in which the delay control expires or the event control occurs.

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Waiting for an event

The basic mechanism to wait for an event to be triggered is via the event control operator, @. This is same in Verilog.

   

space.gif

  ../images/main/bullet_star_pink.gif Event sequencing: wait_order()

The wait_order construct suspends the calling process until all of the specified events are triggered in the given order (left to right) or any of the untriggered events are triggered out of order and thus causes the operation to fail.

   

space.gif

  ../images/main/bullet_star_pink.gif Example : events
   

space.gif


  1 program event_t;
  2   event try_event;
  3   event get_event;
  4 
  5   initial begin
  6     // Start the wait_event as parallel thread
  7     fork 
  8       wait_event();
  9     join_none
 10 
 11     // Wait till task wait_event has started execution
 12     $write("Waiting for event get_event\n");
 13     @ (get_event);
 14     $write("Triggering event try_event\n");
 15      #1 ;
 16     -> try_event;
 17     // Wait till task wait_event has done execution
 18     $write("Waiting for event get_event\n");
 19     wait (get_event.triggered);
 20     $write("Got event get_event\n");
 21      #10  $finish;
 22   end 
 23   
 24   // Task which triggers/waits for events
 25   task wait_event();
 26     begin
 27        #1 ;
 28       // Inform that wait_event has started
 29       $write("--task : Triggering event get_event\n");
 30       -> get_event;
 31       $write("--task : Waiting for event try_event\n");
 32       @(try_event);
 33       $write("--task : Got event try_event\n");
 34       // Inform that wait_event has done with execution
 35        #1 ;
 36       $write("--task : Triggering event get_event\n");
 37       ->get_event;
 38     end
 39   endtask
 40 
 41 endprogram
You could download file event_t.sv here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : events
   

space.gif

 Waiting for event get_event
 --task : Triggering event get_event
 --task : Waiting for event try_event
 Triggering event try_event
 Waiting for event get_event
 --task : Got event try_event
 --task : Triggering event get_event
 Got event get_event
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com