I am a newbie in verilog. As variables can not be assigned to index of an array, how I can code this one in verilog, so no compilation error will occur?
module strMatch();
reg [15:0]str;
integer i;
reg [10*8-1:0]searchBuffer;
initial
begin
str = "ab";
searchBuffer = "qwertabjkl";
for (i=10;i>=2;i++)
begin
if(searchBuffer[(8*i-1:8*(i-2)]==str[15:0])
begin
$display("i");
end
end // end of for
end // end of initial
endmodule