mirror of
https://github.com/verilator/verilator.git
synced 2025-01-06 06:37:45 +00:00
parent
9029da5ab8
commit
1c1c805b07
@ -104,3 +104,4 @@ Yossi Nivin
|
||||
Yuri Victorovich
|
||||
Yutetsu TAKATSUKASA
|
||||
Yves Mathieu
|
||||
Zhanglei Wang
|
||||
|
@ -1346,10 +1346,15 @@ private:
|
||||
&& (nodep->msbConst() > maxDeclBit || nodep->lsbConst() > maxDeclBit)) {
|
||||
// See also warning in V3Width
|
||||
// Must adjust by element width as declRange() is in number of elements
|
||||
string msbLsbProtected;
|
||||
if (nodep->declElWidth() == 0) {
|
||||
msbLsbProtected = "(nodep->declElWidth() == 0) " + std::to_string(nodep->msbConst()) + ":" + std::to_string(nodep->lsbConst());
|
||||
} else {
|
||||
msbLsbProtected = std::to_string(nodep->msbConst() / nodep->declElWidth()) + ":" + std::to_string(nodep->lsbConst() / nodep->declElWidth());
|
||||
}
|
||||
nodep->v3warn(SELRANGE,
|
||||
"Selection index out of range: "
|
||||
<< (nodep->msbConst() / nodep->declElWidth()) << ":"
|
||||
<< (nodep->lsbConst() / nodep->declElWidth()) << " outside "
|
||||
<< msbLsbProtected << " outside "
|
||||
<< nodep->declRange().hiMaxSelect() << ":0"
|
||||
<< (nodep->declRange().lo() >= 0
|
||||
? ""
|
||||
|
7
test_regress/t/t_bigmem_bad.out
Normal file
7
test_regress/t/t_bigmem_bad.out
Normal file
@ -0,0 +1,7 @@
|
||||
%Warning-SELRANGE: t/t_bigmem_bad.v:14:19: Selection index out of range: (nodep->declElWidth() == 0) -1:0 outside 268435455:0
|
||||
: ... In instance t_bigmem
|
||||
14 | if (wen) mem[addr] <= data;
|
||||
| ^
|
||||
... For warning description see https://verilator.org/warn/SELRANGE?v=latest
|
||||
... Use "/* verilator lint_off SELRANGE */" and lint_on around source to disable this message.
|
||||
%Error: Exiting due to
|
19
test_regress/t/t_bigmem_bad.pl
Executable file
19
test_regress/t/t_bigmem_bad.pl
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2021 by filamoon. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
scenarios(linter => 1);
|
||||
|
||||
lint(
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
16
test_regress/t/t_bigmem_bad.v
Normal file
16
test_regress/t/t_bigmem_bad.v
Normal file
@ -0,0 +1,16 @@
|
||||
// This test shall generate a warning, but not an internal error.
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2021 by Zhanglei Wang.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
module t_bigmem(
|
||||
input wire clk,
|
||||
input wire [27:0] addr,
|
||||
input wire [255:0] data,
|
||||
input wire wen
|
||||
);
|
||||
reg [(1<<28)-1:0][255:0] mem;
|
||||
always @(posedge clk) begin
|
||||
if (wen) mem[addr] <= data;
|
||||
end
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user