From acc4490370184923b34c5adce422ec546e310e82 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 29 Dec 2010 20:24:31 -0500 Subject: [PATCH] For UNUSED, skip primitive tables --- src/V3Inst.cpp | 1 + src/V3Undriven.cpp | 3 +++ test_regress/t/t_lint_unused_bad.v | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index fd9932d36..2386dd7c3 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -123,6 +123,7 @@ private: virtual void visit(AstUdpTable* nodep, AstNUser*) { if (!v3Global.opt.bboxUnsup()) { + // If we support primitives, update V3Undriven to remove special case nodep->v3error("Unsupported: Verilog 1995 UDP Tables. Use --bbox-unsup to ignore tables."); } } diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 0efd0d7fe..5a76e6668 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -256,6 +256,9 @@ private: else entryp->usedWhole(); } + // Until we support tables, primitives will have undriven and unused I/Os + virtual void visit(AstPrimitive* nodep, AstNUser*) {} + // Coverage artifacts etc shouldn't count as a sink virtual void visit(AstCoverDecl* nodep, AstNUser*) {} virtual void visit(AstCoverInc* nodep, AstNUser*) {} diff --git a/test_regress/t/t_lint_unused_bad.v b/test_regress/t/t_lint_unused_bad.v index d1021f8e3..9464fa944 100644 --- a/test_regress/t/t_lint_unused_bad.v +++ b/test_regress/t/t_lint_unused_bad.v @@ -13,10 +13,11 @@ module t (/*AUTOARG*/ input in; // inputs don't get flagged as undriven output out; // outputs don't get flagged as unused - wire out = in; - sub sub (); + // Check we don't warn about unused UDP signals + udp_mux2 udpsub (out, in, in, in); + endmodule module sub; @@ -46,3 +47,17 @@ module sub; if (0 && mixed[1:0] != 0) begin end end endmodule + +primitive udp_mux2 (q, a, b, s); + output q; + input a, b, s; + table + //a b s : out + 1 ? 0 : 1 ; + 0 ? 0 : 0 ; + ? 1 1 : 1 ; + ? 0 1 : 0 ; + 0 0 x : 0 ; + 1 1 x : 1 ; + endtable +endprimitive