Allow io-range-error warnings to be disabled (issue #788)

It was common practice in the past to just declare a port direction
and declare it as a vector in a subsequent type declaration. Versions
of the standard up to and including 1364-2005 include an example that
does this (e.g. 1364-2005 section 12.3.7). Users may have old or
third-party code that they can't or don't want to modify, so allow
the warning to be suppressed by including it in the anachronisms
category.
This commit is contained in:
Martin Whitaker 2022-12-18 12:12:26 +00:00
parent 2d6243ea6c
commit c8a85877c2
5 changed files with 28 additions and 7 deletions

View File

@ -122,7 +122,8 @@ practice in the past to only specify the range for the net/register
declaration and some tools still allow this. By default any mismatch is declaration and some tools still allow this. By default any mismatch is
reported as a error. Using \fB\-gno\-io\-range\-error\fP will produce a reported as a error. Using \fB\-gno\-io\-range\-error\fP will produce a
warning instead of a fatal error for the case of a vectored net/register warning instead of a fatal error for the case of a vectored net/register
and a scalar port declaration. and a scalar port declaration. This warning is included in the
\fBanachronisms\fP category.
.TP 8 .TP 8
.B -gstrict-ca-eval\fI|\fP-gno-strict-ca-eval .B -gstrict-ca-eval\fI|\fP-gno-strict-ca-eval
The standard requires that if any input to a continuous assignment The standard requires that if any input to a continuous assignment

View File

@ -1080,17 +1080,17 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
dimensions_ok) { dimensions_ok) {
/* Scalar port with a vector net/etc. definition */ /* Scalar port with a vector net/etc. definition */
if (port_.empty()) { if (port_.empty()) {
if (!gn_io_range_error_flag) { if (gn_io_range_error_flag) {
cerr << get_fileline()
<< ": warning: Scalar port ``" << name_
<< "'' has a vectored net declaration "
<< nlist << "." << endl;
} else {
cerr << get_fileline() cerr << get_fileline()
<< ": error: Scalar port ``" << name_ << ": error: Scalar port ``" << name_
<< "'' has a vectored net declaration " << "'' has a vectored net declaration "
<< nlist << "." << endl; << nlist << "." << endl;
des->errors += 1; des->errors += 1;
} else if (warn_anachronisms) {
cerr << get_fileline()
<< ": warning: Scalar port ``" << name_
<< "'' has a vectored net declaration "
<< nlist << "." << endl;
} }
} }

View File

@ -0,0 +1 @@
42

View File

@ -0,0 +1,18 @@
module test();
task print_hex;
input n;
reg [7:0] n;
begin
$display("%h", n);
end
endtask
initial begin
print_hex(66);
end
endmodule

View File

@ -349,6 +349,7 @@ br_gh632b normal,-S ivltests
br_gh632c normal ivltests br_gh632c normal ivltests
br_gh674 normal ivltests br_gh674 normal ivltests
br_gh732 normal ivltests gold=br_gh732.gold br_gh732 normal ivltests gold=br_gh732.gold
br_gh788 normal,-gno-io-range-error,-Wno-anachronisms ivltests gold=br_gh788.gold
br_gh793 normal ivltests br_gh793 normal ivltests
br_ml20150315 normal ivltests gold=br_ml_20150315.gold br_ml20150315 normal ivltests gold=br_ml_20150315.gold
br_ml20150321 CE ivltests br_ml20150321 CE ivltests