top of page

14.6.1. For Loop

​

The for loop is the most commonly used loop in Verilog. It provides a compact syntax for counter-controlled iteration and is the ONLY loop with limited synthesizability.

​

Syntax and Structure

Verilog

Components

​

  • Initialization: Executed once at the start (e.g., i = 0)

​

  • Condition: Checked before each iteration (e.g., i < 10)

​

  • Increment/Decrement: Executed after each iteration (e.g., i = i + 1)

​

Basic Examples

Verilog

14.6.1.1. Advanced For Loop Usage

​

Multiple Statements in Loop Body

Verilog

Nested For Loops

Verilog

Variable Step Size

Verilog

14.6.1.2. Synthesizable For Loops
 

IMPORTANT: For loops can be synthesized ONLY if the iteration count is KNOWN at elaboration time (constant bounds). The loop is 'unrolled' into replicated hardware.
 

Synthesizable Example

Verilog

Non-Synthesizable Example

Verilog

Common For Loop Patterns

Verilog

Loops

While Loop
 

© Copyright 2025 VLSI Mentor. All Rights Reserved.©

Connect with us

  • Instagram
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
bottom of page