Home / Learn Verilog / automatic Functions and Tasks

automatic Functions and Tasks

Each call gets its own variables.

The short versionEach call gets its own variables.

Theory in plain words

Static vs automaticstaticone shared copyautomaticfresh per call
Static vs automatic

In plain terms

Without automatic, locals are shared between calls; with it, every call has its own copy.

Why we use it

Required for recursion and concurrent calls.

Under the hood

function automatic ...

Real-world use

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

FactorialVerilog: edit and run

Recursion needs automatic.

Quick quiz

1. Recursion requires...