Tasks and Functions the Differences


Tasks and functions can bu used to in much the same manner but there are some important differences that must be noted. The actual type used is very dependent upon what the module actually requires.


Functions

Tasks

A function is unable to enable a task
however functions can enable other
functions.
Tasks are capable of enabling a
function as well as enabling other
versions of a Task
A function will carry out its required
duty in zero simulation time. ( The
program time will not be incremented
during the function routine)
Tasks also run with a zero simulation
however they can if required be
executed in a non zero simulation
time.
Within a function, no event, delay or
timing control statements are permitted
Tasks are allowed to contain any of
these statements.
In the invocation of a function their must
be at least one argument to be passed.
A task is allowed to use zero or more
arguments which are of type output,
input or inout.
Functions will only return a single value
and can not use either output or inout
statements.
A Task is unable to return a value but
has the facility to pass multiple values
via the output and inout statements

Some links to other information within the Verilog Function topic
Functions a Description
Syntax