diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-04-15 22:08:47 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-04-15 22:09:25 +0200 |
commit | 7631efdb99efa6dd0cd1689127f5b7dcfe5d3d07 (patch) | |
tree | 7d348e48039494bbacc94a31af7df519d6cbe4b4 /testsuite/gna/issue1228/vpi1.c | |
parent | 80c4f065d529ea257dd6e364c8a97a1c649e0bcc (diff) | |
download | ghdl-7631efdb99efa6dd0cd1689127f5b7dcfe5d3d07.tar.gz ghdl-7631efdb99efa6dd0cd1689127f5b7dcfe5d3d07.tar.bz2 ghdl-7631efdb99efa6dd0cd1689127f5b7dcfe5d3d07.zip |
testsuite/gna: add a test for #1228
Diffstat (limited to 'testsuite/gna/issue1228/vpi1.c')
-rw-r--r-- | testsuite/gna/issue1228/vpi1.c | 46 |
1 files changed, 46 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> +#include <vpi_user.h> + +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 +}; |