aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-07-17 16:20:52 +0200
committerTristan Gingold <tgingold@free.fr>2016-07-17 16:20:52 +0200
commitd5c2e058c24a05f78f857f5aa4f3727de3a7fa79 (patch)
tree7316b6520d61a7bb2a105c45179e6e1b9eb5535a /testsuite/gna
parente35b24adbb1d0e76c076fe475c8442738b3378be (diff)
downloadghdl-d5c2e058c24a05f78f857f5aa4f3727de3a7fa79.tar.gz
ghdl-d5c2e058c24a05f78f857f5aa4f3727de3a7fa79.tar.bz2
ghdl-d5c2e058c24a05f78f857f5aa4f3727de3a7fa79.zip
Add testcase for issue #98
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/issue98/test_load.vhdl31
-rwxr-xr-xtestsuite/gna/issue98/testsuite.sh14
-rw-r--r--testsuite/gna/issue98/vpi1.c36
3 files changed, 81 insertions, 0 deletions
diff --git a/testsuite/gna/issue98/test_load.vhdl b/testsuite/gna/issue98/test_load.vhdl
new file mode 100644
index 000000000..9aefe7915
--- /dev/null
+++ b/testsuite/gna/issue98/test_load.vhdl
@@ -0,0 +1,31 @@
+library ieee ;
+use ieee.std_logic_1164.all;
+
+entity test_load is
+
+port(
+ clk_i : in std_ulogic;
+ rst_i : in std_ulogic;
+ dat_i : in std_ulogic_vector(0 to 31);
+ sot_in : in std_ulogic;
+ dat_o : out std_ulogic_vector(0 to 2559)
+
+ );
+end test_load;
+
+architecture RTL of test_load is
+
+ signal w : std_ulogic_vector(0 to 2559);
+
+begin
+
+ process(clk_i)
+ begin
+ if (clk_i'event and clk_i = '1') then
+ w <= dat_i & w(0 to 2559-32);
+
+ end if;
+ end process;
+ dat_o <= w;
+
+end RTL;
diff --git a/testsuite/gna/issue98/testsuite.sh b/testsuite/gna/issue98/testsuite.sh
new file mode 100755
index 000000000..b8e3cd710
--- /dev/null
+++ b/testsuite/gna/issue98/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze test_load.vhdl
+$GHDL --vpi-compile gcc -c vpi1.c
+$GHDL --vpi-link gcc -o vpi1.vpi vpi1.o
+
+elab_simulate test_load --vpi=vpi1.vpi
+
+rm -f vpi1.vpi vpi1.o
+clean
+
+echo "Test successful"
diff --git a/testsuite/gna/issue98/vpi1.c b/testsuite/gna/issue98/vpi1.c
new file mode 100644
index 000000000..0adae07fe
--- /dev/null
+++ b/testsuite/gna/issue98/vpi1.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <vpi_user.h>
+
+void
+vpi_proc (void)
+{
+ vpiHandle net;
+ s_vpi_value val;
+
+ net = vpi_handle_by_name ("test_load.dat_o", NULL);
+ if (net == NULL)
+ {
+ printf ("cannot get net\n");
+ return;
+ }
+ val.format = vpiBinStrVal;
+ vpi_get_value (net, &val);
+ printf ("value: %s\n", val.value.str);
+}
+
+void my_handle_register()
+{
+ 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
+};