Merge pull request #1439 from larsclausen/ams-type-id-shadow
Support discipline and nature names shadowing type identifiers
This commit is contained in:
commit
4d07a8466c
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"type" : "normal",
|
||||||
|
"source" : "sv_type_identifier_discipline_name.v",
|
||||||
|
"iverilog-args" : [ "-g2005-sv", "-gverilog-ams" ]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"type" : "normal",
|
||||||
|
"source" : "sv_type_identifier_discipline_nature_ref.v",
|
||||||
|
"iverilog-args" : [ "-g2005-sv", "-gverilog-ams" ]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"type" : "normal",
|
||||||
|
"source" : "sv_type_identifier_nature_name.v",
|
||||||
|
"iverilog-args" : [ "-g2005-sv", "-gverilog-ams" ]
|
||||||
|
}
|
||||||
8
parse.y
8
parse.y
|
|
@ -3614,7 +3614,7 @@ delay_value_simple
|
||||||
optional_semicolon : ';' | ;
|
optional_semicolon : ';' | ;
|
||||||
|
|
||||||
discipline_declaration
|
discipline_declaration
|
||||||
: K_discipline IDENTIFIER optional_semicolon
|
: K_discipline identifier_name optional_semicolon
|
||||||
{ pform_start_discipline($2); }
|
{ pform_start_discipline($2); }
|
||||||
discipline_items K_enddiscipline
|
discipline_items K_enddiscipline
|
||||||
{ pform_end_discipline(@1); delete[] $2; }
|
{ pform_end_discipline(@1); delete[] $2; }
|
||||||
|
|
@ -3630,14 +3630,14 @@ discipline_item
|
||||||
{ pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
|
{ pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
|
||||||
| K_domain K_continuous ';'
|
| K_domain K_continuous ';'
|
||||||
{ pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
|
{ pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
|
||||||
| K_potential IDENTIFIER ';'
|
| K_potential identifier_name ';'
|
||||||
{ pform_discipline_potential(@1, $2); delete[] $2; }
|
{ pform_discipline_potential(@1, $2); delete[] $2; }
|
||||||
| K_flow IDENTIFIER ';'
|
| K_flow identifier_name ';'
|
||||||
{ pform_discipline_flow(@1, $2); delete[] $2; }
|
{ pform_discipline_flow(@1, $2); delete[] $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
nature_declaration
|
nature_declaration
|
||||||
: K_nature IDENTIFIER optional_semicolon
|
: K_nature identifier_name optional_semicolon
|
||||||
{ pform_start_nature($2); }
|
{ pform_start_nature($2); }
|
||||||
nature_items
|
nature_items
|
||||||
K_endnature
|
K_endnature
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue