Skip to main content

Verilog Namespaces: Understanding Scope and Modularity

· loading · loading · ·
Kerim Turak
Hardware Design Verilog Namespace Verilog Scope Modularity RTL Design Hardware Description Language
Hardware Design
Author
Kerim Turak
Digital IC Design & Verification Engineer
Table of Contents
Verilog HDL Series - This article is part of a series.
Part 21: This Article

🌐 Verilog Namespaces
#

Verilog uses a flat, module-based namespace. This means:

  • Identifiers must be unique within a given scope (e.g., inside a module).

  • Modules themselves form separate namespaces.

  • Inside a module, you can have:

    • Local variables
    • Ports
    • Internal wires and regs
  • No nested functions, no packages like SystemVerilog — limited modularity.

🧠 Example:
#

module ALU;
  reg [3:0] result;   // Only visible inside this module
endmodule

module top;
  wire [3:0] result;  // This is a different 'result'
endmodule

If two modules both have result, they are independent unless explicitly connected via ports.


Verilog HDL Series - This article is part of a series.
Part 21: This Article

Related

Verilog Assignments: Procedural vs. Continuous Explained
· loading · loading
Kerim Turak
Hardware Design Verilog Assignments Continuous Assignment Procedural Assignment RTL Design Hardware Description Language
Hardware Design
Verilog Parameters: Making Modules Reusable & Configurable
· loading · loading
Kerim Turak
Hardware Design Verilog Parameters Reusable Design Configurable Modules RTL Design Hardware Description Language
Hardware Design
Introduction to Verilog: Basics for Digital Design
·1176 words·6 mins· loading · loading
Kerim Turak
Hardware Design Verilog FPGA ASIC RTL Design Hardware Description Language
Hardware Design
Verilog Blocking vs. Non-Blocking Assignments
· loading · loading
Kerim Turak
Hardware Design Verilog Assignments Blocking Assignment NonBlocking Assignment RTL Design Sequential Logic
Hardware Design
Hardware Design Abstraction Levels in Verilog
·238 words·2 mins· loading · loading
Kerim Turak
Hardware Design Hardware Abstraction RTL Design Gate Level Transistor Level Digital Design
Hardware Design
Verilog Compiler Directives & Macros: Conditional Compilation & Code Reuse
· loading · loading
Kerim Turak
Hardware Design Verilog Directives Verilog Macros Conditional Compilation Code Reuse Hardware Description Language
Hardware Design