Merge pull request #942 from larsclausen/implicit-named-port-connections

Fix line location and require SystemVerilog mode for implicit named port connections
This commit is contained in:
Cary R 2023-06-14 07:16:28 -07:00 committed by GitHub
commit 0643a3a1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 8 deletions

View File

@ -0,0 +1,4 @@
ivltests/br_gh939.v:10: error: Net o is not defined in this context.
ivltests/br_gh939.v:10: error: Output port expression must support continuous assignment.
ivltests/br_gh939.v:10: : Port 1 (o) of M is connected to o
2 error(s) during elaboration.

View File

@ -0,0 +1,11 @@
// Check the line and file information for errors related to implicit named port
// connections are correct.
module M(
output o
);
endmodule
module test;
M i_m(.o); // Error, no net named o
endmodule

View File

@ -325,7 +325,7 @@ br_gh283a normal ivltests
br_gh283b normal ivltests
br_gh283c normal ivltests
br_gh309 normal ivltests
br_gh315 normal,-gspecify ivltests
br_gh315 normal,-g2005-sv,-gspecify ivltests
br_gh316a normal,-gspecify ivltests
br_gh316b normal,-gspecify ivltests
br_gh316c normal,-gspecify ivltests

View File

@ -5,6 +5,7 @@
array_packed_write_read vvp_tests/array_packed_write_read.json
br_gh13a vvp_tests/br_gh13a.json
br_gh13a-vlog95 vvp_tests/br_gh13a-vlog95.json
br_gh939 vvp_tests/br_gh939.json
case1 vvp_tests/case1.json
case2 vvp_tests/case2.json
case2-S vvp_tests/case2-S.json

View File

@ -114,6 +114,15 @@ def run_cmd(cmd: list) -> subprocess.CompletedProcess:
res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return res
def check_gold(it_key : str, it_gold : str, log_list : list) -> bool:
compared = True
for log_name in log_list:
log_path = os.path.join("log", "{key}-{log}.log".format(key=it_key, log=log_name))
gold_path = os.path.join("gold", "{gold}-{log}.gold".format(gold=it_gold, log=log_name))
compared = compared and compare_files(log_path, gold_path)
return compared
def run_CE(options : dict) -> list:
''' Run the compiler, and expect an error
@ -123,6 +132,7 @@ def run_CE(options : dict) -> list:
it_key = options['key']
it_dir = options['directory']
it_args = options['iverilog_args']
it_gold = options['gold']
build_runtime(it_key)
@ -130,10 +140,14 @@ def run_CE(options : dict) -> list:
res = run_cmd(cmd)
log_results(it_key, "iverilog", res)
log_list = ["iverilog-stdout", "iverilog-stderr"]
if res.returncode == 0:
return [1, "Failed - CE (no error reported)"]
elif res.returncode >= 256:
return [1, "Failed - CE (execution error)"]
elif it_gold is not None and not check_gold(it_key, it_gold, log_list):
return [1, "Failed - CE (Gold output doesn't match actual output.)"]
else:
return [0, "Passed - CE"]
@ -150,11 +164,7 @@ def check_run_outputs(options : dict, expected_fail : bool, it_stdout : str, log
it_diff = options['diff']
if it_gold is not None:
compared = True
for log_name in log_list:
log_path = os.path.join("log", "{key}-{log}.log".format(key=it_key, log=log_name))
gold_path = os.path.join("gold", "{gold}-{log}.gold".format(gold=it_gold, log=log_name))
compared = compared and compare_files(log_path, gold_path)
compared = check_gold(it_key, it_gold, log_list)
if expected_fail:
if compared:

View File

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

View File

@ -5728,10 +5728,11 @@ port_name
$$ = tmp;
}
| attribute_list_opt '.' IDENTIFIER
{ named_pexpr_t*tmp = new named_pexpr_t;
{ pform_requires_sv(@3, "Implicit named port connections");
named_pexpr_t*tmp = new named_pexpr_t;
tmp->name = lex_strings.make($3);
tmp->parm = new PEIdent(lex_strings.make($3), true);
FILE_NAME(tmp->parm, @1);
FILE_NAME(tmp->parm, @3);
delete[]$3;
delete $1;
$$ = tmp;