aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-26 22:02:34 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-26 22:02:34 +0200
commit3c1f8dc37a554bc5a5d087a6ae8253dc6021c9ed (patch)
tree929e637de2ab37b3696a64a6177a8655e0038974 /testsuite/synth
parenta123be70f01c43cdafd698d61eca1913db478d24 (diff)
downloadghdl-3c1f8dc37a554bc5a5d087a6ae8253dc6021c9ed.tar.gz
ghdl-3c1f8dc37a554bc5a5d087a6ae8253dc6021c9ed.tar.bz2
ghdl-3c1f8dc37a554bc5a5d087a6ae8253dc6021c9ed.zip
testsuite/synth: add a test for #2140
Diffstat (limited to 'testsuite/synth')
-rw-r--r--testsuite/synth/issue2140/bug.vhdl68
-rwxr-xr-xtestsuite/synth/issue2140/testsuite.sh9
2 files changed, 77 insertions, 0 deletions
diff --git a/testsuite/synth/issue2140/bug.vhdl b/testsuite/synth/issue2140/bug.vhdl
new file mode 100644
index 000000000..bfb18a550
--- /dev/null
+++ b/testsuite/synth/issue2140/bug.vhdl
@@ -0,0 +1,68 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity sub is
+ port (
+ clk : in std_ulogic;
+ reset_n : in std_ulogic;
+
+ src_valid : in std_ulogic;
+ src_ready : out std_ulogic
+ );
+end sub;
+
+architecture rtl of sub is
+begin
+end architecture;
+
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity bug is
+ port(
+ clk : in std_ulogic;
+ reset_n : in std_ulogic
+ );
+end bug;
+
+architecture struct of bug is
+ signal filtered_src_valid : std_ulogic;
+ signal filtered_src_ready : std_ulogic;
+
+ signal pipeline_src_valid : std_ulogic;
+ signal pipeline_src_ready : std_ulogic;
+
+ type state_t is (idle, active);
+ signal state : state_t;
+begin
+
+pipeline_src_valid <= filtered_src_valid when (state = idle) or (state = active) else '0';
+
+process(clk, reset_n)
+begin
+ if reset_n = '0' then
+ elsif rising_edge(clk) then
+ if state = idle then
+ if filtered_src_valid = '1' and filtered_src_ready = '1' then
+ state <= active;
+ end if;
+ elsif state = active then
+ if pipeline_src_valid = '1' and pipeline_src_ready = '1' then
+ state <= idle;
+ end if;
+ end if;
+ end if;
+end process;
+
+pipeline : entity work.sub
+ port map(
+ clk => clk,
+ reset_n => reset_n,
+
+ src_valid => pipeline_src_valid,
+ src_ready => pipeline_src_ready
+ );
+
+end architecture;
diff --git a/testsuite/synth/issue2140/testsuite.sh b/testsuite/synth/issue2140/testsuite.sh
new file mode 100755
index 000000000..2be3b2f1a
--- /dev/null
+++ b/testsuite/synth/issue2140/testsuite.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+synth_analyze bug
+
+clean
+
+echo "Test successful"