Skip to main content

Parameters

· loading · loading · · ·
HDL Verilog HDL
Axolot Logic
Author
Axolot Logic
Digital Design Engineer
Table of Contents
Verilog HDL Series - This article is part of a series.
Part 12: This Article

πŸŽ›οΈ Parameters in Verilog
#

Parameters are compile-time constants used to make modules configurable and reusable.

βœ… Define Inside Module:
#

module counter #(parameter WIDTH = 8) (
  input clk,
  output [WIDTH-1:0] out
);

βœ… Override During Instantiation:
#

counter #(.WIDTH(16)) u_counter (
  .clk(clk),
  .out(data)
);

πŸ”’ Local Parameters
#

Use localparam to define constants that cannot be overridden during module instantiation.

module timer;
  localparam TIMEOUT_CYCLES = 100;
endmodule

Useful for internal constants derived from other parameters or used for fixed values.

Key Points:

  • Parameters are not variables β€” they cannot change at runtime.
  • Often used to set data widths, address sizes, etc.

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

Related

Blocking vs Non-Blocking Assignments
· loading · loading
HDL Verilog HDL
Command-Line Input
· loading · loading
HDL Verilog HDL
Compiler Directives & Macros
· loading · loading
HDL Verilog HDL
Control Flow
· loading · loading
HDL Verilog HDL
Delay Controls
· loading · loading
HDL Verilog HDL
Hierarchical Reference
· loading · loading
HDL Verilog HDL

comments powered by Disqus