User guide
24-26
SystemVerilog Testbench Constructs
initial begin
a["sa"] = 8;
a["bb"] = 15;
a["ec"] = 29;
a["d"] = 32;
a["e"] = 45;
a[string_variable] = 1;
end
endprogram
Associative Array Assignments and Arguments
You can only assign an associative array to another associative array
with a equivalent data type. Similarly, you can only pass an
associative array as an argument to another associative array with a
equivalent data type.
Associative Array Methods
There are methods for analyzing and manipulating associative
arrays.
num
Returns the number of entries in the array.
delete
Removes all entries from an array. If you specify an index, this
method removes the entry specified by the index.
exists
Returns a 1 if the specified entry exists.