diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-09-23 03:21:39 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-09-23 03:21:39 +0200 |
commit | eb77ae0e52d9870105674677c6ec4914dda995ec (patch) | |
tree | 4f8463f4c9623ef9b263827c41088765182bceaa /testsuite/gna/issue152 | |
parent | 0dbd1e7c44a0046012ed57218458145935010d41 (diff) | |
download | ghdl-eb77ae0e52d9870105674677c6ec4914dda995ec.tar.gz ghdl-eb77ae0e52d9870105674677c6ec4914dda995ec.tar.bz2 ghdl-eb77ae0e52d9870105674677c6ec4914dda995ec.zip |
Add testcase for issue #152
Diffstat (limited to 'testsuite/gna/issue152')
-rw-r--r-- | testsuite/gna/issue152/ax_wb_pli.vhdl | 30 | ||||
-rw-r--r-- | testsuite/gna/issue152/ax_wb_pli_c.c | 35 | ||||
-rw-r--r-- | testsuite/gna/issue152/ax_wb_pli_pkg.vhdl | 29 | ||||
-rwxr-xr-x | testsuite/gna/issue152/testsuite.sh | 12 |
4 files changed, 106 insertions, 0 deletions
diff --git a/testsuite/gna/issue152/ax_wb_pli.vhdl b/testsuite/gna/issue152/ax_wb_pli.vhdl new file mode 100644 index 000000000..13ac69253 --- /dev/null +++ b/testsuite/gna/issue152/ax_wb_pli.vhdl @@ -0,0 +1,30 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library work; +use work.ax_wb_pli_pkg.all; + +entity ax_wb_pli is +end entity ax_wb_pli; + +architecture behav of ax_wb_pli is + + constant cQUEUE_ID : integer := 0; + shared variable queue_handle : integer; + +begin + + + init_bus_handle : process + begin + queue_handle := init_queue(cQUEUE_ID); + if (queue_handle = 0) then + assert false report "Failed to register Message Queue"; + end if; + wait for 1 us; + delete_queue(cQUEUE_ID); + end process; + + +end behav; diff --git a/testsuite/gna/issue152/ax_wb_pli_c.c b/testsuite/gna/issue152/ax_wb_pli_c.c new file mode 100644 index 000000000..da5f3ce62 --- /dev/null +++ b/testsuite/gna/issue152/ax_wb_pli_c.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/msg.h> + +int sim_init_queue (int qid) +{ + key_t key; + int msgqueue_id; + //struct mymsgbuf qbuf; + + /* Create unique key via call to ftok() */ + key = ftok(".", 'm'); + + /* Open the queue - create if necessary */ + if((msgqueue_id = msgget(key, IPC_CREAT|0660)) == -1) { + perror("msgget"); + exit(1); + } + return msgqueue_id; + +} + +int sim_delete_queue(int qid) +{ + + /* Remove the queue */ + msgctl(qid, IPC_RMID, 0); + + return 0; + +} + diff --git a/testsuite/gna/issue152/ax_wb_pli_pkg.vhdl b/testsuite/gna/issue152/ax_wb_pli_pkg.vhdl new file mode 100644 index 000000000..034da335e --- /dev/null +++ b/testsuite/gna/issue152/ax_wb_pli_pkg.vhdl @@ -0,0 +1,29 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package ax_wb_pli_pkg is + + type bus_t is access integer; + + function init_queue(queue_id : integer) return integer; + attribute foreign of init_queue : function is "VHPIDIRECT sim_init_queue"; + + procedure delete_queue(queue_id : integer); + attribute foreign of delete_queue : procedure is "VHPIDIRECT sim_delete_queue"; + +end package; + +package body ax_wb_pli_pkg is + + function init_queue(queue_id : integer) return integer is + begin + assert false report "VHPI" severity failure; + end function; + + procedure delete_queue(queue_id : integer) is + begin + assert false report "VHPI" severity failure; + end procedure; + +end package body; diff --git a/testsuite/gna/issue152/testsuite.sh b/testsuite/gna/issue152/testsuite.sh new file mode 100755 index 000000000..24d87992d --- /dev/null +++ b/testsuite/gna/issue152/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze ax_wb_pli_pkg.vhdl +analyze ax_wb_pli.vhdl + +# Don't try to compile the C file, it's unix specific + +clean + +echo "Test successful" |