diff --git a/vpi/sys_clog2.c b/vpi/sys_clog2.c index 84a685271..100666064 100644 --- a/vpi/sys_clog2.c +++ b/vpi/sys_clog2.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,6 +78,7 @@ static PLI_INT32 sys_clog2_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("$clog2 requires one numeric argument.\n"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -88,6 +89,7 @@ static PLI_INT32 sys_clog2_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("The first argument to $clog2 must be numeric.\n"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -107,6 +109,7 @@ static PLI_INT32 sys_clog2_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("%s $clog2 takes at most one argument.\n", msg); vpi_printf("%*s Found %u extra argument%s.\n", (int) strlen(msg), " ", argc, argc == 1 ? "" : "s"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_convert.c b/vpi/sys_convert.c index b9582de82..bf46615fd 100644 --- a/vpi/sys_convert.c +++ b/vpi/sys_convert.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2003-2021 Michael Ruff (mruff at chiaro.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -87,6 +87,7 @@ static void error_message(vpiHandle callh, const char* msg) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf(msg, vpi_get_str(vpiName, callh)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_countdrivers.c b/vpi/sys_countdrivers.c index 8499d5dc1..1cf887c59 100644 --- a/vpi/sys_countdrivers.c +++ b/vpi/sys_countdrivers.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2018 Martin Whitaker. (icarus@martin-whitaker.me.uk) + * Copyright (C) 2012-2021 Martin Whitaker. (icarus@martin-whitaker.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,6 +45,7 @@ static void check_net_arg(vpiHandle arg, vpiHandle callh, const char *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a scalar net or " "a bit-select of a vector net.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -75,6 +76,7 @@ static void check_var_arg(vpiHandle arg, vpiHandle callh, const char *name, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's %s argument must be a variable.\n", name, arg_name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -99,6 +101,7 @@ static PLI_INT32 sys_countdrivers_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least one argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/sys_darray.c b/vpi/sys_darray.c index 269508677..41a045818 100644 --- a/vpi/sys_darray.c +++ b/vpi/sys_darray.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -34,6 +34,7 @@ static PLI_INT32 dobject_size_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a dynamic array, queue or string " "argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -55,6 +56,7 @@ static PLI_INT32 dobject_size_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s argument must be a dynamic array, queue or " "string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } break; @@ -63,6 +65,7 @@ static PLI_INT32 dobject_size_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s argument must be a dynamic array, queue or string, " "given a %s.\n", name, vpi_get_str(vpiType, arg)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -71,6 +74,7 @@ static PLI_INT32 dobject_size_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s has too many arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); vpi_free_object(argv); } diff --git a/vpi/sys_deposit.c b/vpi/sys_deposit.c index 222f94487..84bec5ada 100644 --- a/vpi/sys_deposit.c +++ b/vpi/sys_deposit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2000 Stephan Boettcher * * This source code is free software; you can redistribute it @@ -33,6 +33,7 @@ static PLI_INT32 sys_deposit_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -44,6 +45,7 @@ static PLI_INT32 sys_deposit_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -60,6 +62,7 @@ static PLI_INT32 sys_deposit_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("invalid target type (%s) for %s.\n", vpi_get_str(vpiType, target), name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_display.c b/vpi/sys_display.c index f1745e945..94a3fc9e1 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -1203,12 +1203,13 @@ static int sys_check_args(vpiHandle callh, vpiHandle argv, const PLI_BYTE8*name, " to %s.\n", name); br916_hint_issued = 1; } - ret = 1; + ret = 2; default: break; } } #endif + case vpiClassVar: case vpiSysFuncCall: break; @@ -1241,6 +1242,7 @@ static PLI_INT32 sys_common_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name, int no_au (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least a file descriptor/MCD.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1250,11 +1252,14 @@ static PLI_INT32 sys_common_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name, int no_au (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's file descriptor/MCD must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } - if (sys_check_args(callh, argv, name, no_auto, is_monitor)) { + int rtn = sys_check_args(callh, argv, name, no_auto, is_monitor); + if (rtn) { + if (rtn==1) vpip_set_return_value(1); vpi_control(vpiFinish, 1); } return 0; @@ -1488,7 +1493,11 @@ static PLI_INT32 sys_monitor_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); - if (sys_check_args(callh, argv, name, 1, 1)) vpi_control(vpiFinish, 1); + int rtn = sys_check_args(callh, argv, name, 1, 1); + if (rtn) { + if (rtn == 1) vpip_set_return_value(1); + vpi_control(vpiFinish, 1); + } return 0; } @@ -1605,6 +1614,7 @@ static PLI_INT32 sys_swrite_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least one argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1620,7 +1630,11 @@ static PLI_INT32 sys_swrite_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) return 0; } - if (sys_check_args(callh, argv, name, 0, 0)) vpi_control(vpiFinish, 1); + int rtn = sys_check_args(callh, argv, name, 0, 0); + if (rtn) { + if (rtn == 1) vpip_set_return_value(1); + vpi_control(vpiFinish, 1); + } return 0; } @@ -1674,6 +1688,7 @@ static PLI_INT32 sys_sformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1685,6 +1700,7 @@ static PLI_INT32 sys_sformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a register or SV string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1695,6 +1711,7 @@ static PLI_INT32 sys_sformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1705,11 +1722,16 @@ static PLI_INT32 sys_sformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be a string or a register.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } - if (sys_check_args(callh, argv, name, 0, 0)) vpi_control(vpiFinish, 1); + int rtn = sys_check_args(callh, argv, name, 0, 0); + if (rtn) { + if (rtn == 1) vpip_set_return_value(1); + vpi_control(vpiFinish, 1); + } return 0; } @@ -1774,6 +1796,7 @@ static PLI_INT32 sys_sformatf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least one argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1784,6 +1807,7 @@ static PLI_INT32 sys_sformatf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least one argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1794,11 +1818,16 @@ static PLI_INT32 sys_sformatf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a string or a register.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } - if (sys_check_args(callh, argv, name, 0, 0)) vpi_control(vpiFinish, 1); + int rtn = sys_check_args(callh, argv, name, 0, 0); + if (rtn) { + if (rtn == 1) vpip_set_return_value(1); + vpi_control(vpiFinish, 1); + } return 0; } @@ -1828,6 +1857,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's units argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -1837,6 +1867,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires zero or four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1846,6 +1877,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's precision argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -1855,6 +1887,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires zero or four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1863,6 +1896,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's suffix argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -1872,6 +1906,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires zero or four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1881,6 +1916,7 @@ static PLI_INT32 sys_timeformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's minimum width argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -1997,6 +2033,7 @@ static PLI_INT32 sys_printtimescale_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's argument must have a module, given a %s.\n", name, vpi_get_str(vpiType, arg)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -2043,10 +2080,13 @@ static PLI_INT32 sys_fatal_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's finish number must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } - if (sys_check_args(callh, argv, name, 0, 0)) { + int rtn = sys_check_args(callh, argv, name, 0, 0); + if (rtn) { + if (rtn == 1) vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index 20baed5dc..5375b9d67 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -43,6 +43,7 @@ static PLI_INT32 sys_fopen_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a string file name argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -50,6 +51,7 @@ static PLI_INT32 sys_fopen_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's file name argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -62,6 +64,7 @@ static PLI_INT32 sys_fopen_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's type argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -337,6 +340,7 @@ static PLI_INT32 sys_fgets_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -345,6 +349,7 @@ static PLI_INT32 sys_fgets_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a reg.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -353,6 +358,7 @@ static PLI_INT32 sys_fgets_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (numeric) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -361,6 +367,7 @@ static PLI_INT32 sys_fgets_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -446,6 +453,7 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -456,6 +464,7 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a reg or memory.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -466,6 +475,7 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (file descriptor) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -474,6 +484,7 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -490,6 +501,7 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's third argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -502,6 +514,7 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's fourth argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -751,6 +764,7 @@ static PLI_INT32 sys_fseek_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires three arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -760,6 +774,7 @@ static PLI_INT32 sys_fseek_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -769,6 +784,7 @@ static PLI_INT32 sys_fseek_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (numeric) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -777,6 +793,7 @@ static PLI_INT32 sys_fseek_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -786,6 +803,7 @@ static PLI_INT32 sys_fseek_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a third (numeric) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -794,6 +812,7 @@ static PLI_INT32 sys_fseek_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's third argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -962,6 +981,7 @@ static PLI_INT32 sys_ferror_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's fd (first) argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -972,6 +992,7 @@ static PLI_INT32 sys_ferror_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (register) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -981,12 +1002,14 @@ static PLI_INT32 sys_ferror_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be a reg (>=640 bits).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } else if (vpi_get(vpiSize, arg) < 640) { vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must have 640 bit or more.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_fst.c b/vpi/sys_fst.c index 769a008b9..7c792915a 100644 --- a/vpi/sys_fst.c +++ b/vpi/sys_fst.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -372,6 +372,7 @@ static void open_dumpfile(vpiHandle callh) vpi_printf("FST Error: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unable to open %s for output.\n", dump_path); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(dump_path); dump_path = 0; diff --git a/vpi/sys_icarus.c b/vpi/sys_icarus.c index 7a1037572..273175e67 100644 --- a/vpi/sys_icarus.c +++ b/vpi/sys_icarus.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2012 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +48,7 @@ static PLI_INT32 task_not_implemented_compiletf(ICARUS_VPI_CONST PLI_BYTE8* name vpi_printf("SORRY: %s:%d: task %s() is not currently implemented.\n", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh), name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -63,6 +64,7 @@ static PLI_INT32 missing_optional_compiletf(ICARUS_VPI_CONST PLI_BYTE8* name) vpi_printf("SORRY: %s:%d: %s() is not available in Icarus Verilog.\n", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh), name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index a92c583cb..b3b3a7768 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -450,6 +450,7 @@ static void open_dumpfile(vpiHandle callh) vpi_printf("LXT Error: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unable to open %s for output.\n", dump_path); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(dump_path); dump_path = 0; diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index 545b48943..432794626 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -500,6 +500,7 @@ static void open_dumpfile(vpiHandle callh) vpi_printf("LXT2 Error: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unable to open %s for output.\n", dump_path); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(dump_path); dump_path = 0; diff --git a/vpi/sys_plusargs.c b/vpi/sys_plusargs.c index b2d4d75af..9c40f53ed 100644 --- a/vpi/sys_plusargs.c +++ b/vpi/sys_plusargs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -83,6 +83,7 @@ static PLI_INT32 sys_value_plusargs_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -94,6 +95,7 @@ static PLI_INT32 sys_value_plusargs_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -103,6 +105,7 @@ static PLI_INT32 sys_value_plusargs_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's requires a second variable argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -126,6 +129,7 @@ static PLI_INT32 sys_value_plusargs_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be a variable, found a %s.\n", name, vpi_get_str(vpiType, arg)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -163,6 +167,7 @@ static PLI_INT32 sys_value_plusargs_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("%s %s is missing a format code.\n", msg, name); vpi_printf("%*s \"%s\".\n", (int)strlen(msg), " ", fmt.value.str); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -203,6 +208,7 @@ static PLI_INT32 sys_value_plusargs_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("%s %s has an invalid format string:\n", msg, name); vpi_printf("%*s \"%s\".\n", (int)strlen(msg), " ", fmt.value.str); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/sys_priv.c b/vpi/sys_priv.c index 7f9cc5906..b9fb61029 100644 --- a/vpi/sys_priv.c +++ b/vpi/sys_priv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -144,6 +144,7 @@ void check_for_extra_args(vpiHandle argv, vpiHandle callh, const char *name, opt ? "at most ": "", arg_str); vpi_printf("%*s Found %u extra argument%s.\n", (int) strlen(msg), " ", argc, argc == 1 ? "" : "s"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } @@ -343,6 +344,7 @@ PLI_INT32 sys_no_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("%s %s does not take an argument.\n", msg, name); vpi_printf("%*s Found %u extra argument%s.\n", (int) strlen(msg), " ", argc, argc == 1 ? "" : "s"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -360,6 +362,7 @@ PLI_INT32 sys_one_numeric_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a single numeric argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -368,6 +371,7 @@ PLI_INT32 sys_one_numeric_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -390,6 +394,7 @@ PLI_INT32 sys_one_opt_numeric_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -411,6 +416,7 @@ PLI_INT32 sys_two_numeric_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two numeric arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -419,6 +425,7 @@ PLI_INT32 sys_two_numeric_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -427,6 +434,7 @@ PLI_INT32 sys_two_numeric_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (numeric) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -435,6 +443,7 @@ PLI_INT32 sys_two_numeric_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -455,6 +464,7 @@ PLI_INT32 sys_one_string_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a single string argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -462,6 +472,7 @@ PLI_INT32 sys_one_string_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_queue.c b/vpi/sys_queue.c index 7eb7525c2..e71fa6e81 100644 --- a/vpi/sys_queue.c +++ b/vpi/sys_queue.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -529,6 +529,7 @@ static void check_var_arg_32(vpiHandle arg, vpiHandle callh, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's %s (variable) argument must be 32 bits.\n", name, desc); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } case vpiIntegerVar: @@ -539,6 +540,7 @@ static void check_var_arg_32(vpiHandle arg, vpiHandle callh, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's %s argument must be a 32 bit variable.\n", name, desc); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } @@ -561,6 +563,7 @@ static void check_var_arg_large(vpiHandle arg, vpiHandle callh, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's %s (variable) argument must have at least " "32 bits.\n", name, desc); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } case vpiIntegerVar: @@ -572,6 +575,7 @@ static void check_var_arg_large(vpiHandle arg, vpiHandle callh, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's %s argument must be a variable.\n", name, desc); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } @@ -604,6 +608,7 @@ static unsigned check_numeric_args(vpiHandle argv, unsigned count, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a %s (<= 32 bit numeric) argument.\n", name, loc); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -614,6 +619,7 @@ static unsigned check_numeric_args(vpiHandle argv, unsigned count, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's %s argument must be numeric (<= 32 bits).\n", name, loc); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } @@ -811,6 +817,7 @@ static PLI_INT32 sys_q_initialize_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -825,6 +832,7 @@ static PLI_INT32 sys_q_initialize_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a fourth (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -928,6 +936,7 @@ static PLI_INT32 sys_q_add_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -942,6 +951,7 @@ static PLI_INT32 sys_q_add_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a fourth (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1023,6 +1033,7 @@ static PLI_INT32 sys_q_remove_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1033,6 +1044,7 @@ static PLI_INT32 sys_q_remove_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be numeric (<= 32 bits).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -1042,6 +1054,7 @@ static PLI_INT32 sys_q_remove_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1054,6 +1067,7 @@ static PLI_INT32 sys_q_remove_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a third (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1066,6 +1080,7 @@ static PLI_INT32 sys_q_remove_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a fourth (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1157,6 +1172,7 @@ static PLI_INT32 sys_q_full_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1167,6 +1183,7 @@ static PLI_INT32 sys_q_full_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be numeric (<= 32 bits).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -1176,6 +1193,7 @@ static PLI_INT32 sys_q_full_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1248,6 +1266,7 @@ static PLI_INT32 sys_q_exam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires four arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1261,6 +1280,7 @@ static PLI_INT32 sys_q_exam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a third (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1274,6 +1294,7 @@ static PLI_INT32 sys_q_exam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a fourth (variable) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/sys_random.c b/vpi/sys_random.c index 72bb1c66f..5ced76d3c 100644 --- a/vpi/sys_random.c +++ b/vpi/sys_random.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -387,6 +387,7 @@ static unsigned is_seed_obj(vpiHandle obj, vpiHandle callh, const char *name) vpi_printf("%s's seed variable is less than 32 bits " " (%d).\n", name, (int)vpi_get(vpiSize, obj)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } else rtn = 1; break; @@ -395,6 +396,7 @@ static unsigned is_seed_obj(vpiHandle obj, vpiHandle callh, const char *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's seed must be an integer/time" " variable or a register.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -412,6 +414,7 @@ static PLI_INT32 sys_rand_two_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -423,6 +426,7 @@ static PLI_INT32 sys_rand_two_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -435,6 +439,7 @@ static PLI_INT32 sys_rand_two_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s second argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -456,6 +461,7 @@ PLI_INT32 sys_rand_three_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires three arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -472,6 +478,7 @@ PLI_INT32 sys_rand_three_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires three arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -484,6 +491,7 @@ PLI_INT32 sys_rand_three_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s second argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -493,6 +501,7 @@ PLI_INT32 sys_rand_three_args_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s third argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -564,6 +573,7 @@ static PLI_INT32 sys_urandom_range_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) /* Check that there are arguments. */ if (argv == 0) { vpi_printf("ERROR: %s requires one or two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -579,6 +589,7 @@ static PLI_INT32 sys_urandom_range_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) arg = vpi_scan(argv); if (arg != 0) { vpi_printf("ERROR: %s takes at most two argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index c35f3ca01..c64420257 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2019 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -205,6 +205,7 @@ static PLI_INT32 sys_mem_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -213,6 +214,7 @@ static PLI_INT32 sys_mem_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a file name (string).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -222,6 +224,7 @@ static PLI_INT32 sys_mem_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a second (memory) argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -230,6 +233,7 @@ static PLI_INT32 sys_mem_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be a memory.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -242,6 +246,7 @@ static PLI_INT32 sys_mem_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's third argument must be a start address " "(numeric).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -254,6 +259,7 @@ static PLI_INT32 sys_mem_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's fourth argument must be a finish address " "(numeric).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index 4768a72e8..767479710 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018 Stephen Williams (steve@icarus.com) + * Copyright (c) 2006-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -244,6 +244,7 @@ static int scan_format_float(vpiHandle callh, vpiHandle argv, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%%c format code.", name, code); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -309,6 +310,7 @@ static int scan_format_float_time(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%t format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -386,6 +388,7 @@ static int scan_format_base(vpiHandle callh, vpiHandle argv, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%%c format code.", name, code); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(strval); return 0; @@ -445,6 +448,7 @@ static int scan_format_char(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%c format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -565,6 +569,7 @@ static int scan_format_decimal(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%d format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(strval); return 0; @@ -624,6 +629,7 @@ static int scan_format_module_path(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%m format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -703,6 +709,7 @@ static int scan_format_string(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%s format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(strval); return 0; @@ -774,6 +781,7 @@ static int scan_format_two_state(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%u format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -913,6 +921,7 @@ static int scan_format_four_state(vpiHandle callh, vpiHandle argv, vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%z format code.", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1203,6 +1212,7 @@ static int scan_format(vpiHandle callh, struct byte_source*src, vpiHandle argv, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() format code '%%%c' is not " "currently supported.\n", name, code); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); break; @@ -1222,6 +1232,7 @@ static int scan_format(vpiHandle callh, struct byte_source*src, vpiHandle argv, (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() was given an invalid format code: " "%%%c\n", name, code); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); break; } @@ -1330,6 +1341,7 @@ static PLI_INT32 sys_fscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least three argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1339,12 +1351,16 @@ static PLI_INT32 sys_fscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument (fd) must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); vpi_free_object(argv); return 0; } - if (sys_check_args(callh, argv, name)) vpi_control(vpiFinish, 1); + if (sys_check_args(callh, argv, name)) { + vpip_set_return_value(1); + vpi_control(vpiFinish, 1); + } return 0; } @@ -1391,6 +1407,7 @@ static PLI_INT32 sys_sscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least three argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -1410,12 +1427,16 @@ static PLI_INT32 sys_sscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument must be a register or a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); vpi_free_object(argv); return 0; } - if (sys_check_args(callh, argv, name)) vpi_control(vpiFinish, 1); + if (sys_check_args(callh, argv, name)) { + vpip_set_return_value(1); + vpi_control(vpiFinish, 1); + } return 0; } diff --git a/vpi/sys_sdf.c b/vpi/sys_sdf.c index aaef9cb45..441cdbec4 100644 --- a/vpi/sys_sdf.c +++ b/vpi/sys_sdf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -249,6 +249,7 @@ static PLI_INT32 sys_sdf_annotate_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a file name argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -256,6 +257,7 @@ static PLI_INT32 sys_sdf_annotate_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's file name must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -267,6 +269,7 @@ static PLI_INT32 sys_sdf_annotate_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's second argument must be a module instance.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 55cdb14aa..ccdddc46b 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -410,6 +410,7 @@ static void open_dumpfile(vpiHandle callh) vpi_printf("VCD Error: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unable to open %s for output.\n", dump_path); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); free(dump_path); dump_path = 0; diff --git a/vpi/table_mod.c b/vpi/table_mod.c index c8157fdda..1ec5bae2b 100644 --- a/vpi/table_mod.c +++ b/vpi/table_mod.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -148,6 +148,7 @@ static PLI_INT32 sys_table_model_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires at least two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -167,6 +168,7 @@ static PLI_INT32 sys_table_model_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a file name argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -177,6 +179,7 @@ static PLI_INT32 sys_table_model_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s file name argument must be a constant string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -190,6 +193,7 @@ static PLI_INT32 sys_table_model_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s control string argument must be a constant " "string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -283,6 +287,7 @@ static unsigned parse_extrap(vpiHandle callh, p_table_mod table, unsigned idx, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unknown extrapolation code '%c' for dimension " "%u: %s\n", **extrap, idx+1, control); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -318,6 +323,7 @@ static unsigned parse_extrap(vpiHandle callh, p_table_mod table, unsigned idx, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unknown high extrapolation code '%c' for dimension " "%u: %s\n", **extrap, idx+1, control); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -365,6 +371,7 @@ static unsigned initialize_control_fields(vpiHandle callh, p_table_mod table, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Control string dependent selector is " "invalid: %s.\n", cp); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -376,6 +383,7 @@ static unsigned initialize_control_fields(vpiHandle callh, p_table_mod table, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Control string dependent value is " "to large: %lu.\n", val); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -396,6 +404,7 @@ static unsigned initialize_control_fields(vpiHandle callh, p_table_mod table, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Not enough control field(s) (%u) for the dimension(s) " "(%u).", num_fields, table->dims); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -462,6 +471,7 @@ static unsigned initialize_control_fields(vpiHandle callh, p_table_mod table, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Unknown interpolation code '%c' for dimension " "%u: %s\n", *cp, idx+1, control); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -472,6 +482,7 @@ static unsigned initialize_control_fields(vpiHandle callh, p_table_mod table, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Extra control characters found for dimension " "%u: %s\n", idx+1, control); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -487,6 +498,7 @@ static unsigned initialize_control_fields(vpiHandle callh, p_table_mod table, (int)vpi_get(vpiLineNo, callh)); vpi_printf("Usable control field(s) (%u) do not match dimension(s) " "(%u).", (num_fields - num_ignore), table->dims); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 1; } @@ -662,6 +674,7 @@ static PLI_INT32 sys_table_model_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name) /* If this is the first call then build the data structure. */ if ((table->have_fname == 0) && initialize_table_model(callh, name, table)) { + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/v2005_math.c b/vpi/v2005_math.c index aec4d9d52..3a1a6bdf9 100644 --- a/vpi/v2005_math.c +++ b/vpi/v2005_math.c @@ -2,7 +2,7 @@ * Verilog-2005 math library for Icarus Verilog * http://www.icarus.com/eda/verilog/ * - * Copyright (C) 2007-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,6 +130,7 @@ static void va_error_message(vpiHandle callh, const char *format, vpi_printf("%s:%d: error: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf(format, name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/v2009_array.c b/vpi/v2009_array.c index daf914167..f622a9343 100644 --- a/vpi/v2009_array.c +++ b/vpi/v2009_array.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2013-2021 Cary R. (cygcary@yahoo.com) * Copyright (C) 2014 Stephen Williams (steve@icarus.com) * Copyright (C) 2014 CERN * @author Maciej Suminski (maciej.suminski@cern.ch) @@ -33,6 +33,7 @@ static PLI_INT32 one_array_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires an array argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -45,6 +46,7 @@ static PLI_INT32 one_array_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s has too many arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -90,6 +92,7 @@ static PLI_INT32 array_int_opt_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(argc == MAX_ARGC) vpi_free_object(argv); + vpip_set_return_value(1); vpi_control(vpiFinish, 0); return 0; } @@ -104,6 +107,7 @@ static PLI_INT32 func_not_implemented_compiletf(ICARUS_VPI_CONST PLI_BYTE8* name vpi_printf("SORRY: %s:%d: function %s() is not currently implemented.\n", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh), name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -119,6 +123,7 @@ static PLI_INT32 array_get_property(int property, ICARUS_VPI_CONST PLI_BYTE8*nam vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires an array argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -129,6 +134,7 @@ static PLI_INT32 array_get_property(int property, ICARUS_VPI_CONST PLI_BYTE8*nam if(dim != 0) { vpi_printf("SORRY: %s:%d: multiple dimensions are not handled yet.\n", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/v2009_bitvec.c b/vpi/v2009_bitvec.c index cc824b9bb..a2285ce1a 100644 --- a/vpi/v2009_bitvec.c +++ b/vpi/v2009_bitvec.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2018-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ static PLI_INT32 countbits_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("$countbits() requires at least two arguments.\n"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -48,6 +49,7 @@ static PLI_INT32 countbits_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("The first argument to $countbits() must be numeric.\n"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -58,6 +60,7 @@ static PLI_INT32 countbits_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("$countbits() requires at least one control bit " "argument.\n"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -67,6 +70,7 @@ static PLI_INT32 countbits_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("Control bit argument %d to $countbits() must " "be numeric.\n", cb_count); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } ++cb_count; diff --git a/vpi/v2009_enum.c b/vpi/v2009_enum.c index f20e59b0e..d98a16583 100644 --- a/vpi/v2009_enum.c +++ b/vpi/v2009_enum.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2018 Stephen Williams (steve@icarus.com) + * Copyright (c) 2010-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -37,6 +37,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* vpi_printf("%s:%d: compiler error: ", vpi_get_str(vpiFile, sys), (int) vpi_get(vpiLineNo,sys)); vpi_printf("No arguments given for enum method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -48,6 +49,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* (int) vpi_get(vpiLineNo,sys)); vpi_printf("No enumeration type argument given for enum " "method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -57,6 +59,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* vpi_printf("The first argument to enum method %s() must be an " "enumeration type, found a %s.\n", name, vpi_get_str(vpiType, arg_enum)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -67,6 +70,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* (int) vpi_get(vpiLineNo,sys)); vpi_printf("No enumeration variable argument given for enum " "method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -85,6 +89,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* vpi_printf("The second argument to enum method %s() must be an " "enumeration variable, found a %s.\n", name, vpi_get_str(vpiType, arg_var)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -116,6 +121,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* vpi_printf("The second argument to enum method %s() must be " "numeric, found a %s.\n", name, vpi_get_str(vpiType, arg_count)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } @@ -127,6 +133,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* vpi_printf("%s:%d: compiler error: ", vpi_get_str(vpiFile, sys), (int) vpi_get(vpiLineNo,sys)); vpi_printf("Extra argument(s) given to enum method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -139,6 +146,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* "the enum variable width (%d).\n", name, (int) vpi_get(vpiSize, sys), (int) vpi_get(vpiSize, arg_var)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -366,6 +374,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("%s:%d: compiler error: ", vpi_get_str(vpiFile, sys), (int) vpi_get(vpiLineNo,sys)); vpi_printf("No arguments given for enum method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -377,6 +386,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int) vpi_get(vpiLineNo,sys)); vpi_printf("No enumeration type argument given for enum " "method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -386,6 +396,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("The first argument to enum method %s() must be an " "enumeration type, found a %s.\n", name, vpi_get_str(vpiType, arg_enum)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -396,6 +407,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) (int) vpi_get(vpiLineNo,sys)); vpi_printf("No enumeration variable argument given for enum " "method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -414,6 +426,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("The second argument to enum method %s() must be an " "enumeration variable, found a %s.\n", name, vpi_get_str(vpiType, arg_var)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -423,6 +436,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("%s:%d: compiler error: ", vpi_get_str(vpiFile, sys), (int) vpi_get(vpiLineNo,sys)); vpi_printf("Extra argument(s) given to enum method %s().\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/v2009_string.c b/vpi/v2009_string.c index 1b70746bd..dedf4c43d 100644 --- a/vpi/v2009_string.c +++ b/vpi/v2009_string.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -35,6 +35,7 @@ static PLI_INT32 one_string_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s requires a string argument.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -47,6 +48,7 @@ static PLI_INT32 one_string_arg_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s has too many arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } diff --git a/vpi/va_math.c b/vpi/va_math.c index 5c5e4105a..8357f0f47 100644 --- a/vpi/va_math.c +++ b/vpi/va_math.c @@ -2,7 +2,7 @@ * Verilog-A math library for Icarus Verilog * http://www.icarus.com/eda/verilog/ * - * Copyright (C) 2007-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,6 +157,7 @@ static void va_error_message(vpiHandle callh, const char *format, vpi_printf("%s:%d: error: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf(format, name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/vams_simparam.c b/vpi/vams_simparam.c index 2de9818a9..c0f1fb648 100644 --- a/vpi/vams_simparam.c +++ b/vpi/vams_simparam.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2018 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2021 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +44,7 @@ static PLI_INT32 simparam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("$simparam%s requires a string argument.\n", name_ext); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -55,6 +56,7 @@ static PLI_INT32 simparam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) (int)vpi_get(vpiLineNo, callh)); vpi_printf("The first argument to $simparam%s must be a string.\n", name_ext); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -69,6 +71,7 @@ static PLI_INT32 simparam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) (int)vpi_get(vpiLineNo, callh)); vpi_printf("When provided, the second argument to $simparam%s" "must be a string.\n", name_ext); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } /* For the rest the default must be numeric. */ @@ -78,6 +81,7 @@ static PLI_INT32 simparam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) (int)vpi_get(vpiLineNo, callh)); vpi_printf("When provided, the second argument to $simparam%s" "must be numeric.\n", name_ext); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } @@ -99,6 +103,7 @@ static PLI_INT32 simparam_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) msg, name_ext); vpi_printf("%*s Found %u extra argument%s.\n", (int) strlen(msg), " ", argc, argc == 1 ? "" : "s"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/vcd_priv.c b/vpi/vcd_priv.c index 77a5dcda7..ea01e0a4b 100644 --- a/vpi/vcd_priv.c +++ b/vpi/vcd_priv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -151,6 +151,7 @@ PLI_INT32 sys_dumpvars_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's argument must be numeric.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -173,6 +174,7 @@ PLI_INT32 sys_dumpvars_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s cannot dump a non-constant select %s.\n", name, vpi_get_str(vpiType, arg)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } #endif @@ -211,6 +213,7 @@ PLI_INT32 sys_dumpvars_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s cannot dump a %s.\n", name, vpi_get_str(vpiType, arg)); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } } diff --git a/vpi/vhdl_table.c b/vpi/vhdl_table.c index 64cfe0386..eea79a559 100644 --- a/vpi/vhdl_table.c +++ b/vpi/vhdl_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -108,6 +108,7 @@ static PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*data) (int)vpi_get(vpiLineNo, sys)); vpi_printf("(compiler error) %s requires a single argument.\n", attr_func_names[type]); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -143,6 +144,7 @@ static PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*data) vpi_printf("(compiler error) %s only takes a single argument.\n", attr_func_names[type]); vpi_free_object(argv); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } diff --git a/vpi/vhdl_textio.c b/vpi/vhdl_textio.c index ac18aacf9..a6dddcdcf 100644 --- a/vpi/vhdl_textio.c +++ b/vpi/vhdl_textio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 CERN + * Copyright (c) 2015-2021 CERN * @author Maciej Suminski * * This source code is free software; you can redistribute it @@ -69,7 +69,10 @@ static int is_integer_var(vpiHandle obj) PLI_INT32 type = vpi_get(vpiType, obj); return (type == vpiIntegerVar || type == vpiShortIntVar || - type == vpiIntVar || type == vpiLongIntVar); + type == vpiIntVar || type == vpiLongIntVar || + /* In vlog95 translation this is a signed 32-bit register. */ + (type == vpiReg && vpi_get(vpiSigned, obj) && + vpi_get(vpiSize, obj) == 32)); } static int is_const(vpiHandle obj) @@ -333,6 +336,7 @@ static PLI_INT32 ivlh_file_open_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpi_printf("%s() function is available in following variants:\n", name); vpi_printf("* (file f: text; filename: in string, file_open_kind: in mode)\n"); vpi_printf("* (status: out file_open_status, file f: text; filename: in string, file_open_kind: in mode)\n"); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -450,6 +454,7 @@ static PLI_INT32 ivlh_readwriteline_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(argv == 0) { show_error_line(callh); vpi_printf("%s requires two arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -458,6 +463,7 @@ static PLI_INT32 ivlh_readwriteline_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg || !is_integer_var(arg)) { show_error_line(callh); vpi_printf("%s's first argument must be an integer variable (file handle).\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -465,6 +471,7 @@ static PLI_INT32 ivlh_readwriteline_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg || !is_string_obj(arg)) { show_error_line(callh); vpi_printf("%s's second argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -601,6 +608,7 @@ static PLI_INT32 ivlh_read_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(argv == 0) { show_error_line(callh); vpi_printf("%s requires three arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -609,6 +617,7 @@ static PLI_INT32 ivlh_read_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg || !is_string_obj(arg)) { show_error_line(callh); vpi_printf("%s's first argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -616,6 +625,7 @@ static PLI_INT32 ivlh_read_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg || is_constant_obj(arg)) { show_error_line(callh); vpi_printf("%s's second argument must be a variable.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -624,6 +634,7 @@ static PLI_INT32 ivlh_read_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg) { show_error_line(callh); vpi_printf("%s's third argument must be an integer.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -771,6 +782,7 @@ static PLI_INT32 ivlh_read_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) } else { show_error_line(callh); vpi_printf("%s failed.\n", name); + /*vpip_set_return_value(1);*/ /*vpi_control(vpiFinish, 1);*/ } @@ -788,6 +800,7 @@ static PLI_INT32 ivlh_write_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(argv == 0) { show_error_line(callh); vpi_printf("%s requires three arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -796,6 +809,7 @@ static PLI_INT32 ivlh_write_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg || !is_string_obj(arg)) { show_error_line(callh); vpi_printf("%s's first argument must be a string.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); } @@ -803,6 +817,7 @@ static PLI_INT32 ivlh_write_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg) { show_error_line(callh); vpi_printf("%s requires three arguments.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -811,6 +826,7 @@ static PLI_INT32 ivlh_write_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) if(!arg) { show_error_line(callh); vpi_printf("%s's third argument must be an integer.\n", name); + vpip_set_return_value(1); vpi_control(vpiFinish, 1); return 0; } @@ -972,6 +988,7 @@ static PLI_INT32 ivlh_write_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) } else { show_error_line(callh); vpi_printf("%s failed.\n", name); + /*vpip_set_return_value(1);*/ /*vpi_control(vpiFinish, 1);*/ } diff --git a/vvp/vpi_cobject.cc b/vvp/vpi_cobject.cc index 76e17bb9f..4fd2ef536 100644 --- a/vvp/vpi_cobject.cc +++ b/vvp/vpi_cobject.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 Picture Elements, Inc. + * Copyright (c) 2012-2021 Picture Elements, Inc. * Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -33,14 +33,84 @@ __vpiCobjectVar::__vpiCobjectVar(__vpiScope*sc, const char*na, vvp_net_t*ne) int __vpiCobjectVar::get_type_code(void) const { return vpiClassVar; } -int __vpiCobjectVar::vpi_get(int) +int __vpiCobjectVar::vpi_get(int code) { - return 0; + switch (code) { + case vpiLineNo: + return 0; // Not implemented for now! + + case vpiSize: + return 64; + + case vpiConstType: + return vpiNullConst; + + case vpiSigned: + return 0; + + case vpiAutomatic: + return 0; + +#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX) + case _vpiFromThr: + return _vpiNoThr; +#endif + + default: + fprintf(stderr, "vvp error: get %d not supported " + "by vpiClassVar\n", code); + assert(0); + return 0; + } } void __vpiCobjectVar::vpi_get_value(p_vpi_value val) { - val->format = vpiSuppressVal; +// FIXME: We need to get the assigned object address if one is assigned. +//fprintf(stderr, "HERE: %p\n", get_net()); + char*rbuf = (char *) need_result_buf(64 + 1, RBUF_VAL); + + switch (val->format) { + case vpiObjTypeVal: + val->format = vpiStringVal; + // fall through + case vpiBinStrVal: + case vpiDecStrVal: + case vpiOctStrVal: + case vpiHexStrVal: + case vpiStringVal: + sprintf(rbuf, " null"); + val->value.str = rbuf; + break; + + case vpiScalarVal: + val->value.scalar = vpi0; + break; + + case vpiIntVal: + val->value.integer = 0; + break; + + case vpiVectorVal: + val->value.vector = (p_vpi_vecval) + need_result_buf(2*sizeof(s_vpi_vecval), + RBUF_VAL); + for (unsigned idx = 0; idx < 2; idx += 1) { + val->value.vector[idx].aval = 0; + val->value.vector[idx].bval = 0; + } + break; + + case vpiRealVal: + val->value.real = 0.0; + break; + + default: + fprintf(stderr, "vvp error: format %d not supported " + "by vpiClassVar\n", (int)val->format); + val->format = vpiSuppressVal; + break; + } } vpiHandle vpip_make_cobject_var(const char*name, vvp_net_t*net)