The syntax for a task declaration is:
task name (ports); [optional declarations]; statements;
endtask
Following are the two types of tasks:
- Static task
- Declarations retain their previous values the next time the task is called.
- Automatic task
- Declarations do not retain previous values.
CAUTION:
Be careful when using these tasks;
Vivado synthesis treats all tasks as automatic.
Many simulators default to static tasks if the static or automatic is not specified, so there is a chance of simulation mismatches. The way to specify a task as automatic or static is the following:
task automatic my_mult... //or
task static my_mult ...