Generics are called parameters in Verilog. They are declared inside the module as strings of the type:
parameter DATA_WIDTH = 8;
parameter ADDR_WIDTH = 8;
Concretization can individually specify the values of the parameters:
my_ram_impl #(
.DATA_WIDTH(16),
.ADDR_WIDTH(8)
)
ram_instance(
.clk(clk),
.addr(addr),
.data(data),
.cs(cs),
.we(we)
);
Use these directives similar to C for conditional synthesis:
`ifdef SYM
...
`else
...
`endif
or, more flexibly generatecreates:
generate
if(cond)
...
else
...
endgenerate
source
share