mirror of
https://github.com/verilator/verilator.git
synced 2025-04-05 04:02:37 +00:00
Cleaner tristate error. #2117.
This commit is contained in:
parent
623c4ec103
commit
7024ea8cb6
@ -1155,7 +1155,9 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||||||
AstVar* outModVarp = static_cast<AstVar*>(nodep->modVarp()->user4p());
|
AstVar* outModVarp = static_cast<AstVar*>(nodep->modVarp()->user4p());
|
||||||
if (!outModVarp) {
|
if (!outModVarp) {
|
||||||
// At top, no need for __out as might be input only. Otherwise resolvable.
|
// At top, no need for __out as might be input only. Otherwise resolvable.
|
||||||
UASSERT_OBJ(m_modp->isTop(), nodep, "Unlinked");
|
if (!m_modp->isTop()) {
|
||||||
|
nodep->v3error("Unsupported: tristate in top-level IO: " << nodep->prettyNameQ());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AstNode* outexprp = nodep->exprp()->cloneTree(false); // Note has lvalue() set
|
AstNode* outexprp = nodep->exprp()->cloneTree(false); // Note has lvalue() set
|
||||||
outpinp = new AstPin(nodep->fileline(),
|
outpinp = new AstPin(nodep->fileline(),
|
||||||
|
5
test_regress/t/t_tri_compass_bad.out
Normal file
5
test_regress/t/t_tri_compass_bad.out
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
%Error: t/t_tri_compass_bad.v:15: Unsupported: tristate in top-level IO: '__pinNumber1'
|
||||||
|
: ... In instance t
|
||||||
|
sub sub(i, o);
|
||||||
|
^
|
||||||
|
%Error: Exiting due to
|
18
test_regress/t/t_tri_compass_bad.pl
Executable file
18
test_regress/t/t_tri_compass_bad.pl
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 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.
|
||||||
|
|
||||||
|
scenarios(vlt => 1);
|
||||||
|
|
||||||
|
compile(
|
||||||
|
expect_filename => $Self->{golden_filename},
|
||||||
|
fails => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
20
test_regress/t/t_tri_compass_bad.v
Normal file
20
test_regress/t/t_tri_compass_bad.v
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
|
// without warranty, 2020 by Wilson Snyder.
|
||||||
|
|
||||||
|
module t(/*AUTOARG*/
|
||||||
|
// Outputs
|
||||||
|
o,
|
||||||
|
// Inputs
|
||||||
|
i
|
||||||
|
);
|
||||||
|
|
||||||
|
input i;
|
||||||
|
output o;
|
||||||
|
sub sub(i, o);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module sub(input i, output o);
|
||||||
|
assign o = (i===1'bz) ? 1'b0 : i;
|
||||||
|
endmodule
|
Loading…
Reference in New Issue
Block a user