From 3ff10b40d61ea073a70959ba285d9e22c7083674 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 23 Jan 2007 18:11:26 +0000 Subject: [PATCH] Fix isolate_assignments when many signals per always. git-svn-id: file://localhost/svn/verilator/trunk/verilator@877 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 2 ++ bin/verilator | 7 ++++--- src/V3AstNodes.h | 2 +- src/V3SplitAs.cpp | 15 +++++++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index bac030e08..b2392e09f 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! *** Add --trace-depth option for minimizing VCD file size. [Emerson Suguimoto] +**** Fix isolate_assignments when many signals per always. [Mike Shinkarovsky] + * Verilator 3.632 1/17/2007 *** Add /*verilator isolate_assignments*/ attribute. [Mike Shinkarovsky] diff --git a/bin/verilator b/bin/verilator index ff5244c5d..8e4815aaf 100755 --- a/bin/verilator +++ b/bin/verilator @@ -108,6 +108,7 @@ if ($Opt_Sp eq 'sp' || $Opt_Trace) { $ENV{SYSTEMPERL} = $try if -d $try; } (defined $ENV{SYSTEMPERL}) or die "%Error: verilator: Need \$SYSTEMPERL in environment for --sp or --trace\nProbably System-Perl isn't installed, see http://www.veripool.com/systemperl.html\n"; + (-d "$ENV{SYSTEMPERL}/src") or die "%Error: verilator: \$SYSTEMPERL environment var doesn't seem to point to System-Perl kit\n"; } # Determine runtime flags @@ -1082,7 +1083,7 @@ submodules will be named I__DOT__I as C++ does not allow "." in signal names. SystemPerl when tracing such signals will replace the __DOT__ with the period. -=item /*verilator isolate_asignments*/ +=item /*verilator isolate_assignments*/ Used after a signal declaration to indicate the assignments to this signal in any blocks should be isolated into new blocks. When there is a large @@ -1091,7 +1092,7 @@ this to the signal causing a false loop may clear up the problem. IE, with the following - reg splitme /* verilator isolate_asignments*/; + reg splitme /* verilator isolate_assignments*/; always @* begin if (....) begin splitme = ....; @@ -1570,7 +1571,7 @@ clock_enable meta comment described above. The UNOPTFLAT warning may also occur where outputs from a block of logic are independent, but occur in the same always block. To fix this, use the -isolate_asignments meta comment described above. +isolate_assignments meta comment described above. =item UNSIGNED diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 1f332489f..16ce01159 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -241,7 +241,7 @@ private: bool m_funcLocal:1; // Local variable for a function bool m_funcReturn:1; // Return variable for a function bool m_attrClockEn:1;// User clock enable attribute - bool m_attrIsolateAssign:1;// User isolate_asignments attribute + bool m_attrIsolateAssign:1;// User isolate_assignments attribute bool m_fileDescr:1; // File descriptor bool m_isConst:1; // Table contains constant data bool m_isStatic:1; // Static variable diff --git a/src/V3SplitAs.cpp b/src/V3SplitAs.cpp index 2021e82d1..b51550b87 100644 --- a/src/V3SplitAs.cpp +++ b/src/V3SplitAs.cpp @@ -20,7 +20,7 @@ //************************************************************************* // V3SplitAs's Transformations: // -// Search each ALWAYS for a VARREF lvalue with a /*isolate_asignments*/ attribute +// Search each ALWAYS for a VARREF lvalue with a /*isolate_assignments*/ attribute // If found, color statements with both, assignment to that varref, or other assignments. // Replicate the Always, and remove mis-colored duplicate code. // @@ -166,12 +166,23 @@ private: virtual void visit(AstAlways* nodep, AstNUser*) { // Are there any lvalue references below this? // There could be more then one. So, we process the first one found first. - if (!nodep->user()) { + AstVarScope* lastSplitVscp = NULL; + while (!nodep->user()) { + // Find any splittable variables SplitAsFindVisitor visitor (nodep); m_splitVscp = visitor.splitVscp(); + if (m_splitVscp && m_splitVscp == lastSplitVscp) { + // We did this last time! Something's stuck! + nodep->v3fatalSrc("Infinite loop in isolate_assignments removal for: "<prettyName()) + m_splitVscp = NULL; + } + lastSplitVscp = m_splitVscp; + // Now isolate the always if (m_splitVscp) { splitAlways(nodep); m_statSplits++; + } else { + nodep->user(true); } } }