vlog95 target: better solution for void functions with no arguments.

This commit is contained in:
Martin Whitaker 2019-11-09 20:12:39 +00:00
parent 39238fd1cd
commit cab9526e6c
2 changed files with 4 additions and 6 deletions

View File

@ -995,12 +995,6 @@ int emit_scope(ivl_scope_t scope, ivl_scope_t parent)
unsigned is_auto = ivl_scope_is_auto(scope);
unsigned idx;
// Convert SV void functions with no arguments to tasks. This may
// lead to errors if the function is called from another function,
// but there is no way to translate that case.
if (is_void_function(scope) && (ivl_scope_ports(scope) == 1))
sc_type = IVL_SCT_TASK;
/* Output the scope definition. */
switch (sc_type) {
case IVL_SCT_MODULE:

View File

@ -1433,7 +1433,11 @@ static void emit_stmt_utask(ivl_scope_t scope, ivl_statement_t stmt)
|| (is_void_function(task_scope)
&& ivl_scope_ports(task_scope) == 1));
fprintf(vlog_out, "%*c", get_indent(), ' ');
if (is_void_function(task_scope))
fprintf(vlog_out, "if (");
emit_scope_path(scope, task_scope);
if (is_void_function(task_scope))
fprintf(vlog_out, "(1'bx))");
fprintf(vlog_out, ";");
emit_stmt_file_line(stmt);
fprintf(vlog_out, "\n");