aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/vhpi/005trace_file
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/vhpi/005trace_file')
-rw-r--r--testsuite/vhpi/005trace_file/mydesign.vhdl9
-rwxr-xr-xtestsuite/vhpi/005trace_file/testsuite.sh32
-rw-r--r--testsuite/vhpi/005trace_file/vhpi_lib.c31
3 files changed, 72 insertions, 0 deletions
diff --git a/testsuite/vhpi/005trace_file/mydesign.vhdl b/testsuite/vhpi/005trace_file/mydesign.vhdl
new file mode 100644
index 000000000..38fdfda98
--- /dev/null
+++ b/testsuite/vhpi/005trace_file/mydesign.vhdl
@@ -0,0 +1,9 @@
+library ieee ;
+use ieee.std_logic_1164.all;
+
+entity myentity is
+end myentity;
+
+architecture arch of myentity is
+begin
+end arch;
diff --git a/testsuite/vhpi/005trace_file/testsuite.sh b/testsuite/vhpi/005trace_file/testsuite.sh
new file mode 100755
index 000000000..24f3ddd9f
--- /dev/null
+++ b/testsuite/vhpi/005trace_file/testsuite.sh
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze mydesign.vhdl
+elab myentity
+
+if c_compiler_is_available && ghdl_has_feature myentity vhpi; then
+ $GHDL --vpi-compile -v gcc -c vhpi_lib.c
+ $GHDL --vpi-link -v gcc -o vhpi_lib.vhpi vhpi_lib.o
+
+ add_vpi_path
+
+ simulate myentity --vhpi=./vhpi_lib.vhpi --vhpi-trace=./vhpi_trace.log | tee myentity.out
+ if grep -q Error myentity.out; then
+ echo "Error in output"
+ exit 1;
+ fi
+ if grep -q error myentity.out; then
+ echo "error in output"
+ exit 1;
+ fi
+ if ! grep -q "vhpi_register_cb (" vhpi_trace.log; then
+ echo "VHPI trace missing"
+ exit 1;
+ fi
+
+ rm -f vhpi_lib.vhpi vhpi_lib.o myentity.out vhpi_trace.log
+fi
+clean
+
+echo "Test successful"
diff --git a/testsuite/vhpi/005trace_file/vhpi_lib.c b/testsuite/vhpi/005trace_file/vhpi_lib.c
new file mode 100644
index 000000000..66ce5e115
--- /dev/null
+++ b/testsuite/vhpi/005trace_file/vhpi_lib.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <vhpi_user.h>
+
+
+void my_callback(const vhpiCbDataT * cb_data) {
+}
+
+void my_startup()
+{
+ printf ("VHPI lib\n");
+
+ vhpiCbDataT cb_data;
+ vhpiTimeT time;
+
+ cb_data.reason = vhpiCbStartOfSimulation;
+ cb_data.cb_rtn = my_callback;
+ cb_data.obj = NULL;
+ cb_data.time = &time;
+ cb_data.value = NULL;
+ cb_data.user_data = (char *)NULL;
+ time.high = 0;
+ time.low = 0;
+
+ vhpi_register_cb(&cb_data, NULL);
+}
+
+void (*vhpi_startup_routines[]) () =
+{
+ my_startup,
+ 0
+};