aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1258
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-24 06:40:20 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-24 06:40:20 +0200
commitd4a2d7c5d2975c388e75fd3d70172c6a59eff8f1 (patch)
treefe6b14f316a40725e013c4713549d67a0428cfb8 /testsuite/synth/issue1258
parentfc1f68e9df9fb41e3c9d279366b8b95f5c8cc9ca (diff)
downloadghdl-d4a2d7c5d2975c388e75fd3d70172c6a59eff8f1.tar.gz
ghdl-d4a2d7c5d2975c388e75fd3d70172c6a59eff8f1.tar.bz2
ghdl-d4a2d7c5d2975c388e75fd3d70172c6a59eff8f1.zip
testsuite/synth: add a test for #1258
Diffstat (limited to 'testsuite/synth/issue1258')
-rw-r--r--testsuite/synth/issue1258/ent.vhdl28
-rw-r--r--testsuite/synth/issue1258/tb_ent.vhdl45
-rwxr-xr-xtestsuite/synth/issue1258/testsuite.sh7
3 files changed, 80 insertions, 0 deletions
diff --git a/testsuite/synth/issue1258/ent.vhdl b/testsuite/synth/issue1258/ent.vhdl
new file mode 100644
index 000000000..045bec142
--- /dev/null
+++ b/testsuite/synth/issue1258/ent.vhdl
@@ -0,0 +1,28 @@
+-- count number of '1'.
+library ieee;
+use ieee.std_logic_1164.all;
+entity ent is
+ port (
+ sel : in std_ulogic;
+ din : in std_ulogic_vector(15 downto 0);
+ dout : out std_ulogic
+ );
+end;
+
+architecture rtl of ent is
+begin
+ comb : process (sel, din)
+ variable v : std_ulogic;
+ begin
+ v := '0';
+ if sel = '1' then
+ for i in din'range loop
+ if din(i) = '0' then
+ next;
+ end if;
+ v := not v;
+ end loop;
+ end if;
+ dout <= v;
+ end process;
+end;
diff --git a/testsuite/synth/issue1258/tb_ent.vhdl b/testsuite/synth/issue1258/tb_ent.vhdl
new file mode 100644
index 000000000..1d9a2db92
--- /dev/null
+++ b/testsuite/synth/issue1258/tb_ent.vhdl
@@ -0,0 +1,45 @@
+entity tb_ent is
+end tb_ent;
+
+library ieee;
+use ieee.std_logic_1164.all;
+
+architecture behav of tb_ent is
+ signal s : std_ulogic;
+ signal din : std_ulogic_vector(15 downto 0);
+ signal dout : std_ulogic;
+begin
+ dut: entity work.ent
+ port map (s, din, dout);
+
+ process
+ begin
+ s <= '1';
+ din <= x"00_00";
+ wait for 1 ns;
+ assert dout = '0' severity failure;
+
+ din <= x"04_00";
+ wait for 1 ns;
+ assert dout = '1' severity failure;
+
+ din <= x"10_40";
+ wait for 1 ns;
+ assert dout = '0' severity failure;
+
+ din <= x"80_01";
+ wait for 1 ns;
+ assert dout = '0' severity failure;
+
+ din <= x"80_00";
+ wait for 1 ns;
+ assert dout = '1' severity failure;
+
+ s <= '0';
+ din <= x"80_00";
+ wait for 1 ns;
+ assert dout = '0' severity failure;
+
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/synth/issue1258/testsuite.sh b/testsuite/synth/issue1258/testsuite.sh
new file mode 100755
index 000000000..5c1da263d
--- /dev/null
+++ b/testsuite/synth/issue1258/testsuite.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+synth_tb ent
+
+echo "Test successful"