diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-03-03 07:27:35 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-03-04 08:16:57 +0100 |
commit | 06ac73c53373d22b5ec7737d619a1556671bb780 (patch) | |
tree | a256227301e0ba9a44fd5d1bd5e90c2a0cd8fd94 /testsuite | |
parent | c22d8419d4a9a5e93f13ae5027728295b3e691f3 (diff) | |
download | ghdl-06ac73c53373d22b5ec7737d619a1556671bb780.tar.gz ghdl-06ac73c53373d22b5ec7737d619a1556671bb780.tar.bz2 ghdl-06ac73c53373d22b5ec7737d619a1556671bb780.zip |
testsuite/gna: add a test for #2368
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/gna/issue2368/matchent1.vhdl | 27 | ||||
-rw-r--r-- | testsuite/gna/issue2368/matchent2.vhdl | 30 | ||||
-rwxr-xr-x | testsuite/gna/issue2368/testsuite.sh | 11 |
3 files changed, 68 insertions, 0 deletions
diff --git a/testsuite/gna/issue2368/matchent1.vhdl b/testsuite/gna/issue2368/matchent1.vhdl new file mode 100644 index 000000000..5fe907965 --- /dev/null +++ b/testsuite/gna/issue2368/matchent1.vhdl @@ -0,0 +1,27 @@ +library ieee; +use ieee.numeric_std.all; + +entity MatchEnt is + port ( + A : in unsigned(4 downto 0); + B : in unsigned(4 downto 0); + XOUT : out unsigned(4 downto 0) + ); +end entity; + +architecture behavior of MatchEnt is +begin + tester : process (A, B) + begin + case A is + when to_unsigned(17, 5) => + XOUT <= A + 1; + when to_unsigned(21, 5) => + XOUT <= A + B; + when to_unsigned(34, 5) => + XOUT <= A - B; + when others => + XOUT <= resize(A * B, 5); + end case; + end process; +end architecture; diff --git a/testsuite/gna/issue2368/matchent2.vhdl b/testsuite/gna/issue2368/matchent2.vhdl new file mode 100644 index 000000000..9a5321a48 --- /dev/null +++ b/testsuite/gna/issue2368/matchent2.vhdl @@ -0,0 +1,30 @@ +library ieee; +use ieee.numeric_std.all; + +entity MatchEnt is + port ( + A : in unsigned(4 downto 0); + B : in unsigned(4 downto 0); + XOUT : out unsigned(4 downto 0) + ); +end entity; + +architecture behavior of MatchEnt is + constant K17 : unsigned(4 downto 0) := to_unsigned(17, 5); + constant K21 : unsigned(4 downto 0) := to_unsigned(21, 5); + constant K34 : unsigned(4 downto 0) := to_unsigned(34, 5); +begin + tester : process (A, B) + begin + case A is + when K17 => + XOUT <= A + 1; + when K21 => + XOUT <= A + B; + when K34 => + XOUT <= A - B; + when others => + XOUT <= resize(A * B, 5); + end case; + end process; +end architecture; diff --git a/testsuite/gna/issue2368/testsuite.sh b/testsuite/gna/issue2368/testsuite.sh new file mode 100755 index 000000000..4b42e420a --- /dev/null +++ b/testsuite/gna/issue2368/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze matchent1.vhdl +analyze matchent2.vhdl + +clean + +echo "Test successful" |