Hello, it is a simple question but I couldn’t find a good example anywhere.
What is the syntax to populate a two dimensional array of strings in SV?
I tried the following, but apparently it is incorrect
string example [2][2] = '{
{"str1","str2"},
{"str3","str4"}
};
cgales
2
In reply to Azmo:
Why do you say that this is incorrect? Are you getting a syntax error? Run time error?
The below complete example works for me:
module test;
string example [2][2] = '{
{"str1","str2"},
{"str3","str4"}
};
initial begin
$display (example[0][0]);
$display (example[1][0]);
$display (example[0][1]);
$display (example[1][1]);
end
endmodule
Eh… I found my mistake. The above solution is correct.