Add regression tests for discipline and nature type identifier names

Check that nature and discipline declaration names can match visible type
identifiers. Also check `potential` and `flow` references to nature names that
are visible as type identifiers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-07-10 07:50:26 -07:00
parent 1d623a67d1
commit 0e3ac8685c
7 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,25 @@
// Check that discipline names can match visible type identifiers.
nature potential_nature;
units = "V";
access = POTENTIAL_ACCESS;
endnature
nature flow_nature;
units = "A";
access = FLOW_ACCESS;
endnature
typedef int DISCIPLINE_NAME;
discipline DISCIPLINE_NAME;
potential potential_nature;
flow flow_nature;
domain continuous;
enddiscipline
module test;
initial begin
$display("PASSED");
end
endmodule

View File

@ -0,0 +1,26 @@
// Check that discipline nature references can match visible type identifiers.
nature potential_nature;
units = "V";
access = POTENTIAL_ACCESS;
endnature
nature flow_nature;
units = "A";
access = FLOW_ACCESS;
endnature
typedef int potential_nature;
typedef int flow_nature;
discipline electrical;
potential potential_nature;
flow flow_nature;
domain continuous;
enddiscipline
module test;
initial begin
$display("PASSED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that nature names can match visible type identifiers.
typedef int NATURE_NAME;
nature NATURE_NAME;
units = "V";
access = NATURE_ACCESS;
endnature
module test;
initial begin
$display("PASSED");
end
endmodule

View File

@ -396,6 +396,8 @@ sv_type_identifier_attribute_name vvp_tests/sv_type_identifier_attribute_name.js
sv_type_identifier_attribute_target vvp_tests/sv_type_identifier_attribute_target.json sv_type_identifier_attribute_target vvp_tests/sv_type_identifier_attribute_target.json
sv_type_identifier_block_label_name vvp_tests/sv_type_identifier_block_label_name.json sv_type_identifier_block_label_name vvp_tests/sv_type_identifier_block_label_name.json
sv_type_identifier_config_name vvp_tests/sv_type_identifier_config_name.json sv_type_identifier_config_name vvp_tests/sv_type_identifier_config_name.json
sv_type_identifier_discipline_name vvp_tests/sv_type_identifier_discipline_name.json
sv_type_identifier_discipline_nature_ref vvp_tests/sv_type_identifier_discipline_nature_ref.json
sv_type_identifier_enum_item_name vvp_tests/sv_type_identifier_enum_item_name.json sv_type_identifier_enum_item_name vvp_tests/sv_type_identifier_enum_item_name.json
sv_type_identifier_event_name vvp_tests/sv_type_identifier_event_name.json sv_type_identifier_event_name vvp_tests/sv_type_identifier_event_name.json
sv_type_identifier_for_name vvp_tests/sv_type_identifier_for_name.json sv_type_identifier_for_name vvp_tests/sv_type_identifier_for_name.json
@ -413,6 +415,7 @@ sv_type_identifier_named_function_argument vvp_tests/sv_type_identifier_named_fu
sv_type_identifier_named_parameter_value vvp_tests/sv_type_identifier_named_parameter_value.json sv_type_identifier_named_parameter_value vvp_tests/sv_type_identifier_named_parameter_value.json
sv_type_identifier_named_port_connection vvp_tests/sv_type_identifier_named_port_connection.json sv_type_identifier_named_port_connection vvp_tests/sv_type_identifier_named_port_connection.json
sv_type_identifier_named_task_argument vvp_tests/sv_type_identifier_named_task_argument.json sv_type_identifier_named_task_argument vvp_tests/sv_type_identifier_named_task_argument.json
sv_type_identifier_nature_name vvp_tests/sv_type_identifier_nature_name.json
sv_type_identifier_net_name vvp_tests/sv_type_identifier_net_name.json sv_type_identifier_net_name vvp_tests/sv_type_identifier_net_name.json
sv_type_identifier_package_item vvp_tests/sv_type_identifier_package_item.json sv_type_identifier_package_item vvp_tests/sv_type_identifier_package_item.json
sv_type_identifier_package_name vvp_tests/sv_type_identifier_package_name.json sv_type_identifier_package_name vvp_tests/sv_type_identifier_package_name.json

View File

@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "sv_type_identifier_discipline_name.v",
"iverilog-args" : [ "-g2005-sv", "-gverilog-ams" ]
}

View File

@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "sv_type_identifier_discipline_nature_ref.v",
"iverilog-args" : [ "-g2005-sv", "-gverilog-ams" ]
}

View File

@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "sv_type_identifier_nature_name.v",
"iverilog-args" : [ "-g2005-sv", "-gverilog-ams" ]
}