Fix isolate_assignments when many signals per always.

git-svn-id: file://localhost/svn/verilator/trunk/verilator@877 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2007-01-23 18:11:26 +00:00
parent 7f515e6033
commit 3ff10b40d6
4 changed files with 20 additions and 6 deletions

View File

@ -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]

View File

@ -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<submodule>__DOT__I<subsignal> 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

View File

@ -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

View File

@ -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: "<<m_splitVscp->prettyName())
m_splitVscp = NULL;
}
lastSplitVscp = m_splitVscp;
// Now isolate the always
if (m_splitVscp) {
splitAlways(nodep);
m_statSplits++;
} else {
nodep->user(true);
}
}
}