Exemplo n.º 1
0
    virtual void visit(AstVar* nodep, AstNUser*) {
	// Make new scope variable
	if (m_modp->castPackage()
	    ? !nodep->user3p() : !nodep->user1p()) {
	    AstVarScope* varscp = new AstVarScope(nodep->fileline(), m_scopep, nodep);
	    UINFO(6,"   New scope "<<varscp<<endl);
	    nodep->user1p(varscp);
	    if (m_modp->castPackage()) nodep->user3p(varscp);
	    m_scopep->addVarp(varscp);
	}
    }
Exemplo n.º 2
0
    virtual void visit(AstTypedef* nodep, AstNUser*) {
	nodep->iterateChildren(*this);
	checkAll(nodep);
	// Don't let packages with only public variables disappear
	// Normal modules may disappear, e.g. if they are parameterized then removed
	if (nodep->attrPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
    }
Exemplo n.º 3
0
    virtual void visit(AstVar* nodep, AstNUser*) {
	nodep->iterateChildren(*this);
	checkAll(nodep);
	if (nodep->isSigPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
	if (mightElim(nodep)) {
	    m_varEtcsp.push_back(nodep);
	}
    }
Exemplo n.º 4
0
void V3LinkLevel::wrapTopPackages(AstNetlist* netlistp) {
    // Instantiate all packages under the top wrapper
    // This way all later SCOPE based optimizations can ignore packages
    AstNodeModule* newmodp = netlistp->modulesp();
    if (!newmodp || !newmodp->isTop()) netlistp->v3fatalSrc("No TOP module found to process");
    for (AstNodeModule* modp = netlistp->modulesp(); modp; modp=modp->nextp()->castNodeModule()) {
	if (modp->castPackage()) {
	    AstCell* cellp = new AstCell(modp->fileline(),
					 // Could add __03a__03a="::" to prevent conflict
					 // with module names/"v"
					 modp->name(),
					 modp->name(),
					 NULL, NULL, NULL);
	    cellp->modp(modp);
	    newmodp->addStmtp(cellp);
	}
    }
}