Add enumeration assignment compatibility check for continuous assignments.

(cherry picked from commit 1b3f0dd689)
This commit is contained in:
Martin Whitaker 2020-11-20 17:01:15 +00:00
parent d521585901
commit 103f1fa4bb
1 changed files with 12 additions and 0 deletions

View File

@ -110,6 +110,18 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
return;
}
if (lval->enumeration()) {
if (! rval_expr->enumeration()) {
cerr << get_fileline() << ": error: "
"This assignment requires an explicit cast." << endl;
des->errors += 1;
} else if (! lval->enumeration()->matches(rval_expr->enumeration())) {
cerr << get_fileline() << ": error: "
"Enumeration type mismatch in assignment." << endl;
des->errors += 1;
}
}
NetNet*rval = rval_expr->synthesize(des, scope, rval_expr);
if (rval == 0) {