Functions (Automatic and Static) - 2023.2 English

Vivado Design Suite User Guide: Synthesis (UG901)

Document ID
UG901
Release Date
2023-11-01
Version
2023.2 English

Functions are similar to tasks, but return a value. The format for a function is:

function data_type function_name(inputs);
declarations;
  statements;
endfunction : function_name

The final function_name is optional but does make the code easier to read.

Because the function returns a value, it must either have a return statement or specifically state the function name:

function_name = ....

Like tasks, functions can also be automatic or static.

CAUTION:
Vivado synthesis treats all functions as automatic. However, some simulators might behave differently. Be careful when using these functions with third-party simulators.