Parameters, localparam, and generate
Make a module reusable without turning its internal settings into hardware inputs.
A parameter is fixed before synthesis
A parameter configures the structure of a module when it is instantiated. It does not become a circuit input and cannot change while the circuit is running.
module masked_register #(
parameter WIDTH = 8
) (
input wire i_clk,
input wire i_reset,
input wire i_load,
input wire [WIDTH-1:0] i_data,
input wire [WIDTH-1:0] i_mask,
output reg [WIDTH-1:0] o_data
);
always @(posedge i_clk) begin
if