mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 16:40:12 +02:00
Add --autoflush option
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
// For each wide OP, make a a temporary variable with the wide value
|
||||
// For each deep expression, assign expression to temporary.
|
||||
//
|
||||
// Each display (independant transformation; here as Premit is a good point)
|
||||
// If autoflush, insert a flush
|
||||
//
|
||||
//*************************************************************************
|
||||
|
||||
#include "config_build.h"
|
||||
@@ -264,6 +267,26 @@ private:
|
||||
checkNode(nodep);
|
||||
}
|
||||
|
||||
// Autoflush
|
||||
virtual void visit(AstDisplay* nodep, AstNUser* vup) {
|
||||
startStatement(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
m_stmtp = NULL;
|
||||
if (v3Global.opt.autoflush()) {
|
||||
AstNode* searchp = nodep->nextp();
|
||||
while (searchp && searchp->castComment()) searchp = searchp->nextp();
|
||||
if (searchp
|
||||
&& searchp->castDisplay()
|
||||
&& nodep->filep()->sameTree(searchp->castDisplay()->filep())) {
|
||||
// There's another display next; we can just wait to flush
|
||||
} else {
|
||||
UINFO(4,"Autoflush "<<nodep<<endl);
|
||||
nodep->addNextHere(new AstFFlush(nodep->fileline(),
|
||||
nodep->filep()->cloneTree(true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstVar* nodep, AstNUser*) {} // Don't hit varrefs under vars
|
||||
|
||||
Reference in New Issue
Block a user