Aldec Riviera-PRO 在 SystemVerilog $error 或 $warning 上中断模拟

Aldec Riviera-PRO break simulation on SystemVerilog $error or $warning

是否可以配置 Aldec Riviera-PRO 模拟器以在 $error$warning SystemVerilog 调用时中断模拟?如果是那又怎样?

我认为在 Riviera-PRO 中没有用于将 $error$warning 提升到断点的特定配置选项,尽管值得向他们的支持人员核实。您确实有几个选择:

  • $error替换为$fatal
  • 编写一个 VPI 模块以使用自定义 C 代码重载系统任务

第二个选项看起来像这样:

#include "vpi_user.h"

// System function overload on $warning and $error to stop sim
static int system_function_overload(char *userdata)
{
    vpiHandle systfref, args_iter, argh;
    struct t_vpi_value argval;
    const char *msg = "*** NO MESSAGE PROVIDED ***";

    // Obtain a handle to the argument list
    systfref = vpi_handle(vpiSysTfCall, NULL);
    args_iter = vpi_iterate(vpiArgument, systfref);

    // Pull out the string passed in as the first argument
    if (args_iter) {
        argh = vpi_scan(args_iter);
        argval.format = vpiStringVal;
        vpi_get_value(argh, &argval);
        vpi_free_object(args_iter);
        msg = argval.value.str;
    }

    vpi_printf("BREAK sim from %s:%d with msg %s\n",
                vpi_get_str(vpiFile, systfref),
                vpi_get(vpiLineNo, systfref),
                msg);
    vpi_control(vpiStop);
    return 0;
}

static void register_system_functions(void)
{
    s_vpi_systf_data tfData = { vpiSysTask, vpiSysTask };

    tfData.sizetf       = NULL;
    tfData.compiletf    = system_function_compiletf;
    tfData.calltf       = system_function_overload;
    tfData.user_data    = NULL;
    tfData.tfname       = "$warning";
    vpi_register_systf( &tfData );
    tfData.tfname       = "$error";
    vpi_register_systf( &tfData );
}

void (*vlog_startup_routines[])(void) = {
    register_system_functions,
    0
};