From d5c2e058c24a05f78f857f5aa4f3727de3a7fa79 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 17 Jul 2016 16:20:52 +0200 Subject: Add testcase for issue #98 --- testsuite/gna/issue98/test_load.vhdl | 31 +++++++++++++++++++++++++++++++ testsuite/gna/issue98/testsuite.sh | 14 ++++++++++++++ testsuite/gna/issue98/vpi1.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 testsuite/gna/issue98/test_load.vhdl create mode 100755 testsuite/gna/issue98/testsuite.sh create mode 100644 testsuite/gna/issue98/vpi1.c (limited to 'testsuite/gna') 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 +#include + +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 +}; -- cgit v1.2.3