I write SPI slave BFM module with several SPI interfaces. I use Active-HDL 9.1. I generate several blocks(spi slaves) in my SystemVerilog code. I also write functions in which I read and reset data in this blocks. This is a part of my code:
module bfm_spi(itf_spi);
parameter C_NUM = 1;
parameter C_DATA_WIDTH = 32;
spi_interface itf_spi [C_NUM];
genvar i;
generate
for(i=0; i < C_NUM; i++) begin : bfm_spi_arr
bfm_spi_1 #(.C_DATA_WIDTH(C_DATA_WIDTH)) bfm_spi_1_i (itf_spi[i]);
end
endgenerate
/**
* Reset all input buffers
* */
task Reset;
integer i;
for(i = 0; i < C_NUM; i++) bfm_spi_arr[i].bfm_spi_1_i.Reset(); //Error this
endtask // Reset
During a compile compiler write error for line, in which I note "Error this".
Error message: Generate block item selection with variable index is not supported: i
If I replace i with constant number, complile is OK.
module bfm_spi(itf_spi);
parameter C_NUM = 1;
parameter C_DATA_WIDTH = 32;
spi_interface itf_spi [C_NUM];
genvar i;
generate
for(i=0; i < C_NUM; i++) begin : bfm_spi_arr
bfm_spi_1 #(.C_DATA_WIDTH(C_DATA_WIDTH)) bfm_spi_1_i (itf_spi[i]);
end
endgenerate
/**
* Reset all input buffers
* */
task Reset;
integer i;
for(i = 0; i < C_NUM; i++) bfm_spi_arr[0].bfm_spi_1_i.Reset(); //OK
endtask // Reset
How I can select several bfm_spi_1_i block in generate in my task Reset()? This BFM module is used only for simulation, not for implemantions