mirror of
https://github.com/verilator/verilator.git
synced 2026-09-08 02:28:43 +02:00
Suppress WIDTH warnings when adding/subtracting 1'b1.
This commit is contained in:
@@ -1163,6 +1163,12 @@ void WidthVisitor::widthCheck (AstNode* nodep, const char* side,
|
||||
// Maybe this should be a special warning? Not for now.
|
||||
ignoreWarn = true;
|
||||
}
|
||||
if ((nodep->castAdd() && underp->width()==1 && underp->isOne())
|
||||
|| (nodep->castSub() && underp->width()==1 && underp->isOne() && 0==strcmp(side,"RHS"))) {
|
||||
// "foo + 1'b1", or "foo - 1'b1" are very common, people assume they extend correctly
|
||||
ignoreWarn = true;
|
||||
}
|
||||
|
||||
if (bad && !ignoreWarn) {
|
||||
if (debug()>4) nodep->backp()->dumpTree(cout," back: ");
|
||||
nodep->v3warn(WIDTH,"Operator "<<nodep->prettyTypeName()
|
||||
|
||||
Reference in New Issue
Block a user