Handle void functions with new .scope format.

This commit is contained in:
Stephen Williams 2016-02-01 09:29:49 -08:00
parent fac7de2133
commit c114edfa6c
5 changed files with 23 additions and 8 deletions

View File

@ -72,6 +72,9 @@ EXTERN_C_START
/********* Many-to-One ***********/
#define vpiMember 742
/********* task/function properties **********/
#define vpiOtherFunc 6
EXTERN_C_END
#endif /* SV_VPI_USER_H */

View File

@ -603,12 +603,19 @@ static void fill_in_scope_function(ivl_scope_t scope, const NetScope*net)
assert(def);
const NetNet*return_sig = def->return_sig();
assert(return_sig);
if (return_sig == 0) {
// Special case: If there is no return signal, this is
// apparently a VOID function.
scope->func_type = IVL_VT_VOID;
scope->func_signed = 0;
scope->func_width = 0;
} else {
scope->func_type = return_sig->data_type();
scope->func_signed = return_sig->get_signed();
scope->func_width = return_sig->vector_width();
}
scope->tname_ = def->scope()->basename();
scope->func_type = return_sig->data_type();
scope->func_signed = return_sig->get_signed();
scope->func_width = return_sig->vector_width();
}
void dll_target::add_root(const NetScope *s)

View File

@ -445,7 +445,7 @@ static void store_vec4_to_lval(ivl_statement_t net)
member. We will use a property assign
function. */
assert(!lsig);
assert(!signal_is_return_value(lsig));
ivl_type_t sub_type = draw_lval_expr(nest);
assert(ivl_type_base(sub_type) == IVL_VT_CLASS);
fprintf(vvp_out, " %%store/prop/v %d, %u;\n",

View File

@ -2271,7 +2271,8 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
snprintf(suffix, sizeof suffix, ".obj");
break;
case IVL_VT_VOID:
assert(0);
snprintf(suffix, sizeof suffix, ".void");
break;
default:
assert(0);
break;

View File

@ -506,9 +506,13 @@ compile_scope_decl(char*label, char*type, char*name, char*tname,
} else if (strcmp(type,"autofunction.real") == 0) {
scope = new vpiScopeFunction(name, tname, true, vpiRealFunc, 0);
} else if (strcmp(type,"function.str") == 0) {
scope = new vpiScopeFunction(name, tname, false, vpiSizedFunc, 0);
scope = new vpiScopeFunction(name, tname, false, vpiOtherFunc, 0);
} else if (strcmp(type,"autofunction.str") == 0) {
scope = new vpiScopeFunction(name, tname, true, vpiSizedFunc, 0);
scope = new vpiScopeFunction(name, tname, true, vpiOtherFunc, 0);
} else if (strcmp(type,"function.void") == 0) {
scope = new vpiScopeFunction(name, tname, false, vpiOtherFunc, 0);
} else if (strcmp(type,"autofunction.void") == 0) {
scope = new vpiScopeFunction(name, tname, true, vpiOtherFunc, 0);
} else if (strcmp(type,"task") == 0) {
scope = new vpiScopeTask(name, tname);
} else if (strcmp(type,"autotask") == 0) {