Add regression tests for edge controls on named event errors

Check that the compiler reports an error for `posedge`, `negedge` and `edge`
event controls on named events. Edge controls can not be used with named
events.

There is already an existing test that checks both `posedge` and `negedge`.
Split it into separate tests so that each invalid event control is checked
independently.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-05-11 20:12:01 -07:00
parent 265272a962
commit ba3f46722c
9 changed files with 49 additions and 16 deletions

View File

@ -0,0 +1,11 @@
// Check that edge event controls can not be used with named events.
module test;
event e;
initial begin
@(edge e);
end
endmodule

View File

@ -0,0 +1,11 @@
// Check that negedge event controls can not be used with named events.
module test;
event e;
initial begin
@(negedge e);
end
endmodule

View File

@ -1,15 +0,0 @@
module top;
event my_event;
// The following two line should be an error
// You can not take the edge of a named event.
always @(posedge my_event) $display("Posedge event.");
always @(negedge my_event) $display("Negedge event.");
// This should work correctly.
always @(my_event) $display("Any event edge.");
initial begin
#1 ->my_event;
#1 $display("FAILED");
end
endmodule

View File

@ -0,0 +1,11 @@
// Check that posedge event controls can not be used with named events.
module test;
event e;
initial begin
@(posedge e);
end
endmodule

View File

@ -719,7 +719,6 @@ multi_bit_strength normal ivltests gold=multi_bit_strength.gold
multi_driver_delay normal ivltests
multiply_large normal ivltests # Takes care of PR222
muxtest normal ivltests # Validates that X sel and inputs same, output not X
named_event_no_edges CE ivltests
nb_assign normal ivltests
nb_delay normal ivltests
nb_ec_concat normal ivltests

View File

@ -156,6 +156,9 @@ module_port_array1 vvp_tests/module_port_array1.json
module_port_array_fail1 vvp_tests/module_port_array_fail1.json
module_port_array_init1 vvp_tests/module_port_array_init1.json
monitor4 vvp_tests/monitor4.json
named_event_edge_fail vvp_tests/named_event_edge_fail.json
named_event_negedge_fail vvp_tests/named_event_negedge_fail.json
named_event_posedge_fail vvp_tests/named_event_posedge_fail.json
non-polymorphic-abs vvp_tests/non-polymorphic-abs.json
partsel_invalid_idx1 vvp_tests/partsel_invalid_idx1.json
partsel_invalid_idx2 vvp_tests/partsel_invalid_idx2.json

View File

@ -0,0 +1,5 @@
{
"type" : "CE",
"source" : "named_event_edge_fail.v",
"iverilog-args" : [ "-g2005-sv" ]
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "named_event_negedge_fail.v"
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "named_event_posedge_fail.v"
}