Home / Learn Verilog / for Loops in RTL
for Loops in RTL
Loops unroll into hardware.
In shortLoops unroll into hardware.
What's actually going on
What it is
In synthesizable code a for loop has constant bounds and expands into repeated logic.
Why it matters
Compact descriptions of bit-wide operations.
Mechanically speaking
Think of it as copy-paste done by the tool.
Shows up in
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
Loop builds an OR treeVerilog: edit and run
Eight OR gates in a chain.
Check yourself
1. RTL for loop bounds must be...
Known at compile time.