|
|
|
|
|
|
|
|
|
|
|
|
Event
|
|
|
Events are variable types mainly used for interprocess (thread) synchronization operations. Events can be passed as arguments to task and function calls to specify synchronization and trigger points. |
|
|
|
|
|
Event variables have 3 valid values, OFF, ON, and null. |
|
|
|
|
|
Syntax event variable_name [=initial_value]; |
|
|
|
|
|
Must be a valid identifier. initial_value |
|
|
|
|
|
The only valid initial_value is null. If this specification is omitted, the initial value of the declared variable is OFF. If an event variable used in a trigger() system task has a null value, the trigger becomes always on |
|
|
|
|
|
|
|
|
|
|
|
Example : Event
|
|
|
|
|
|
1 program event_t {
2 event try_event;
3 event get_event;
4 // Start the wait_event as parallel thread
5 fork {
6 wait_event();
7 } join none
8 // Wait till task wait_event has started execution
9 sync(ALL, get_event);
10 printf("Triggering event try_event\n");
11 trigger(try_event);
12 // Wait till task wait_event has done execution
13 sync(ALL, get_event);
14 }
15
16 // Task which triggers/waits for events
17 task wait_event() {
18 // Inform that wait_event has started
19 trigger(get_event);
20 printf("Waiting for event try_event\n");
21 sync(ALL, try_event);
22 printf("Got event try_event\n");
23 // Inform that wait_event has done with execution
24 trigger(get_event);
25 }
You could download file event_t.vr here
|
|
|
|
|
|
Simulation : Event
|
|
|
|
|
|
Waiting for event try_event
Triggering event try_event
Got event try_event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|