Home / Learn Verilog / Recursion for Constants

Recursion for Constants

Compute at elaboration.

The gistCompute at elaboration.

The idea, explained simply

Recursionf(1)f(2)f(3)
Recursion

Definition

Recursive constant functions compute parameter values.

Why you need this

Tree structures and widths.

How it works

Keep depth bounded.

Where you'll see this

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

Try it

Fibonacci constantVerilog: edit and run

Computed before simulation starts.

Test what you just read

1. fib(10)?