aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-03-29 21:24:32 +0200
committerTristan Gingold <tgingold@free.fr>2021-03-29 21:25:08 +0200
commitef9cb64c5d334a3f0060d8245c8b77fb7daad62d (patch)
tree9fb288f79cd7f4bd7c91828f86031563817b31ac
parentfb5bbea118c7cfa6d5793c8d463ffc4448d3a84f (diff)
downloadghdl-ef9cb64c5d334a3f0060d8245c8b77fb7daad62d.tar.gz
ghdl-ef9cb64c5d334a3f0060d8245c8b77fb7daad62d.tar.bz2
ghdl-ef9cb64c5d334a3f0060d8245c8b77fb7daad62d.zip
testsuite/synth: add a test for #1703
-rw-r--r--testsuite/synth/issue1703/blinker.vhdl30
-rwxr-xr-xtestsuite/synth/issue1703/testsuite.sh14
2 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/synth/issue1703/blinker.vhdl b/testsuite/synth/issue1703/blinker.vhdl
new file mode 100644
index 000000000..4c96099e9
--- /dev/null
+++ b/testsuite/synth/issue1703/blinker.vhdl
@@ -0,0 +1,30 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity Blinker is
+ port(
+ clk_i : in std_logic;
+ rst_i : in std_logic;
+ led_o : out std_logic
+ );
+end Blinker;
+
+architecture RTL of Blinker is
+ constant N : natural := 25e6;
+ signal count_reg : natural range 0 to N - 1;
+begin
+ process(rst_i, clk_i)
+ begin
+ if rst_i = '1' then
+ count_reg <= 0;
+ elsif rising_edge(clk_i) then
+ if count_reg = N - 1 then
+ count_reg <= 0;
+ else
+ count_reg <= count_reg + 1;
+ end if;
+ end if;
+ end process;
+
+ led_o <= '1' when count_reg < N / 2 else '0';
+end RTL;
diff --git a/testsuite/synth/issue1703/testsuite.sh b/testsuite/synth/issue1703/testsuite.sh
new file mode 100755
index 000000000..082777db5
--- /dev/null
+++ b/testsuite/synth/issue1703/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+synth_analyze blinker
+count=$(grep -c _edge syn_blinker.vhdl)
+if [ $count -ne 1 ]; then
+ echo "edge gate present"
+ exit 1
+fi
+
+clean
+
+echo "Test successful"