For loop to assign multiple variables

In reply to sj1992:

That nagging suspicion that must be gnawing within your inner voice “Stop using cut/paste and properly use multi-dimensional arrays”:

bit [ 31 : 0 ] var_inst [ 0 : 99 ]

That solves your problem, among other things - like a 100/1 code reduction.

Edit to add: Then use a generate loop:

for( genvar i = 0; i < 100; i++ )
begin : iter_i
  assign var_inst[ i ] = dut.module1.module2.reg_cfg[ i ].var;
end

Regards,
Mark