예제 #1
0
 virtual void visit(AstSel* nodep, AstNUser*) {
     AstVarRef* varrefp = nodep->fromp()->castVarRef();
     AstConst* constp = nodep->lsbp()->castConst();
     if (varrefp && constp && !constp->num().isFourState()) {
         UndrivenVarEntry* entryp = getEntryp (varrefp->varp());
         int lsb = constp->toUInt();
         if (m_markBoth || varrefp->lvalue()) entryp->drivenBit(lsb, nodep->width());
         if (m_markBoth || !varrefp->lvalue()) entryp->usedBit(lsb, nodep->width());
     } else {
         // else other varrefs handled as unknown mess in AstVarRef
         nodep->iterateChildren(*this);
     }
 }
예제 #2
0
    virtual void visit(AstSel* nodep, AstNUser*) {
	AstVarRef* varrefp = nodep->fromp()->castVarRef();
	AstConst* constp = nodep->lsbp()->castConst();
	if (varrefp && constp && !constp->num().isFourState()) {
	    for (int usr=1; usr<(m_alwaysp?3:2); ++usr) {
		UndrivenVarEntry* entryp = getEntryp (varrefp->varp(), usr);
		int lsb = constp->toUInt();
		if (m_markBoth || varrefp->lvalue()) {
		    // Don't warn if already driven earlier as "a=0; if(a) a=1;" is fine.
		    if (usr==2 && m_alwaysp && entryp->isUsedNotDrivenBit(lsb, nodep->width())) {
			UINFO(9," Select.  Entryp="<<(void*)entryp<<endl);
			warnAlwCombOrder(varrefp);
		    }
		    entryp->drivenBit(lsb, nodep->width());
		}
		if (m_markBoth || !varrefp->lvalue()) entryp->usedBit(lsb, nodep->width());
	    }
	} else {
	    // else other varrefs handled as unknown mess in AstVarRef
	    nodep->iterateChildren(*this);
	}
    }