diff --git a/vpi/Makefile.in b/vpi/Makefile.in index 16599f431..278be1f43 100644 --- a/vpi/Makefile.in +++ b/vpi/Makefile.in @@ -73,7 +73,7 @@ M = sys_clog2.o v2005_math.o # Object files for va_math.vpi V = va_math.o -V2009 = v2009_table.o v2009_enum.o v2009_string.o +V2009 = v2009_table.o v2009_array.o v2009_enum.o v2009_string.o VHDL_SYS = vhdl_table.o diff --git a/vpi/v2009.sft b/vpi/v2009.sft index 429342bf9..78424f454 100644 --- a/vpi/v2009.sft +++ b/vpi/v2009.sft @@ -1,4 +1,13 @@ # # This is the system function descriptor table for the -# builtin (system) functions. +# builtin (SystemVerilog) functions. # + +$dimensions vpiSysFuncInt +$unpacked_dimensions vpiSysFuncInt +$left vpiSysFuncInt +$right vpiSysFuncInt +$low vpiSysFuncInt +$high vpiSysFuncInt +$increment vpiSysFuncInt +$size vpiSysFuncInt diff --git a/vpi/v2009_array.c b/vpi/v2009_array.c new file mode 100644 index 000000000..f362b5b8f --- /dev/null +++ b/vpi/v2009_array.c @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2013 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "sys_priv.h" + +static PLI_INT32 func_not_implemented_compiletf(ICARUS_VPI_CONST PLI_BYTE8* name) +{ + vpiHandle callh = vpi_handle(vpiSysTfCall, 0); + + vpi_printf("SORRY: %s:%d: function %s() is not currently implemented.\n", + vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh), + name); + vpi_control(vpiFinish, 1); + return 0; +} + +void v2009_array_register(void) +{ + s_vpi_systf_data tf_data; + vpiHandle res; + + tf_data.type = vpiSysFunc; + tf_data.sysfunctype = vpiIntFunc; + tf_data.calltf = 0; + tf_data.compiletf = func_not_implemented_compiletf;; + tf_data.sizetf = 0; + + /* These functions are not currently implemented. */ + tf_data.tfname = "$dimensions"; + tf_data.user_data = "$dimensions"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$unpacked_dimensions"; + tf_data.user_data = "$unpacked_dimensions"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$left"; + tf_data.user_data = "$left"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$right"; + tf_data.user_data = "$right"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$low"; + tf_data.user_data = "$low"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$high"; + tf_data.user_data = "$high"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$increment"; + tf_data.user_data = "$increment"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); + + tf_data.tfname = "$size"; + tf_data.user_data = "$size"; + res = vpi_register_systf(&tf_data); + vpip_make_systf_system_defined(res); +} diff --git a/vpi/v2009_table.c b/vpi/v2009_table.c index d19bc03b0..1b1b3d226 100644 --- a/vpi/v2009_table.c +++ b/vpi/v2009_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Stephen Williams (steve@icarus.com) + * Copyright (c) 2010-2013 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 @@ -17,16 +17,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -# include "vpi_config.h" -# include "vpi_user.h" -# include -# include -# include - +extern void v2009_array_register(void); extern void v2009_enum_register(void); extern void v2009_string_register(void); void (*vlog_startup_routines[])() = { + v2009_array_register, v2009_enum_register, v2009_string_register, 0