From 7631efdb99efa6dd0cd1689127f5b7dcfe5d3d07 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 15 Apr 2020 22:08:47 +0200 Subject: testsuite/gna: add a test for #1228 --- testsuite/gna/issue1228/vpi1.c | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 testsuite/gna/issue1228/vpi1.c (limited to 'testsuite/gna/issue1228/vpi1.c') diff --git a/testsuite/gna/issue1228/vpi1.c b/testsuite/gna/issue1228/vpi1.c new file mode 100644 index 000000000..5b33087c0 --- /dev/null +++ b/testsuite/gna/issue1228/vpi1.c @@ -0,0 +1,46 @@ +#include +#include +#include + +static void +show_value (const char *name) +{ + vpiHandle net; + s_vpi_value val; + + net = vpi_handle_by_name ((char *)name, NULL); + if (net == NULL) + { + printf ("cannot get net: %s\n", name); + exit(1); + return; + } + val.format = vpiBinStrVal; + vpi_get_value (net, &val); + printf ("%s= %s\n", name, val.value.str); +} + +static PLI_INT32 +vpi_proc (struct t_cb_data *cb) +{ + show_value ("test_load.w"); + show_value ("test_load.\\extend.id\\"); + return 0; +} + +static void my_handle_register(void) +{ + s_cb_data cb; + + cb.reason = cbEndOfCompile; + cb.cb_rtn = &vpi_proc; + cb.user_data = NULL; + if (vpi_register_cb (&cb) == NULL) + vpi_printf ("cannot register EndOfCompile call back\n"); +} + +void (*vlog_startup_routines[]) () = +{ + my_handle_register, + 0 +}; -- cgit v1.2.3