module csm
logic [3:0] sel;
integer vg [3:0][4:0];
----code------
endmodule
module fsm
csm (----porting done-----); // Also uses vg to do some calculation
module testbench ();
integer tb_vg [3:0] [4:0];
/* I need help here */
Right now, I have hardcoded and assigned the entire array from DUT to test bench.
However, I want to assign vg on the fly like this integer tb_vg = fsm.csm.vg [sel];
My current modification is:
Using a `define macro, doing str2pa (x) ``x
So I have created a string and sformat it,
$sformat (ab, “fsm.csm.%d”, sel);
tb_vg = `str2pa(ab);
However this is issuing an error saying string to unpacked is not allowed.
Help is much appreciated.