From 414fafda2bdaa3821206ad7d26537d219819a5b4 Mon Sep 17 00:00:00 2001 From: Nick Brereton Date: Sat, 5 Oct 2019 21:42:17 -0400 Subject: [PATCH] Check that value is handled for case priority and unique qualifiers. --- tgt-vvp/vvp_process.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index fb1f22400..494bff540 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -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,