Fix LITENDIAN warning is backwards (#3966) (#3967).

This commit is contained in:
Cameron Kirk 2023-03-01 08:46:44 -08:00 committed by GitHub
parent 08a433260c
commit faf3804b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 16 deletions

View File

@ -14,6 +14,7 @@ Ameya Vikram Singh
Andreas Kuster Andreas Kuster
Andrew Nolte Andrew Nolte
Arkadiusz Kozdra Arkadiusz Kozdra
Cameron Kirk
Chris Randall Chris Randall
Chuxuan Wang Chuxuan Wang
Conor McCullough Conor McCullough

View File

@ -850,14 +850,14 @@ List Of Warnings
.. TODO better example .. TODO better example
Warns that a packed vector is declared with little endian bit numbering Warns that a packed vector is declared with big endian bit numbering
(i.e. [0:7]). Big endian bit numbering is now the overwhelming (i.e. [0:7]). Little endian bit numbering is now the overwhelming
standard, and little numbering is now thus often due to simple oversight standard, and big numbering is now thus often due to simple oversight
instead of intent. instead of intent.
It also warns that an instance is declared with little endian range It also warns that an instance is declared with big endian range
(i.e. [0:7] or [7]) and is connected to an N-wide signal. Based on IEEE (i.e. [0:7] or [7]) and is connected to an N-wide signal.
the bits will likely be backward from what people may expect The bits will likely be backward from what people may expect
(i.e., instance [0] will connect to signal bit [N-1] not bit [0]). (i.e., instance [0] will connect to signal bit [N-1] not bit [0]).
Ignoring this warning will only suppress the lint check; it will Ignoring this warning will only suppress the lint check; it will

View File

@ -343,7 +343,7 @@ private:
// Arrayed instants: one bit for each of the instants (each // Arrayed instants: one bit for each of the instants (each
// assign is 1 modwidth wide) // assign is 1 modwidth wide)
if (m_cellRangep->littleEndian()) { if (m_cellRangep->littleEndian()) {
nodep->exprp()->v3warn(LITENDIAN, "Little endian instance range connecting to " nodep->exprp()->v3warn(LITENDIAN, "Big endian instance range connecting to "
"vector: left < right of instance range: [" "vector: left < right of instance range: ["
<< m_cellRangep->leftConst() << ":" << m_cellRangep->leftConst() << ":"
<< m_cellRangep->rightConst() << "]"); << m_cellRangep->rightConst() << "]");

View File

@ -860,7 +860,7 @@ private:
// Note width() not set on range; use elementsConst() // Note width() not set on range; use elementsConst()
if (nodep->littleEndian() && !VN_IS(nodep->backp(), UnpackArrayDType) if (nodep->littleEndian() && !VN_IS(nodep->backp(), UnpackArrayDType)
&& !VN_IS(nodep->backp(), Cell)) { // For cells we warn in V3Inst && !VN_IS(nodep->backp(), Cell)) { // For cells we warn in V3Inst
nodep->v3warn(LITENDIAN, "Little bit endian vector: left < right of bit range: [" nodep->v3warn(LITENDIAN, "Big bit endian vector: left < right of bit range: ["
<< nodep->leftConst() << ":" << nodep->rightConst() << nodep->leftConst() << ":" << nodep->rightConst()
<< "]"); << "]");
} }

View File

@ -31,6 +31,7 @@ foreach my $s (
'dynamic new() not expected in this context (expected under an assign)', # Instead get syntax error 'dynamic new() not expected in this context (expected under an assign)', # Instead get syntax error
# Not yet analyzed # Not yet analyzed
' is not an in/out/inout/param/interface: ', ' is not an in/out/inout/param/interface: ',
'Big endian instance range connecting to ',
' loading non-variable', ' loading non-variable',
'--pipe-filter protocol error, unexpected: ', '--pipe-filter protocol error, unexpected: ',
'/*verilator sformat*/ can only be applied to last argument of ', '/*verilator sformat*/ can only be applied to last argument of ',

View File

@ -1,18 +1,18 @@
%Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:26:26: Little endian instance range connecting to vector: left < right of instance range: [0:2] %Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:26:26: Big endian instance range connecting to vector: left < right of instance range: [0:2]
: ... In instance t : ... In instance t
26 | foo_intf foos [N] (.x(X)); 26 | foo_intf foos [N] (.x(X));
| ^ | ^
... For warning description see https://verilator.org/warn/LITENDIAN?v=latest ... For warning description see https://verilator.org/warn/LITENDIAN?v=latest
... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message. ... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message.
%Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:27:28: Little endian instance range connecting to vector: left < right of instance range: [1:3] %Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:27:28: Big endian instance range connecting to vector: left < right of instance range: [1:3]
: ... In instance t : ... In instance t
27 | foo_intf fool [1:3] (.x(X)); 27 | foo_intf fool [1:3] (.x(X));
| ^ | ^
%Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:30:26: Little endian instance range connecting to vector: left < right of instance range: [0:2] %Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:30:26: Big endian instance range connecting to vector: left < right of instance range: [0:2]
: ... In instance t : ... In instance t
30 | foo_subm subs [N] (.x(X)); 30 | foo_subm subs [N] (.x(X));
| ^ | ^
%Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:31:28: Little endian instance range connecting to vector: left < right of instance range: [1:3] %Warning-LITENDIAN: t/t_interface_array_nocolon_bad.v:31:28: Big endian instance range connecting to vector: left < right of instance range: [1:3]
: ... In instance t : ... In instance t
31 | foo_subm subl [1:3] (.x(X)); 31 | foo_subm subl [1:3] (.x(X));
| ^ | ^

View File

@ -1,10 +1,10 @@
%Warning-LITENDIAN: t/t_metacmt_onoff.v:8:8: Little bit endian vector: left < right of bit range: [0:1] %Warning-LITENDIAN: t/t_metacmt_onoff.v:8:8: Big bit endian vector: left < right of bit range: [0:1]
: ... In instance t : ... In instance t
8 | reg [0:1] show1; /*verilator lint_off LITENDIAN*/ reg [0:2] ign2; /*verilator lint_on LITENDIAN*/ reg [0:3] show3; 8 | reg [0:1] show1; /*verilator lint_off LITENDIAN*/ reg [0:2] ign2; /*verilator lint_on LITENDIAN*/ reg [0:3] show3;
| ^ | ^
... For warning description see https://verilator.org/warn/LITENDIAN?v=latest ... For warning description see https://verilator.org/warn/LITENDIAN?v=latest
... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message. ... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message.
%Warning-LITENDIAN: t/t_metacmt_onoff.v:8:109: Little bit endian vector: left < right of bit range: [0:3] %Warning-LITENDIAN: t/t_metacmt_onoff.v:8:109: Big bit endian vector: left < right of bit range: [0:3]
: ... In instance t : ... In instance t
8 | reg [0:1] show1; /*verilator lint_off LITENDIAN*/ reg [0:2] ign2; /*verilator lint_on LITENDIAN*/ reg [0:3] show3; 8 | reg [0:1] show1; /*verilator lint_off LITENDIAN*/ reg [0:2] ign2; /*verilator lint_on LITENDIAN*/ reg [0:3] show3;
| ^ | ^

View File

@ -7,7 +7,7 @@
// used in the test module to set the value of MSB. A number of warnings and // used in the test module to set the value of MSB. A number of warnings and
// errors follow, starting with: // errors follow, starting with:
// //
// %Warning-LITENDIAN: t/t_param_module.v:42: Little bit endian vector: MSB // %Warning-LITENDIAN: t/t_param_module.v:42: Big bit endian vector: MSB
// < LSB of bit range: -17:0 // < LSB of bit range: -17:0
// //
// This file ONLY is placed into the Public Domain, for any use, without // This file ONLY is placed into the Public Domain, for any use, without

View File

@ -1,4 +1,4 @@
%Warning-LITENDIAN: t/t_select_bad_msb.v:12:8: Little bit endian vector: left < right of bit range: [0:22] %Warning-LITENDIAN: t/t_select_bad_msb.v:12:8: Big bit endian vector: left < right of bit range: [0:22]
: ... In instance t : ... In instance t
12 | reg [0:22] backwd; 12 | reg [0:22] backwd;
| ^ | ^