Fix error on too many UDP port inputs
This commit is contained in:
parent
ac21d25d43
commit
54efa86a6c
|
|
@ -110,7 +110,6 @@ class UdpVisitor final : public VNVisitor {
|
|||
}
|
||||
AstNode* iNodep = nodep->iFieldsp();
|
||||
AstNode* oNodep = nodep->oFieldsp();
|
||||
uint32_t inputvars = 0;
|
||||
AstSenTree* edgetrigp = nullptr;
|
||||
|
||||
AstLogAnd* logandp = new AstLogAnd{fl, new AstConst{fl, AstConst::BitTrue{}},
|
||||
|
|
@ -118,7 +117,6 @@ class UdpVisitor final : public VNVisitor {
|
|||
|
||||
for (AstVar* itr : m_inputVars) {
|
||||
if (!iNodep) break;
|
||||
inputvars++;
|
||||
if (AstUdpTableLineVal* linevalp = VN_CAST(iNodep, UdpTableLineVal)) {
|
||||
string valName = linevalp->name();
|
||||
AstVarRef* const referencep = new AstVarRef{fl, itr, VAccess::READ};
|
||||
|
|
@ -141,6 +139,10 @@ class UdpVisitor final : public VNVisitor {
|
|||
}
|
||||
iNodep = iNodep->nextp();
|
||||
}
|
||||
|
||||
uint32_t inputvars = 0;
|
||||
for (const AstNode* icountp = nodep->iFieldsp(); icountp; icountp = icountp->nextp())
|
||||
++inputvars;
|
||||
if (inputvars != m_inputVars.size()) {
|
||||
nodep->v3error("Incorrect number of input values, expected " << m_inputVars.size()
|
||||
<< ", got " << inputvars);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
%Error: t/t_udp_bad_line_inputs.v:9:5: Incorrect number of input values, expected 1, got 5
|
||||
9 | ? 1 ? 0 0 : 0;
|
||||
| ^
|
||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||
%Error: Exiting due to
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2025 by Wilson Snyder. 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
|
||||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('linter')
|
||||
|
||||
test.lint(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2025 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
primitive udp_0(output o, input i);
|
||||
table
|
||||
? 1 ? 0 0 : 0; // <--- BAD too many inputs
|
||||
endtable
|
||||
endprimitive
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
%Error: t/t_udp_bad_line_outputs.v:9:11: syntax error, unexpected UDP table field, expecting : or UDP table line end
|
||||
9 | ? : 0 0 : 0;
|
||||
| ^
|
||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||
%Error: t/t_udp_bad_line_outputs.v:15:15: syntax error, unexpected UDP table field, expecting UDP table line end
|
||||
15 | ? : 0 : 0 0;
|
||||
| ^
|
||||
%Error: Cannot continue
|
||||
... This fatal error may be caused by the earlier error(s); resolve those first.
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2025 by Wilson Snyder. 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
|
||||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('linter')
|
||||
|
||||
test.lint(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2025 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
primitive udp_1(output reg o, input i);
|
||||
table
|
||||
? : 0 0 : 0; // <--- BAD too many recirc
|
||||
endtable
|
||||
endprimitive
|
||||
|
||||
primitive udp_2(output reg o, input i);
|
||||
table
|
||||
? : 0 : 0 0; // <--- BAD too many outputs
|
||||
endtable
|
||||
endprimitive
|
||||
Loading…
Reference in New Issue