diff --git a/Changes b/Changes index 069109135..00de14e03 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks! Disabled unless -OD or -O3 used, please try it as may get some significant speedups. +*** Fix wrong dot resolution under inlining. [Art Stamness] + **** Support pattern assignment features, bug616, bug617, bug618. [Ed Lander] **** Support bind in $unit, bug602. [Ed Lander] diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index a30fb78e8..6ea38e28d 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1114,10 +1114,14 @@ private: } virtual void visit(AstScope* nodep, AstNUser*) { UINFO(8," "<getScopeSym(nodep); + m_ds.m_dotSymp = m_curSymp = m_modSymp = m_statep->getScopeSym(nodep); nodep->iterateChildren(*this); - m_ds.m_dotSymp = m_curSymp = NULL; + m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL; + m_modSymp = oldModSymp; + m_curSymp = oldCurSymp; } virtual void visit(AstCellInline* nodep, AstNUser*) { checkNoDot(nodep); @@ -1320,6 +1324,7 @@ private: newp = new AstVarRef(nodep->fileline(), nodep->name(), false); // lvalue'ness computed later newp->varp(varp); newp->packagep(foundp->packagep()); + UINFO(9," new "<replaceWith(newp); pushDeletep(nodep); nodep = NULL; m_ds.m_dotPos = DP_MEMBER; @@ -1442,6 +1447,7 @@ private: AstVarRef* newvscp = new AstVarRef(nodep->fileline(), vscp, nodep->lvalue()); nodep->replaceWith(newvscp); nodep->deleteTree(); nodep=NULL; + UINFO(9," new "<10) begin +`ifdef TEST_VERBOSE $display("%m: csub.clocal=%0d dlocal=%0d", csub.clocal, dlocal); `endif + if (csub.clocal !== n) $stop; + if (dlocal !== n) $stop; + end + if (cyc==99) begin + $write("*-* All Finished *-*\n"); + $finish; + end + end +endmodule diff --git a/test_regress/t/t_inst_dtree_inla.pl b/test_regress/t/t_inst_dtree_inla.pl new file mode 100755 index 000000000..fe688b136 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inla.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_A'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlab.pl b/test_regress/t/t_inst_dtree_inlab.pl new file mode 100755 index 000000000..01b6ddf38 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlab.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_A +define+INLINE_B'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlac.pl b/test_regress/t/t_inst_dtree_inlac.pl new file mode 100755 index 000000000..1125007cf --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlac.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_A +define+INLINE_C'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlad.pl b/test_regress/t/t_inst_dtree_inlad.pl new file mode 100755 index 000000000..691fa1822 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlad.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_A +define+INLINE_D'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlb.pl b/test_regress/t/t_inst_dtree_inlb.pl new file mode 100755 index 000000000..3113b83b1 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlb.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_B'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlbc.pl b/test_regress/t/t_inst_dtree_inlbc.pl new file mode 100755 index 000000000..cb87439b8 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlbc.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_B +define+INLINE_C'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlbd.pl b/test_regress/t/t_inst_dtree_inlbd.pl new file mode 100755 index 000000000..bfffeb2fa --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlbd.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_B +define+INLINE_D'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlc.pl b/test_regress/t/t_inst_dtree_inlc.pl new file mode 100755 index 000000000..06ac28071 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlc.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_C'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inlcd.pl b/test_regress/t/t_inst_dtree_inlcd.pl new file mode 100755 index 000000000..1023f1a43 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inlcd.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_C +define+INLINE_D'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_inst_dtree_inld.pl b/test_regress/t/t_inst_dtree_inld.pl new file mode 100755 index 000000000..bfb903e56 --- /dev/null +++ b/test_regress/t/t_inst_dtree_inld.pl @@ -0,0 +1,22 @@ +#!/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_inst_dtree.v"); + +compile ( + v_flags2 => ['+define+INLINE_D'], + verilator_flags2 => ['-trace'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1;