From f2d5acabd5602cde518ae18cc2c68d116d1e7f39 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 11 Apr 2010 23:39:08 -0700 Subject: [PATCH] Add support for vpiUserSystf iteration, etc. This patch adds support for iterating over the list of vpiUserSystf tasks/functions that have vpiUserDefn set. The vpiUserDefn property is true by default, but you can call vpip_make_systf_system_defined() to set this property false (will hide the vpiUserSystf object). All the normal system tasks/functions have been modified to call this procedure to remove them from the list of vpiUserSystf objects. Only user defined system tasks or functions should appear in the list. vpi_compare_objects() is just a simple are the two pointers the same. This works correctly for the vpiUserSystf objects, but the other handle objects have not been checked. --- vpi/sys_clog2.c | 6 +- vpi/sys_convert.c | 15 +++-- vpi/sys_deposit.c | 6 +- vpi/sys_display.c | 124 +++++++++++++++++++++++------------ vpi/sys_fileio.c | 52 ++++++++++----- vpi/sys_finish.c | 9 ++- vpi/sys_icarus.c | 150 ++++++++++++++++++++++++++++--------------- vpi/sys_lxt.c | 24 ++++--- vpi/sys_lxt2.c | 22 +++++-- vpi/sys_plusargs.c | 10 +-- vpi/sys_random.c | 33 ++++++---- vpi/sys_random_mti.c | 9 ++- vpi/sys_readmem.c | 16 +++-- vpi/sys_scanf.c | 7 +- vpi/sys_sdf.c | 4 +- vpi/sys_time.c | 18 ++++-- vpi/sys_vcd.c | 24 ++++--- vpi/sys_vcdoff.c | 24 ++++--- vpi/v2005_math.c | 9 ++- vpi/va_math.c | 9 ++- vpi/vams_simparam.c | 9 ++- vpi_user.h | 1 + vvp/vpi_priv.cc | 13 +++- vvp/vpi_priv.h | 3 + vvp/vpi_tasks.cc | 85 ++++++++++++++++++++++-- vvp/vvp.def | 5 +- 26 files changed, 485 insertions(+), 202 deletions(-) diff --git a/vpi/sys_clog2.c b/vpi/sys_clog2.c index 34c7442a3..e4921152a 100644 --- a/vpi/sys_clog2.c +++ b/vpi/sys_clog2.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2010 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 @@ -133,6 +133,7 @@ static PLI_INT32 sys_clog2_calltf(PLI_BYTE8 *name) void sys_clog2_register(void) { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiIntFunc; @@ -141,5 +142,6 @@ void sys_clog2_register(void) tf_data.sizetf = 0; tf_data.tfname = "$clog2"; tf_data.user_data = 0; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_convert.c b/vpi/sys_convert.c index d8dd175c6..efcf5bda9 100644 --- a/vpi/sys_convert.c +++ b/vpi/sys_convert.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2003-2010 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 @@ -229,6 +229,7 @@ static PLI_INT32 sys_rtoi_calltf(PLI_BYTE8*user) void sys_convert_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.user_data = "$bitstoreal"; @@ -236,7 +237,8 @@ void sys_convert_register() tf_data.sizetf = sizetf_64; tf_data.compiletf = sys_convert_compiletf; tf_data.calltf = sys_bitstoreal_calltf; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.user_data = "$itor"; @@ -244,7 +246,8 @@ void sys_convert_register() tf_data.sizetf = sizetf_64; tf_data.compiletf = sys_convert_compiletf; tf_data.calltf = sys_itor_calltf; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.user_data = "$realtobits"; @@ -252,7 +255,8 @@ void sys_convert_register() tf_data.sizetf = sizetf_64; tf_data.compiletf = sys_convert_compiletf; tf_data.calltf = sys_realtobits_calltf; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.user_data = "$rtoi"; @@ -260,6 +264,7 @@ void sys_convert_register() tf_data.sizetf = sizetf_32; tf_data.compiletf = sys_convert_compiletf; tf_data.calltf = sys_rtoi_calltf; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_deposit.c b/vpi/sys_deposit.c index 401916aa2..f7b7a312c 100644 --- a/vpi/sys_deposit.c +++ b/vpi/sys_deposit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2000 Stephan Boettcher * * This source code is free software; you can redistribute it @@ -95,6 +95,7 @@ static PLI_INT32 sys_deposit_calltf(PLI_BYTE8 *name) void sys_deposit_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysTask; tf_data.tfname = "$deposit"; @@ -102,6 +103,7 @@ void sys_deposit_register() tf_data.compiletf = sys_deposit_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$deposit"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_display.c b/vpi/sys_display.c index dea997f67..f23ec6bda 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1971,6 +1971,7 @@ void sys_display_register() { s_cb_data cb_data; s_vpi_systf_data tf_data; + vpiHandle res; /*============================== display */ tf_data.type = vpiSysTask; @@ -1979,7 +1980,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$display"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$displayh"; @@ -1987,7 +1989,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$displayh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$displayo"; @@ -1995,7 +1998,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$displayo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$displayb"; @@ -2003,7 +2007,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$displayb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== write */ tf_data.type = vpiSysTask; @@ -2012,7 +2017,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$write"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$writeh"; @@ -2020,7 +2026,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$writeh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$writeo"; @@ -2028,7 +2035,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$writeo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$writeb"; @@ -2036,7 +2044,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$writeb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== strobe */ tf_data.type = vpiSysTask; @@ -2045,7 +2054,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$strobe"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$strobeh"; @@ -2053,7 +2063,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$strobeh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$strobeo"; @@ -2061,7 +2072,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$strobeo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$strobeb"; @@ -2069,7 +2081,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$strobeb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fstrobe */ tf_data.type = vpiSysTask; @@ -2078,7 +2091,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fstrobe"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fstrobeh"; @@ -2086,7 +2100,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fstrobeh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fstrobeo"; @@ -2094,7 +2109,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fstrobeo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fstrobeb"; @@ -2102,7 +2118,8 @@ void sys_display_register() tf_data.compiletf = sys_strobe_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fstrobeb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== monitor */ tf_data.type = vpiSysTask; @@ -2111,7 +2128,8 @@ void sys_display_register() tf_data.compiletf = sys_monitor_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$monitor"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$monitorh"; @@ -2119,7 +2137,8 @@ void sys_display_register() tf_data.compiletf = sys_monitor_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$monitorh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$monitoro"; @@ -2127,7 +2146,8 @@ void sys_display_register() tf_data.compiletf = sys_monitor_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$monitoro"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$monitorb"; @@ -2135,7 +2155,8 @@ void sys_display_register() tf_data.compiletf = sys_monitor_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$monitorb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$monitoron"; @@ -2143,7 +2164,8 @@ void sys_display_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$monitoron"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$monitoroff"; @@ -2151,7 +2173,8 @@ void sys_display_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$monitoroff"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fdisplay */ tf_data.type = vpiSysTask; @@ -2160,7 +2183,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fdisplay"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fdisplayh"; @@ -2168,7 +2192,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fdisplayh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fdisplayo"; @@ -2176,7 +2201,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fdisplayo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fdisplayb"; @@ -2184,7 +2210,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fdisplayb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fwrite */ tf_data.type = vpiSysTask; @@ -2193,7 +2220,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fwrite"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fwriteh"; @@ -2201,7 +2229,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fwriteh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fwriteo"; @@ -2209,7 +2238,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fwriteo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$fwriteb"; @@ -2217,7 +2247,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fwriteb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== swrite */ tf_data.type = vpiSysTask; @@ -2226,7 +2257,8 @@ void sys_display_register() tf_data.compiletf = sys_swrite_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$swrite"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$swriteh"; @@ -2234,7 +2266,8 @@ void sys_display_register() tf_data.compiletf = sys_swrite_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$swriteh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$swriteo"; @@ -2242,7 +2275,8 @@ void sys_display_register() tf_data.compiletf = sys_swrite_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$swriteo"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$swriteb"; @@ -2250,7 +2284,8 @@ void sys_display_register() tf_data.compiletf = sys_swrite_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$swriteb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$sformat"; @@ -2258,7 +2293,8 @@ void sys_display_register() tf_data.compiletf = sys_sformat_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$sformat"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================ timeformat */ tf_data.type = vpiSysTask; @@ -2267,7 +2303,8 @@ void sys_display_register() tf_data.compiletf = sys_timeformat_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$timeformat"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$printtimescale"; @@ -2275,7 +2312,8 @@ void sys_display_register() tf_data.compiletf = sys_printtimescale_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$printtimescale"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================ severity tasks */ tf_data.type = vpiSysTask; @@ -2284,7 +2322,8 @@ void sys_display_register() tf_data.compiletf = sys_fatal_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fatal"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$error"; @@ -2292,7 +2331,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$error"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$warning"; @@ -2300,7 +2340,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$warning"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$info"; @@ -2308,7 +2349,8 @@ void sys_display_register() tf_data.compiletf = sys_display_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$info"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); cb_data.reason = cbEndOfCompile; cb_data.time = 0; diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index 938dee292..89329aa32 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2010 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 @@ -1058,6 +1058,7 @@ static PLI_INT32 sys_ferror_calltf(PLI_BYTE8 *name) void sys_fileio_register() { s_vpi_systf_data tf_data; + vpiHandle res; /*============================== fopen */ tf_data.type = vpiSysFunc; @@ -1067,7 +1068,8 @@ void sys_fileio_register() tf_data.compiletf = sys_fopen_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fopen"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fopenr */ tf_data.type = vpiSysFunc; @@ -1077,17 +1079,20 @@ void sys_fileio_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fopenr"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fopenw */ tf_data.tfname = "$fopenw"; tf_data.user_data = "$fopenw"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fopena */ tf_data.tfname = "$fopena"; tf_data.user_data = "$fopena"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fclose */ tf_data.type = vpiSysTask; @@ -1096,7 +1101,8 @@ void sys_fileio_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fclose"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fflush */ tf_data.type = vpiSysTask; @@ -1105,7 +1111,8 @@ void sys_fileio_register() tf_data.compiletf = sys_one_opt_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fflush"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fgetc */ tf_data.type = vpiSysFunc; @@ -1115,7 +1122,8 @@ void sys_fileio_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fgetc"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fgets */ tf_data.type = vpiSysFunc; @@ -1125,7 +1133,8 @@ void sys_fileio_register() tf_data.compiletf = sys_fgets_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fgets"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fread */ tf_data.type = vpiSysFunc; @@ -1135,7 +1144,8 @@ void sys_fileio_register() tf_data.compiletf = sys_fread_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fread"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== ungetc */ tf_data.type = vpiSysFunc; @@ -1145,7 +1155,8 @@ void sys_fileio_register() tf_data.compiletf = sys_two_numeric_args_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$ungetc"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== ftell */ tf_data.type = vpiSysFunc; @@ -1155,7 +1166,8 @@ void sys_fileio_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$ftell"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== fseek */ tf_data.type = vpiSysFunc; @@ -1165,7 +1177,9 @@ void sys_fileio_register() tf_data.compiletf = sys_fseek_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fseek"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + vpip_make_systf_system_defined(res); /*============================== rewind */ tf_data.type = vpiSysFunc; @@ -1175,7 +1189,8 @@ void sys_fileio_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$rewind"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== ferror */ tf_data.type = vpiSysFunc; @@ -1185,7 +1200,8 @@ void sys_fileio_register() tf_data.compiletf = sys_ferror_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$ferror"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* $feof() is from 1364-2005. */ /*============================== feof */ @@ -1196,7 +1212,8 @@ void sys_fileio_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$feof"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* Icarus specific. */ /*============================== fputc */ @@ -1207,5 +1224,6 @@ void sys_fileio_register() tf_data.compiletf = sys_two_numeric_args_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fputc"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_finish.c b/vpi/sys_finish.c index f55dd312e..2eaceef80 100644 --- a/vpi/sys_finish.c +++ b/vpi/sys_finish.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 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 @@ -51,6 +51,7 @@ static PLI_INT32 sys_finish_calltf(PLI_BYTE8 *name) void sys_finish_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysTask; tf_data.tfname = "$finish"; @@ -58,7 +59,8 @@ void sys_finish_register() tf_data.compiletf = sys_one_opt_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$finish"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$stop"; @@ -66,5 +68,6 @@ void sys_finish_register() tf_data.compiletf = sys_one_opt_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$stop"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_icarus.c b/vpi/sys_icarus.c index 8551057a8..7c194ae93 100644 --- a/vpi/sys_icarus.c +++ b/vpi/sys_icarus.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2010 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 @@ -74,6 +74,7 @@ static PLI_INT32 missing_optional_compiletf(PLI_BYTE8* name) void sys_special_register(void) { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysTask; tf_data.calltf = finish_and_return_calltf; @@ -81,7 +82,8 @@ void sys_special_register(void) tf_data.sizetf = 0; tf_data.tfname = "$finish_and_return"; tf_data.user_data = "$finish_and_return"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* These tasks are not currently implemented. */ tf_data.type = vpiSysTask; @@ -91,127 +93,158 @@ void sys_special_register(void) tf_data.tfname = "$fmonitor"; tf_data.user_data = "$fmonitor"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$fmonitorb"; tf_data.user_data = "$fmonitorb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$fmonitoro"; tf_data.user_data = "$fmonitoro"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$fmonitorh"; tf_data.user_data = "$fmonitorh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$and$array"; tf_data.user_data = "$async$and$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$nand$array"; tf_data.user_data = "$async$nand$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$or$array"; tf_data.user_data = "$async$or$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$nor$array"; tf_data.user_data = "$async$nor$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$and$plane"; tf_data.user_data = "$async$and$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$nand$plane"; tf_data.user_data = "$async$nand$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$or$plane"; tf_data.user_data = "$async$or$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$async$nor$plane"; tf_data.user_data = "$async$nor$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$and$array"; tf_data.user_data = "$sync$and$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$nand$array"; tf_data.user_data = "$sync$nand$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$or$array"; tf_data.user_data = "$sync$or$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$nor$array"; tf_data.user_data = "$sync$nor$array"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$and$plane"; tf_data.user_data = "$sync$and$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$nand$plane"; tf_data.user_data = "$sync$nand$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$or$plane"; tf_data.user_data = "$sync$or$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sync$nor$plane"; tf_data.user_data = "$sync$nor$plane"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$q_initialize"; tf_data.user_data = "$q_initialize"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$q_add"; tf_data.user_data = "$q_add"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$q_remove"; tf_data.user_data = "$q_remove"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$q_full"; tf_data.user_data = "$q_full"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$q_exam"; tf_data.user_data = "$q_exam"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$dumpports"; tf_data.user_data = "$dumpports"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$dumpportsoff"; tf_data.user_data = "$dumpportsoff"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$dumpportson"; tf_data.user_data = "$dumpportson"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$dumpportsall"; tf_data.user_data = "$dumpportsall"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$dumpportslimit"; tf_data.user_data = "$dumpportslimit"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$dumpportsflush"; tf_data.user_data = "$dumpportsflush"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* The following optional system tasks/functions are not implemented * in Icarus Verilog (from Annex C 1364-2005). */ @@ -222,59 +255,73 @@ void sys_special_register(void) tf_data.tfname = "$input"; tf_data.user_data = "$input"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$key"; tf_data.user_data = "$key"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$nokey"; tf_data.user_data = "$nokey"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$list"; tf_data.user_data = "$list"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$log"; tf_data.user_data = "$log"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$nolog"; tf_data.user_data = "$nolog"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$save"; tf_data.user_data = "$save"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$restart"; tf_data.user_data = "$restart"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$incsave"; tf_data.user_data = "$incsave"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$scope"; tf_data.user_data = "$scope"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$showscopes"; tf_data.user_data = "$showscopes"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$showvars"; tf_data.user_data = "$showvars"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sreadmemb"; tf_data.user_data = "$sreadmemb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$sreadmemh"; tf_data.user_data = "$sreadmemh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* Optional functions. */ tf_data.type = vpiSysFunc; @@ -282,13 +329,16 @@ void sys_special_register(void) tf_data.tfname = "$countdrivers"; tf_data.user_data = "$countdrivers"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$getpattern"; tf_data.user_data = "$getpattern"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.tfname = "$scale"; tf_data.user_data = "$scale"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 1db04ccf7..1fadd3945 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2010 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 @@ -778,6 +778,7 @@ void sys_lxt_register() int idx; struct t_vpi_vlog_info vlog_info; s_vpi_systf_data tf_data; + vpiHandle res; /* Scan the extended arguments, looking for lxt optimization @@ -802,7 +803,8 @@ void sys_lxt_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpall"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpfile"; @@ -810,7 +812,8 @@ void sys_lxt_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpfile"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpflush"; @@ -818,7 +821,8 @@ void sys_lxt_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpflush"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumplimit"; @@ -826,7 +830,8 @@ void sys_lxt_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumplimit"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpoff"; @@ -834,7 +839,8 @@ void sys_lxt_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpoff"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpon"; @@ -842,7 +848,8 @@ void sys_lxt_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpon"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpvars"; @@ -850,5 +857,6 @@ void sys_lxt_register() tf_data.compiletf = sys_dumpvars_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpvars"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index 14e90a2ec..e8c36e219 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -878,6 +878,7 @@ void sys_lxt2_register() int idx; struct t_vpi_vlog_info vlog_info; s_vpi_systf_data tf_data; + vpiHandle res; /* Scan the extended arguments, looking for lxt optimization @@ -902,7 +903,8 @@ void sys_lxt2_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpall"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpfile"; @@ -910,7 +912,8 @@ void sys_lxt2_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpfile"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpflush"; @@ -918,7 +921,8 @@ void sys_lxt2_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpflush"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumplimit"; @@ -926,7 +930,8 @@ void sys_lxt2_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumplimit"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpoff"; @@ -934,7 +939,8 @@ void sys_lxt2_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpoff"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpon"; @@ -942,7 +948,8 @@ void sys_lxt2_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpon"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpvars"; @@ -950,5 +957,6 @@ void sys_lxt2_register() tf_data.compiletf = sys_dumpvars_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpvars"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_plusargs.c b/vpi/sys_plusargs.c index 09ee65f4a..5c1257b85 100644 --- a/vpi/sys_plusargs.c +++ b/vpi/sys_plusargs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2010 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 @@ -371,7 +371,7 @@ static PLI_INT32 sys_value_plusargs_calltf(PLI_BYTE8*name) void sys_plusargs_register() { s_vpi_systf_data tf_data; - + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiIntFunc; @@ -380,7 +380,8 @@ void sys_plusargs_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$test$plusargs"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiIntFunc; @@ -389,6 +390,7 @@ void sys_plusargs_register() tf_data.compiletf = sys_value_plusargs_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$value$plusargs"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_random.c b/vpi/sys_random.c index bf9f05e22..84a56cfc8 100644 --- a/vpi/sys_random.c +++ b/vpi/sys_random.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2010 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 @@ -896,6 +896,7 @@ static PLI_INT32 sys_rand_func_sizetf(PLI_BYTE8 *x) void sys_random_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -904,7 +905,8 @@ void sys_random_register() tf_data.compiletf = sys_random_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$random"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* From System Verilog 3.1a. */ tf_data.type = vpiSysFunc; @@ -914,7 +916,8 @@ void sys_random_register() tf_data.compiletf = sys_random_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$urandom"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /* From System Verilog 3.1a. */ tf_data.type = vpiSysFunc; @@ -924,7 +927,8 @@ void sys_random_register() tf_data.compiletf = sys_urandom_range_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$urandom_range"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -933,7 +937,8 @@ void sys_random_register() tf_data.compiletf = sys_rand_three_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_uniform"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -942,7 +947,8 @@ void sys_random_register() tf_data.compiletf = sys_rand_three_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_normal"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -951,7 +957,8 @@ void sys_random_register() tf_data.compiletf = sys_rand_two_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_exponential"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -960,7 +967,8 @@ void sys_random_register() tf_data.compiletf = sys_rand_two_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_poisson"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -969,7 +977,8 @@ void sys_random_register() tf_data.compiletf = sys_rand_two_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_chi_square"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -978,7 +987,8 @@ void sys_random_register() tf_data.compiletf = sys_rand_two_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_t"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -987,5 +997,6 @@ void sys_random_register() tf_data.compiletf = sys_rand_three_args_compiletf; tf_data.sizetf = sys_rand_func_sizetf; tf_data.user_data = "$dist_erlang"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_random_mti.c b/vpi/sys_random_mti.c index 7294e0f6a..30d7dd341 100644 --- a/vpi/sys_random_mti.c +++ b/vpi/sys_random_mti.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2010 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 @@ -145,6 +145,7 @@ static PLI_INT32 sys_mti_random_calltf(PLI_BYTE8*name) void sys_random_mti_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -152,7 +153,8 @@ void sys_random_mti_register() tf_data.calltf = sys_mti_random_calltf; tf_data.compiletf = sys_random_compiletf; tf_data.user_data = "$mti_random"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSysFuncInt; @@ -160,6 +162,7 @@ void sys_random_mti_register() tf_data.calltf = sys_mti_dist_uniform_calltf; tf_data.compiletf = sys_rand_three_args_compiletf; tf_data.user_data = "$mti_dist_uniform"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index 638d2ee83..ef1a761ae 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -571,6 +571,7 @@ static PLI_INT32 sys_writemem_calltf(PLI_BYTE8*name) void sys_readmem_register() { s_vpi_systf_data tf_data; + vpiHandle res; s_cb_data cb_data; tf_data.type = vpiSysTask; @@ -579,7 +580,8 @@ void sys_readmem_register() tf_data.compiletf = sys_mem_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$readmemh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$readmemb"; @@ -587,7 +589,8 @@ void sys_readmem_register() tf_data.compiletf = sys_mem_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$readmemb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$readmempath"; @@ -595,7 +598,8 @@ void sys_readmem_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$readmempath"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$writememh"; @@ -603,7 +607,8 @@ void sys_readmem_register() tf_data.compiletf = sys_mem_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$writememh"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$writememb"; @@ -611,7 +616,8 @@ void sys_readmem_register() tf_data.compiletf = sys_mem_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$writememb"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); cb_data.reason = cbEndOfSimulation; cb_data.time = 0; diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index 52cd923ee..0c0d10b19 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -727,6 +727,7 @@ static PLI_INT32 sys_sscanf_calltf(PLI_BYTE8*name) void sys_scanf_register() { s_vpi_systf_data tf_data; + vpiHandle res; /*============================== fscanf */ tf_data.type = vpiSysFunc; @@ -736,7 +737,8 @@ void sys_scanf_register() tf_data.compiletf = sys_fscanf_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$fscanf"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); /*============================== sscanf */ tf_data.type = vpiSysFunc; @@ -746,5 +748,6 @@ void sys_scanf_register() tf_data.compiletf = sys_sscanf_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$sscanf"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_sdf.c b/vpi/sys_sdf.c index 139ebcc74..622cc3468 100644 --- a/vpi/sys_sdf.c +++ b/vpi/sys_sdf.c @@ -328,6 +328,7 @@ static PLI_INT32 sys_sdf_annotate_calltf(PLI_BYTE8*name) void sys_sdf_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysTask; tf_data.tfname = "$sdf_annotate"; @@ -335,5 +336,6 @@ void sys_sdf_register() tf_data.compiletf = sys_sdf_annotate_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$sdf_annotate"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_time.c b/vpi/sys_time.c index 83ac46407..28688fe7b 100644 --- a/vpi/sys_time.c +++ b/vpi/sys_time.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2010 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 @@ -111,6 +111,7 @@ static PLI_INT32 sys_realtime_calltf(PLI_BYTE8*name) void sys_time_register() { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.tfname = "$time"; @@ -119,7 +120,8 @@ void sys_time_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$time"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.tfname = "$realtime"; @@ -128,7 +130,8 @@ void sys_time_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$realtime"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.tfname = "$stime"; @@ -137,7 +140,8 @@ void sys_time_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$stime"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.tfname = "$simtime"; @@ -146,7 +150,8 @@ void sys_time_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$simtime"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.tfname = "$abstime"; @@ -155,5 +160,6 @@ void sys_time_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$abstime"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 10465c668..027c89817 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 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 @@ -840,6 +840,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name) void sys_vcd_register() { s_vpi_systf_data tf_data; + vpiHandle res; /* All the compiletf routines are located in vcd_priv.c. */ @@ -849,7 +850,8 @@ void sys_vcd_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpall"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpfile"; @@ -857,7 +859,8 @@ void sys_vcd_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpfile"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpflush"; @@ -865,7 +868,8 @@ void sys_vcd_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpflush"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumplimit"; @@ -873,7 +877,8 @@ void sys_vcd_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumplimit"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpoff"; @@ -881,7 +886,8 @@ void sys_vcd_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpoff"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpon"; @@ -889,7 +895,8 @@ void sys_vcd_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpon"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpvars"; @@ -897,5 +904,6 @@ void sys_vcd_register() tf_data.compiletf = sys_dumpvars_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpvars"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/sys_vcdoff.c b/vpi/sys_vcdoff.c index 49e8d5c45..eb30eedac 100644 --- a/vpi/sys_vcdoff.c +++ b/vpi/sys_vcdoff.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2010 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 @@ -55,6 +55,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name) void sys_vcdoff_register() { s_vpi_systf_data tf_data; + vpiHandle res; /* All the compiletf routines are located in vcd_priv.c. */ @@ -64,7 +65,8 @@ void sys_vcdoff_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpall"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpfile"; @@ -72,7 +74,8 @@ void sys_vcdoff_register() tf_data.compiletf = sys_one_string_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpfile"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpflush"; @@ -80,7 +83,8 @@ void sys_vcdoff_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpflush"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumplimit"; @@ -88,7 +92,8 @@ void sys_vcdoff_register() tf_data.compiletf = sys_one_numeric_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumplimit"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpoff"; @@ -96,7 +101,8 @@ void sys_vcdoff_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpoff"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpon"; @@ -104,7 +110,8 @@ void sys_vcdoff_register() tf_data.compiletf = sys_no_arg_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpon"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysTask; tf_data.tfname = "$dumpvars"; @@ -112,5 +119,6 @@ void sys_vcdoff_register() tf_data.compiletf = sys_dumpvars_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpvars"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi/v2005_math.c b/vpi/v2005_math.c index feda0818c..4183dd7d5 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-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2010 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 @@ -337,6 +337,7 @@ static void sys_v2005_math_register(void) { s_cb_data cb_data; s_vpi_systf_data tf_data; + vpiHandle res; unsigned idx; /* Register the single argument functions. */ @@ -349,7 +350,8 @@ static void sys_v2005_math_register(void) for (idx=0; va_single_data[idx].name != 0; idx++) { tf_data.tfname = va_single_data[idx].name; tf_data.user_data = (PLI_BYTE8 *) &va_single_data[idx]; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } /* Register the double argument functions. */ @@ -362,7 +364,8 @@ static void sys_v2005_math_register(void) for (idx=0; va_double_data[idx].name != 0; idx++) { tf_data.tfname = va_double_data[idx].name; tf_data.user_data = (PLI_BYTE8 *) &va_double_data[idx]; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } /* We need to clean up the userdata. */ diff --git a/vpi/va_math.c b/vpi/va_math.c index cc2581422..0f5c05727 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-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2010 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 @@ -375,6 +375,7 @@ static void va_math_register(void) { s_cb_data cb_data; s_vpi_systf_data tf_data; + vpiHandle res; unsigned idx; /* Register the single argument functions. */ @@ -387,7 +388,8 @@ static void va_math_register(void) for (idx=0; va_single_data[idx].name != 0; idx++) { tf_data.tfname = va_single_data[idx].name; tf_data.user_data = (PLI_BYTE8 *) &va_single_data[idx]; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } /* Register the double argument functions. */ @@ -400,7 +402,8 @@ static void va_math_register(void) for (idx=0; va_double_data[idx].name != 0; idx++) { tf_data.tfname = va_double_data[idx].name; tf_data.user_data = (PLI_BYTE8 *) &va_double_data[idx]; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } /* We need to clean up the userdata. */ diff --git a/vpi/vams_simparam.c b/vpi/vams_simparam.c index 87ac2e6f0..11779a8c1 100644 --- a/vpi/vams_simparam.c +++ b/vpi/vams_simparam.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2010 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 @@ -263,6 +263,7 @@ static PLI_INT32 simparam_str_sizetf(PLI_BYTE8 *name_ext) void vams_simparam_register(void) { s_vpi_systf_data tf_data; + vpiHandle res; tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiRealFunc; @@ -271,7 +272,8 @@ void vams_simparam_register(void) tf_data.sizetf = 0; tf_data.tfname = "$simparam"; tf_data.user_data = ""; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); tf_data.type = vpiSysFunc; tf_data.sysfunctype = vpiSizedFunc; /* What should this be? */ @@ -280,5 +282,6 @@ void vams_simparam_register(void) tf_data.sizetf = simparam_str_sizetf; /* Only 128 characters! */ tf_data.tfname = "$simparam$str"; tf_data.user_data = "$str"; - vpi_register_systf(&tf_data); + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); } diff --git a/vpi_user.h b/vpi_user.h index 27dcbce34..0122bfdac 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -594,6 +594,7 @@ extern DLLEXPORT void (*vlog_startup_routines[])(); extern void vpip_format_strength(char*str, s_vpi_value*value, unsigned bit); extern void vpip_set_return_value(int value); extern s_vpi_vecval vpip_calc_clog2(vpiHandle arg); +extern void vpip_make_systf_system_defined(vpiHandle ref); EXTERN_C_END diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 28c7d0cbe..daf4a2bb6 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -151,7 +151,12 @@ PLI_INT32 vpi_chk_error(p_vpi_error_info info) PLI_INT32 vpi_compare_objects(vpiHandle obj1, vpiHandle obj2) { - assert(0); + assert(obj1); + assert(obj2); + + // Does this actually work for all cases? + if (obj1 != obj2) return 0; + else return 1; } /* @@ -173,8 +178,8 @@ void vpi_get_systf_info(vpiHandle ref, p_vpi_systf_data data) struct __vpiSysTaskCall*call = (struct __vpiSysTaskCall*)ref; rfp = call->defn; } - /* Assert that vpiUserDefn is true! For now this is always true. */ - assert(1); + /* Assert that vpiUserDefn is true! */ + assert(rfp->is_user_defn); data->type = rfp->info.type; data->sysfunctype = rfp->info.sysfunctype; @@ -1006,6 +1011,8 @@ static vpiHandle vpi_iterate_global(int type) case vpiModule: return vpip_make_root_iterator(); + case vpiUserSystf: + return vpip_make_systf_iterator(); } return 0; diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 7f705004b..bb80078b7 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -417,8 +417,11 @@ extern struct __vpiRealVar* vpip_realvar_from_handle(vpiHandle obj); struct __vpiUserSystf { struct __vpiHandle base; s_vpi_systf_data info; + bool is_user_defn; }; +extern vpiHandle vpip_make_systf_iterator(void); + extern struct __vpiUserSystf* vpip_find_systf(const char*name); diff --git a/vvp/vpi_tasks.cc b/vvp/vpi_tasks.cc index 0ed434826..3c4906c86 100644 --- a/vvp/vpi_tasks.cc +++ b/vvp/vpi_tasks.cc @@ -59,7 +59,7 @@ static vpiHandle systask_handle(int type, vpiHandle ref) case vpiUserSystf: /* Assert that vpiUserDefn is true! */ - assert(1); + assert(rfp->defn->is_user_defn); return &rfp->defn->base; default: @@ -86,9 +86,8 @@ static int systask_get(int type, vpiHandle ref) case vpiLineNo: return rfp->lineno; - /* For now we always have this information. */ case vpiUserDefn: - return 1; + return rfp->defn->is_user_defn; default: return vpiUndefined; @@ -109,9 +108,8 @@ static int sysfunc_get(int type, vpiHandle ref) case vpiLineNo: return rfp->lineno; - /* For now we always have this information. */ case vpiUserDefn: - return 1; + return rfp->defn->is_user_defn; default: return vpiUndefined; @@ -544,6 +542,74 @@ void def_table_delete(void) } #endif +struct __vpiSystfIterator { + struct __vpiHandle base; + unsigned next; +}; + +static vpiHandle systf_iterator_scan(vpiHandle ref, int) +{ + assert(ref->vpi_type->type_code == vpiIterator); + struct __vpiSystfIterator*obj = (struct __vpiSystfIterator*) ref; + + if (obj->next >= def_count) { + vpi_free_object(ref); + return 0; + } + + unsigned use_index = obj->next; + while (!def_table[use_index]->is_user_defn) { + obj->next += 1; + use_index = obj->next; + if (obj->next >= def_count) { + vpi_free_object(ref); + return 0; + } + } + obj->next += 1; + return &(def_table[use_index])->base; +} + +static int systf_iterator_free_object(vpiHandle ref) +{ + assert(ref->vpi_type->type_code == vpiIterator); + struct __vpiSystfIterator*obj = (struct __vpiSystfIterator*) ref; + free(obj); + return 1; +} + +static const struct __vpirt vpip_systf_iterator_rt = { + vpiIterator, + 0, + 0, + 0, + 0, + 0, + 0, + systf_iterator_scan, + systf_iterator_free_object +}; + +vpiHandle vpip_make_systf_iterator(void) +{ + /* Check to see if there are any user defined functions. */ + bool have_user_defn = false; + unsigned idx; + for (idx = 0; idx < def_count; idx += 1) { + if (def_table[idx]->is_user_defn) { + have_user_defn = true; + break; + } + } + if (!have_user_defn) return 0; + + struct __vpiSystfIterator*res; + res = (struct __vpiSystfIterator*) calloc(1, sizeof (*res)); + res->base.vpi_type = &vpip_systf_iterator_rt; + res->next = idx; + return &res->base; +} + struct __vpiUserSystf* vpip_find_systf(const char*name) { for (unsigned idx = 0 ; idx < def_count ; idx += 1) @@ -553,6 +619,14 @@ struct __vpiUserSystf* vpip_find_systf(const char*name) return 0; } +void vpip_make_systf_system_defined(vpiHandle ref) +{ + assert(ref); + assert(ref->vpi_type->type_code == vpiUserSystf); + struct __vpiUserSystf*obj = (__vpiUserSystf*) ref; + obj->is_user_defn = false; +} + /* * A vpi_call is actually built up into a vpiSysTaskCall VPI object * that refers back to the vpiUserSystf VPI object that is the @@ -742,6 +816,7 @@ vpiHandle vpi_register_systf(const struct t_vpi_systf_data*ss) cur->info = *ss; cur->info.tfname = strdup(ss->tfname); + cur->is_user_defn = true; return &cur->base; } diff --git a/vvp/vvp.def b/vvp/vvp.def index b0f334339..ba44435e7 100644 --- a/vvp/vvp.def +++ b/vvp/vvp.def @@ -37,6 +37,7 @@ vpi_sim_control vpi_sim_vcontrol vpi_vprintf -vpip_format_strength -vpip_set_return_value vpip_calc_clog2 +vpip_format_strength +vpip_make_systf_system_defined +vpip_set_return_value