diff --git a/sv_vpi_user.h b/sv_vpi_user.h index 81d983e26..ac792e56f 100644 --- a/sv_vpi_user.h +++ b/sv_vpi_user.h @@ -55,6 +55,7 @@ EXTERN_C_START #define vpiArrayVar vpiRegArray /********* TYPESPECS *************/ +#define vpiClassTypespec 630 #define vpiEnumTypespec 633 #define vpiEnumConst 634 diff --git a/tgt-vvp/draw_ufunc.c b/tgt-vvp/draw_ufunc.c index 66942988f..3755158bb 100644 --- a/tgt-vvp/draw_ufunc.c +++ b/tgt-vvp/draw_ufunc.c @@ -59,6 +59,12 @@ static void function_argument_bool(ivl_signal_t port, ivl_expr_t expr) function_argument_logic(port, expr); } +static void function_argument_class(ivl_signal_t port, ivl_expr_t expr) +{ + draw_eval_object(expr); + fprintf(vvp_out, " %%store/obj v%p_0;\n", port); +} + static void draw_function_argument(ivl_signal_t port, ivl_expr_t expr) { ivl_variable_type_t dtype = ivl_signal_data_type(port); @@ -72,6 +78,9 @@ static void draw_function_argument(ivl_signal_t port, ivl_expr_t expr) case IVL_VT_BOOL: function_argument_bool(port, expr); break; + case IVL_VT_CLASS: + function_argument_class(port, expr); + break; default: fprintf(stderr, "XXXX function argument %s type=%d?!\n", ivl_signal_basename(port), dtype); diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index f4e5d7d11..7a8632367 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -2138,12 +2138,6 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) const char*prefix = ivl_scope_is_auto(net) ? "auto" : ""; - /* XXXX Classes may have scopes, but we are not ready yet. for - now, ignore them as they are not needed. */ - if (ivl_scope_type(net) == IVL_SCT_CLASS) { - return 0; - } - switch (ivl_scope_type(net)) { case IVL_SCT_MODULE: type = "module"; break; case IVL_SCT_FUNCTION: type = "function"; break; @@ -2151,7 +2145,8 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) case IVL_SCT_BEGIN: type = "begin"; break; case IVL_SCT_FORK: type = "fork"; break; case IVL_SCT_GENERATE: type = "generate"; break; - case IVL_SCT_PACKAGE: type = "package"; break; + case IVL_SCT_PACKAGE: type = "package"; break; + case IVL_SCT_CLASS: type = "class"; break; default: type = "?"; assert(0); } diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index 5518aa998..94038f9b3 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -371,6 +371,11 @@ struct vpiScopeFork : public __vpiScope { int get_type_code(void) const { return vpiNamedFork; } }; +struct vpiScopeClass : public __vpiScope { + inline vpiScopeClass() { } + int get_type_code(void) const { return vpiClassTypespec; } +}; + /* * The current_scope is a compile time concept. As the vvp source is * compiled, items that have scope are placed in the current @@ -431,6 +436,8 @@ compile_scope_decl(char*label, char*type, char*name, char*tname, scope = new vpiScopeBegin; } else if (strcmp(base_type,"package") == 0) { scope = new vpiScopePackage; + } else if (strcmp(base_type,"class") == 0) { + scope = new vpiScopeClass; } else { scope = new vpiScopeModule; assert(0);