From da2aeae6aad9977218a17013cdd38577aebaeb3d Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 29 Jan 2023 08:38:14 +0100 Subject: testsuite/gna: add tests for #2328 --- testsuite/synth/issue2328/tb_test_tf.vhdl | 67 +++++++++++++++++++++++++++++++ testsuite/synth/issue2328/test.vhdl | 9 +++++ testsuite/synth/issue2328/test_tf.vhdl | 20 +++++++++ testsuite/synth/issue2328/testsuite.sh | 11 +++++ 4 files changed, 107 insertions(+) create mode 100644 testsuite/synth/issue2328/tb_test_tf.vhdl create mode 100644 testsuite/synth/issue2328/test.vhdl create mode 100644 testsuite/synth/issue2328/test_tf.vhdl create mode 100755 testsuite/synth/issue2328/testsuite.sh (limited to 'testsuite/synth') 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" -- cgit v1.2.3