aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1180
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-01 07:57:02 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-01 07:57:02 +0200
commitfb2b12d8f190660e9c4f583f9aa50bcf73838a81 (patch)
treedbcb46c1c4b7e9ffe91f9d325e8143276153ebfd /testsuite/synth/issue1180
parent9261f29da57957855eefd5b202504b5afc5dbdd3 (diff)
downloadghdl-fb2b12d8f190660e9c4f583f9aa50bcf73838a81.tar.gz
ghdl-fb2b12d8f190660e9c4f583f9aa50bcf73838a81.tar.bz2
ghdl-fb2b12d8f190660e9c4f583f9aa50bcf73838a81.zip
testsuite/synth: add test for #1180
Diffstat (limited to 'testsuite/synth/issue1180')
-rw-r--r--testsuite/synth/issue1180/bug.vhdl33
-rwxr-xr-xtestsuite/synth/issue1180/testsuite.sh8
2 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/synth/issue1180/bug.vhdl b/testsuite/synth/issue1180/bug.vhdl
new file mode 100644
index 000000000..6269ae385
--- /dev/null
+++ b/testsuite/synth/issue1180/bug.vhdl
@@ -0,0 +1,33 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity bug is
+ generic(
+ C_HIGH : natural := 5
+ );
+ port(
+ reset_n : in std_ulogic;
+ clk : in std_ulogic;
+ res : out natural
+ );
+end bug;
+
+architecture behav of bug is
+ subtype st is natural range 0 to C_HIGH;
+ signal c : st;
+begin
+ process(clk, reset_n)
+ begin
+ if reset_n = '0' then
+ c <= st'low;
+ elsif rising_edge(clk) then
+ if c = st'high then
+ c <= st'low;
+ else
+ c <= c + 1;
+ end if;
+ end if;
+ end process;
+ res <= c;
+end architecture;
diff --git a/testsuite/synth/issue1180/testsuite.sh b/testsuite/synth/issue1180/testsuite.sh
new file mode 100755
index 000000000..121ca9a6a
--- /dev/null
+++ b/testsuite/synth/issue1180/testsuite.sh
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+synth_analyze bug
+clean
+
+echo "Test successful"