top of page

14.7.1. Generate for Loop

​

The generate for loop creates multiple instances of hardware in a regular, indexed pattern. It's the most commonly used generate construct for creating arrays of modules, gates, or other hardware elements.

​

Syntax and Structure

Verilog

Key Components
 

  • genvar: Generate variable (NOT a reg or wire). Exists only during elaboration.
     

  • generate/endgenerate: Keywords to mark generate region
     

  • begin : label end: Named block (REQUIRED for generate). Creates unique scope.
     

  • Loop bounds: Must be constants or parameters (known at elaboration)
     

Basic Examples

Verilog

Module Instantiation in Generate

Verilog

Parameterized Generate

Verilog

Nested Generate for Loops

Verilog

Generate Block

Generate if
 

© Copyright 2025 VLSI Mentor. All Rights Reserved.©

Connect with us

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