I know this isn’t directly related to the OVM, but I’ve looked through the SystemVerilog LRM and searched the internet and haven’t been able to find an answer or example, so I figured it was worth a post. :)
Are multi-dimensional dynamic arrays allowed in SystemVerilog? And if so, how does one go about allocating them with new[]
?
This is illegal…
int data[][][];
....
c = 5;
a = 10;
v = 2;
data = new[c];
data[] = new[a];
data[][] = new[v];
As is this, obviously…
data = new[c][a][v];
I was hoping there’d be an easy way to do it on one or two lines. The only thing I haven’t tried is to use a few nested foreach loops and declare each dimension iteratively. Anyone know how to accomplish this?
-gb