|
|
|

|
|
|
|
|
|

|
|
 |
task
|
|
|
Tasks are identical to functions except they do not return a value. |
|
|

|
|
|
task task_name (argument_list) {
statements;
}
|
|
|

|
|
|
By default, tasks declared at the top level have a global scope. The local keyword is used to reduce the scope of a task to the file in which the task is declared. |
|
|

|
|
|
|
|
|

|
|
 |
Example : task
|
|
|

|
|
|
1 program function_ex {
2 print_data(random(),random());
3 print_data(random(),random());
4 }
5
6 // Some random task
7 task print_data (bit [7:0] d1, bit [7:0] d2) {
8 printf("Value 1 %x, Value 2 %x\n",d1,d2);
9 }
You could download file task_ex.vr here
|
|
|

|
|
 |
Simulation : task
|
|
|

|
|
|
Value 1 ac, Value 2 1d
Value 1 bf, Value 2 c9
|
|
|

|
|
|

|
|
|

|
|
|
|
|
|

|
|
|
|
|
|

|
|
Copyright © 1998-2025 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|