aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue1843/counter.vhdl
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna/issue1843/counter.vhdl')
-rw-r--r--testsuite/gna/issue1843/counter.vhdl28
1 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/gna/issue1843/counter.vhdl b/testsuite/gna/issue1843/counter.vhdl
new file mode 100644
index 000000000..1effc4b68
--- /dev/null
+++ b/testsuite/gna/issue1843/counter.vhdl
@@ -0,0 +1,28 @@
+LIBRARY ieee;
+USE ieee.std_logic_1164.ALL;
+USE ieee.numeric_std.ALL;
+
+ENTITY counter IS
+ GENERIC(
+ WIDTH : positive := 32
+ );
+ PORT(
+ clk : IN std_logic
+ );
+END ENTITY counter;
+
+ARCHITECTURE rtl OF counter IS
+ CONSTANT UPPER_LIMIT : unsigned((WIDTH-1) DOWNTO 0) := (OTHERS => '1');
+ SIGNAL count : unsigned((WIDTH-1) DOWNTO 0);
+BEGIN
+
+ p_counter : PROCESS (clk)
+ BEGIN
+ IF (rising_edge(clk)) THEN
+ IF ((('0', count) + 1) < UPPER_LIMIT) THEN
+ count <= count + 1;
+ END IF;
+ END IF;
+ END PROCESS;
+
+END ARCHITECTURE rtl;