diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 805417659..54a35b9f5 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -1036,6 +1036,10 @@ class TristateVisitor : public TristateBaseVisitor { nodep->user2(U2_GRAPHING); AstVar* enModVarp = (AstVar*) nodep->modVarp()->user1p(); if (!enModVarp) { + if (nodep->exprp()) { + // May have an output only that later connects to a tristate, so simplify now. + V3Inst::pinReconnectSimple(nodep, m_cellp, m_modp, false); + } iteratePinGuts(nodep); return; // No __en signals on this pin } diff --git a/test_regress/t/t_tri_graph.pl b/test_regress/t/t_tri_graph.pl new file mode 100755 index 000000000..3d2231550 --- /dev/null +++ b/test_regress/t/t_tri_graph.pl @@ -0,0 +1,15 @@ +#!/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. + +# Compile only test +compile ( + ); + +ok(1); +1; diff --git a/test_regress/t/t_tri_graph.v b/test_regress/t/t_tri_graph.v new file mode 100644 index 000000000..fde19535d --- /dev/null +++ b/test_regress/t/t_tri_graph.v @@ -0,0 +1,27 @@ +// DESCRIPTION: Verilator: Unsupported tristate constructur error +// +// This is a compile only regression test of tristate handling for bug514 +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2012 by Jeremy Bennett. + +module t (/*AUTOARG*/ + // Inputs + clk + ); + input clk; + + wire [11:0] ck; + + assign ck[1:0] = {1'bz,{1{1'b0}}}; + + test i_test (.clk (ck[1:0])); + +endmodule + + +module test (clk); + + output wire [1:0] clk; + +endmodule // test