diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-01-17 19:37:09 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-01-18 07:41:45 +0100 |
commit | 7fb9a8dadecdecebe4c511018063ce4982d0d3e9 (patch) | |
tree | fbe9ede1b5bb280a3568a56637e08c169734575b /testsuite/gna/issue695 | |
parent | e5e4f82e065abcfbfb466ca65f0adfff0c1080e4 (diff) | |
download | ghdl-7fb9a8dadecdecebe4c511018063ce4982d0d3e9.tar.gz ghdl-7fb9a8dadecdecebe4c511018063ce4982d0d3e9.tar.bz2 ghdl-7fb9a8dadecdecebe4c511018063ce4982d0d3e9.zip |
testsuite/gna: add testcase from #695
Diffstat (limited to 'testsuite/gna/issue695')
-rw-r--r-- | testsuite/gna/issue695/mux.vhdl | 32 | ||||
-rwxr-xr-x | testsuite/gna/issue695/testsuite.sh | 10 |
2 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/gna/issue695/mux.vhdl b/testsuite/gna/issue695/mux.vhdl new file mode 100644 index 000000000..981229d67 --- /dev/null +++ b/testsuite/gna/issue695/mux.vhdl @@ -0,0 +1,32 @@ +library ieee; +use ieee.std_logic_1164.all; + +package mux is + generic ( + MUX_DATA_SIZE : natural + ); + subtype mux_data is std_logic_vector(MUX_DATA_SIZE-1 downto 0); + type mux_data_array is array (natural range <>) of mux_data; +end package; + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity multiplexer is + generic ( + MUX_DATA_SIZE : natural; + MUX_CTRL_SIZE : natural; + package mux_g is new work.mux generic map (MUX_DATA_SIZE => MUX_DATA_SIZE) + ); + port ( + MUX_CTRL : in std_logic_vector(MUX_CTRL_SIZE-1 downto 0); + MUX_IN : in mux_g.mux_data_array(0 to 2**MUX_CTRL_SIZE-1); + MUX_OUT : out mux_g.mux_data + ); +end entity; + +architecture multiplexer_arch of multiplexer is +begin + MUX_OUT <= MUX_IN(to_integer(unsigned(MUX_CTRL))); +end architecture; diff --git a/testsuite/gna/issue695/testsuite.sh b/testsuite/gna/issue695/testsuite.sh new file mode 100755 index 000000000..3cccecc6f --- /dev/null +++ b/testsuite/gna/issue695/testsuite.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze mux.vhdl + +clean + +echo "Test successful" |