aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-29 08:38:14 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-29 08:38:14 +0100
commitda2aeae6aad9977218a17013cdd38577aebaeb3d (patch)
tree95b3257dc69493c41e8c04b37c39eeba52ded406 /testsuite
parente6ebb298fcb465f062099c0d10db1d828a339355 (diff)
downloadghdl-da2aeae6aad9977218a17013cdd38577aebaeb3d.tar.gz
ghdl-da2aeae6aad9977218a17013cdd38577aebaeb3d.tar.bz2
ghdl-da2aeae6aad9977218a17013cdd38577aebaeb3d.zip
testsuite/gna: add tests for #2328
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/synth/issue2328/tb_test_tf.vhdl67
-rw-r--r--testsuite/synth/issue2328/test.vhdl9
-rw-r--r--testsuite/synth/issue2328/test_tf.vhdl20
-rwxr-xr-xtestsuite/synth/issue2328/testsuite.sh11
4 files changed, 107 insertions, 0 deletions
diff --git a/testsuite/synth/issue2328/tb_test_tf.vhdl b/testsuite/synth/issue2328/tb_test_tf.vhdl
new file mode 100644
index 000000000..dd57cc58c
--- /dev/null
+++ b/testsuite/synth/issue2328/tb_test_tf.vhdl
@@ -0,0 +1,67 @@
+entity tb_test_tf is
+end tb_test_tf;
+
+architecture behav of tb_test_tf is
+ signal a : bit_vector(3 downto 0);
+ signal red_and : bit;
+ signal red_nand : bit;
+ signal red_or : bit;
+ signal red_nor : bit;
+ signal red_xor : bit;
+ signal red_xnor : bit;
+begin
+ dut: entity work.test_tf
+ port map (
+ a => a,
+ red_and => red_and,
+ red_nand => red_nand,
+ red_or => red_or,
+ red_nor => red_nor,
+ red_xor => red_xor,
+ red_xnor => red_xnor);
+ process
+ begin
+ a <= b"0101";
+ wait for 1 ns;
+
+ assert red_and = '0' severity error;
+ assert red_nand = '1' severity error;
+ assert red_or = '1' severity error;
+ assert red_nor = '0' severity error;
+ assert red_xor = '0' severity error;
+ assert red_xnor = '1' severity error;
+
+ a <= b"1111";
+ wait for 1 ns;
+
+ assert red_and = '1' severity error;
+ assert red_nand = '0' severity error;
+ assert red_or = '1' severity error;
+ assert red_nor = '0' severity error;
+ assert red_xor = '0' severity error;
+ assert red_xnor = '1' severity error;
+
+ a <= b"0000";
+ wait for 1 ns;
+
+ assert red_and = '0' severity error;
+ assert red_nand = '1' severity error;
+ assert red_or = '0' severity error;
+ assert red_nor = '1' severity error;
+ assert red_xor = '0' severity error;
+ assert red_xnor = '1' severity error;
+
+ a <= b"0001";
+ wait for 1 ns;
+
+ assert red_and = '0' severity error;
+ assert red_nand = '1' severity error;
+ assert red_or = '1' severity error;
+ assert red_nor = '0' severity error;
+ assert red_xor = '1' severity error;
+ assert red_xnor = '0' severity error;
+
+ report "done";
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/synth/issue2328/test.vhdl b/testsuite/synth/issue2328/test.vhdl
new file mode 100644
index 000000000..520e2d22f
--- /dev/null
+++ b/testsuite/synth/issue2328/test.vhdl
@@ -0,0 +1,9 @@
+entity test is
+end test;
+
+architecture behavior of test is
+signal a: bit_vector(3 downto 0);
+signal b: bit;
+begin
+ b <= and a;
+end behavior;
diff --git a/testsuite/synth/issue2328/test_tf.vhdl b/testsuite/synth/issue2328/test_tf.vhdl
new file mode 100644
index 000000000..dbf9f81ef
--- /dev/null
+++ b/testsuite/synth/issue2328/test_tf.vhdl
@@ -0,0 +1,20 @@
+entity test_tf is
+ port(
+ a: in bit_vector(3 downto 0);
+ red_and: out bit;
+ red_nand: out bit;
+ red_or: out bit;
+ red_nor: out bit;
+ red_xor: out bit;
+ red_xnor: out bit);
+end test_tf;
+
+architecture behavior of test_tf is
+begin
+ red_and <= and a;
+ red_nand <= nand a;
+ red_or <= or a;
+ red_nor <= nor a;
+ red_xor <= xor a;
+ red_xnor <= xnor a;
+end behavior;
diff --git a/testsuite/synth/issue2328/testsuite.sh b/testsuite/synth/issue2328/testsuite.sh
new file mode 100755
index 000000000..bd691904a
--- /dev/null
+++ b/testsuite/synth/issue2328/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+GHDL_STD_FLAGS=--std=08
+
+synth_only test
+
+synth_tb test_tf
+
+echo "Test successful"