From 0431b1909c7700dd12ae8d2e46ebfa0a8261ed69 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 3 Nov 2012 08:01:19 -0400 Subject: [PATCH] Fix name collision on task inputs, bug569. --- Changes | 2 ++ src/V3LinkDot.cpp | 1 + src/V3SymTable.h | 2 +- test_regress/t/t_func_v.pl | 18 +++++++++++++++++ test_regress/t/t_func_v.v | 34 ++++++++++++++++++++++++++++++++ test_regress/t/t_func_v_noinl.pl | 21 ++++++++++++++++++++ 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100755 test_regress/t/t_func_v.pl create mode 100644 test_regress/t/t_func_v.v create mode 100755 test_regress/t/t_func_v_noinl.pl diff --git a/Changes b/Changes index 3f62906b0..923bc65a4 100644 --- a/Changes +++ b/Changes @@ -17,6 +17,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix name collision on unnamed blocks, bug567. [Chandan Egbert] +**** Fix name collision on task inputs, bug569. [Chandan Egbert] + * Verilator 3.841 2012/09/03 diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 220b433f2..2e2b51e50 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1365,6 +1365,7 @@ private: VSymEnt* okSymp; VSymEnt* dotSymp = m_curSymp; // Start search at current scope if (nodep->inlinedDots()!="") { // Correct for current scope + dotSymp = m_modSymp; // Dotted lookup is always relative to module, as maybe variable name lower down with same scope name we want to ignore (t_math_divw) string inl = AstNode::dedotName(nodep->inlinedDots()); dotSymp = m_statep->findDotted(dotSymp, inl, baddot, okSymp); if (!dotSymp) { diff --git a/src/V3SymTable.h b/src/V3SymTable.h index bf395ce9e..cddd0a32f 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -60,7 +60,7 @@ private: return level; } #else - static int debug() { return 0; } // NOT runtime, too hot of a function + static inline int debug() { return 0; } // NOT runtime, too hot of a function #endif public: void dumpIterate(ostream& os, VSymMap& doneSymsr, const string& indent, int numLevels, const string& searchName) { diff --git a/test_regress/t/t_func_v.pl b/test_regress/t/t_func_v.pl new file mode 100755 index 000000000..f91289753 --- /dev/null +++ b/test_regress/t/t_func_v.pl @@ -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. + +compile ( + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_func_v.v b/test_regress/t/t_func_v.v new file mode 100644 index 000000000..7f65b6067 --- /dev/null +++ b/test_regress/t/t_func_v.v @@ -0,0 +1,34 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2012 by Chandan Egbert. + +// See bug569 + +module t(); +`ifdef T_FUNC_V_NOINL + // verilator no_inline_module +`endif + level1 ul1(); + initial ul1.doit(4'b0); +endmodule + +module level1(); +`ifdef T_FUNC_V_NOINL + // verilator no_inline_module +`endif + level2 ul2(); + + task doit(input logic [3:0] v); + ul2.mem = v; + $write("*-* All Finished *-*\n"); + $finish; + endtask +endmodule + +module level2(); +`ifdef T_FUNC_V_NOINL + // verilator no_inline_module +`endif + logic [3:0] mem; +endmodule diff --git a/test_regress/t/t_func_v_noinl.pl b/test_regress/t/t_func_v_noinl.pl new file mode 100755 index 000000000..e271e1195 --- /dev/null +++ b/test_regress/t/t_func_v_noinl.pl @@ -0,0 +1,21 @@ +#!/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. + +top_filename("t/t_func_v.v"); + +compile ( + v_flags2 => ['+define+T_FUNC_V_NOINL',], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1;