User guide

24-25
SystemVerilog Testbench Constructs
Wildcard Indexes
You can enter the wildcard character as the index.
data_type array_id [*];
Using the wildcard character permits entering any integral data type
as the index. Integral data types represent an integer (shortint,
int, longint, byte, bit, logic, reg, integer, and also packed
structs, packed unions, and enum.
Note:
The wildcard index has a 64 bit limitation.
program m;
bit [2:0] AA1[*];
int int1;
logic [7:0] log1;
initial begin
int1 = 27;
log1 = 42;
AA1[456] = 3'b101;
AA1[int1] = 3'b000; // index is 27
AA1[log1] = 3'b111; // index is 42
end
endprogram
String Indexes
A string index specifies that you can index the array with a string. You
specify a string index with the keyword string.
program p;
logic [7:0] a[string];
string string_variable;