aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-11-11 05:06:51 +0100
committerTristan Gingold <tgingold@free.fr>2021-11-11 05:06:51 +0100
commitbb5e89e7f96669c94f2816599c56390a23b123d2 (patch)
treeed3d607d2d16dbf7fbc959216f2b06347986e0f7 /testsuite
parentea5b2080161b28544b32797f2a21afca64d2f185 (diff)
downloadghdl-bb5e89e7f96669c94f2816599c56390a23b123d2.tar.gz
ghdl-bb5e89e7f96669c94f2816599c56390a23b123d2.tar.bz2
ghdl-bb5e89e7f96669c94f2816599c56390a23b123d2.zip
testsuite/synth: add a test for #1909
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/synth/issue1909/reproducebug.vhdl27
-rw-r--r--testsuite/synth/issue1909/tb_reproducebug.vhdl31
-rwxr-xr-xtestsuite/synth/issue1909/testsuite.sh9
3 files changed, 67 insertions, 0 deletions
diff --git a/testsuite/synth/issue1909/reproducebug.vhdl b/testsuite/synth/issue1909/reproducebug.vhdl
new file mode 100644
index 000000000..60655b0eb
--- /dev/null
+++ b/testsuite/synth/issue1909/reproducebug.vhdl
@@ -0,0 +1,27 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+entity ReproduceBug is
+ port(
+ clk : in std_logic;
+ input : in unsigned(7 downto 0);
+ output : out unsigned(7 downto 0)
+ );
+end ReproduceBug;
+
+architecture rtl of ReproduceBug is
+ -- only to get rid of "latch inferrence" warning
+ -- signal outputLcl : unsigned(7 downto 0) := (others => '0');
+begin
+
+ Main: process(clk)
+ begin
+ if rising_edge(Clk) then
+ output <= input ror 1; -- can also be 'rol'
+ end if;
+ end process;
+
+-- output <= outputLcl;
+
+end rtl;
diff --git a/testsuite/synth/issue1909/tb_reproducebug.vhdl b/testsuite/synth/issue1909/tb_reproducebug.vhdl
new file mode 100644
index 000000000..8ebbcdc4a
--- /dev/null
+++ b/testsuite/synth/issue1909/tb_reproducebug.vhdl
@@ -0,0 +1,31 @@
+entity tb_reproducebug is
+end tb_reproducebug;
+
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+architecture behav of tb_reproducebug is
+ signal clk : std_logic;
+ signal input : unsigned(7 downto 0);
+ signal output : unsigned(7 downto 0);
+begin
+ dut: entity work.reproducebug
+ port map (clk, input, output);
+
+ process
+ procedure pulse is
+ begin
+ clk <= '0';
+ wait for 1 ns;
+ clk <= '1';
+ wait for 1 ns;
+ end;
+ begin
+ input <= x"14";
+ pulse;
+ assert output = x"0a" severity failure;
+
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/synth/issue1909/testsuite.sh b/testsuite/synth/issue1909/testsuite.sh
new file mode 100755
index 000000000..89e0ae98a
--- /dev/null
+++ b/testsuite/synth/issue1909/testsuite.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+for t in reproducebug; do
+ synth_tb $t
+done
+
+echo "Test successful"