Merge pull request #269 from nbrereton/features/nsb/check-case-handled

Validate that value is  handled for case priority qualifier.
This commit is contained in:
Stephen Williams 2019-10-09 09:00:31 -07:00 committed by GitHub
commit 55efaf8769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 2 deletions

View File

@ -652,9 +652,9 @@ static int show_stmt_case(ivl_statement_t net, ivl_scope_t sscope)
unsigned idx, default_case;
if (qual != IVL_CASE_QUALITY_BASIC) {
if (qual != IVL_CASE_QUALITY_BASIC && qual != IVL_CASE_QUALITY_PRIORITY) {
fprintf(stderr, "%s:%u: tgt-vvp sorry: "
"Case unique/unique0/priority qualities are ignored.\n",
"Case unique/unique0 qualities are ignored.\n",
ivl_stmt_file(net), ivl_stmt_lineno(net));
}
@ -716,6 +716,23 @@ static int show_stmt_case(ivl_statement_t net, ivl_scope_t sscope)
ivl_statement_t cst = ivl_stmt_case_stmt(net, default_case);
rc += show_statement(cst, sscope);
}
/* Emit code to check unique and priority have handled a value
(when there is no default). */
else if (default_case == count) {
switch (qual) {
case IVL_CASE_QUALITY_UNIQUE:
case IVL_CASE_QUALITY_PRIORITY:
fprintf(vvp_out, " %%vpi_call/w %u %u \"$warning\", "
"\"value is unhandled for priority or unique case statement\""
" {0 0 0};\n",
ivl_file_table_index(ivl_stmt_file(net)),
ivl_stmt_lineno(net));
break;
default:
break;
}
}
/* Jump to the out of the case. */
fprintf(vvp_out, " %%jmp T_%u.%u;\n", thread_count,