aboutsummaryrefslogtreecommitdiff
path: root/src/cntm13.vhd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cntm13.vhd')
-rw-r--r--src/cntm13.vhd8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cntm13.vhd b/src/cntm13.vhd
index 9da61d4..3a8bfa9 100644
--- a/src/cntm13.vhd
+++ b/src/cntm13.vhd
@@ -12,7 +12,13 @@ entity cntm13 is
end entity;
architecture rtl of cntm13 is
+ signal cnt, ncnt : unsigned(3 downto 0);
begin
-
+ cnt <= to_unsigned(0,cnt'length) when rst_n = '0' else ncnt when en_i = '1' and rising_edge(clk);
+ ncnt <= to_unsigned(0,cnt'length) when up_i = '1' and cnt = 12 else
+ to_unsigned(12,cnt'length) when up_i = '0' and cnt = 0 else
+ cnt + 1 when up_i = '1' else
+ cnt - 1;
+cnt_o <= std_ulogic_vector(cnt);
end architecture rtl;