How to use verilog $deposit with indexes

Meir picture Meir · Apr 9, 2014 · Viewed 10.2k times · Source

How can $deposit be used when the path includes the index from the generate loop. When I try:

for(int idx=0; idx<`NUM_OF_ENGIES; idx++)
   $deposit(i_engines_array.engines_loop[i].engine_top.soft_reset_n, 1'b0);

I get the error:

Error-[STASKEC_IFAIDT] Illegal argument to $deposit task

  The first argument passed to $deposit task: path is illegal.
  Please pass net/reg/bitselect type to $deposit task and recompile.

Answer

nguthrie picture nguthrie · Apr 9, 2014

You need to name the generate block and then you can index it. See section 24.7 of the standard. For example:

genvar idx;
for(idx=0; idx<4; idx) begin : engine_loop
  engine engine_top();
end

initial begin
  $deposit(engine_loop[2].engine_top.soft_reset_n, 1'b0);
end