Hi,
Been trying to create an associative array of events and Modelsim doesn’t seem to be happy about it.
module event_associative_array;
// String-indexed
event e_str[string];
initial forever begin
wait(e_str.exists("a"));
@(e_str["a"]);
$display("Triggered");
end
// Stimulus
initial begin
#10;
->e_str["a"];
#10 $finish;
end
endmodule
Running that gives:
# ** Warning: (vsim-3829) ../../../resources/sv_examples/event_associative_array.sv(13): Non-existent associative array entry. Returning default value.
# ** Note: $finish : ../../../resources/sv_examples/event_associative_array.sv(14)
# Time: 20 ns Iteration: 0 Instance: /event_associative_array
Line 13 is
->e_str["a_str"];
I’ve been looking around to find out if this is legal. It certainly compiles. Seems like an associative array entry is not created unless it’s the LHS of an expression.
Anyone have an idea of a workaround (aside from using uvm_event)?