Verilog Tasks & Functions

Differences between tasks and functions, and their usage.

Intermediate Level

Difference between Task and Function?

Function: Must execute in 0 time (no delays, no `@`, no `wait`). Returns one value. Synthesizable (Comb logic).

Task: Can contain time-consuming statements (delays). No return value (use output ports). Not always synthesizable.

Can a Function call a Task?

No. Because a function must be 0-time, but a task might consume time. A Task CAN call a Function.