er.akhilkumar
Full Member level 2
I need to generate some register in Register Map using generate statement. Here is the code:
reg [31:0];
always @ (posedge clk or negedge rst_n)
begin
if (!rst_n)
reg <= P_REG_RSTVAL;
else if (wr_en && add == P_REG_ADDR)
reg <= data_in;
end
If I have a parameter P_NUM_REG which specifies the number of registers and I also have reset value and reg address parameters with naming convention P_REG0_RSTVAL and P_REG0_ADDR respectively, how I can use generate statement here?
Please help.
reg [31:0];
always @ (posedge clk or negedge rst_n)
begin
if (!rst_n)
reg <= P_REG_RSTVAL;
else if (wr_en && add == P_REG_ADDR)
reg <= data_in;
end
If I have a parameter P_NUM_REG which specifies the number of registers and I also have reset value and reg address parameters with naming convention P_REG0_RSTVAL and P_REG0_ADDR respectively, how I can use generate statement here?
Please help.