]> jspc29.x-matter.uni-frankfurt.de Git - padiwa.git/commitdiff
added timer.vhd
authorIngo Froehlich <ingo@nomail.fake>
Thu, 12 Jul 2018 16:09:44 +0000 (18:09 +0200)
committerIngo Froehlich <ingo@nomail.fake>
Thu, 12 Jul 2018 16:09:44 +0000 (18:09 +0200)
source/timer.vhd [new file with mode: 0644]

diff --git a/source/timer.vhd b/source/timer.vhd
new file mode 100644 (file)
index 0000000..456e681
--- /dev/null
@@ -0,0 +1,31 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.std_logic_unsigned.all;
+
+entity timer is
+  port (
+    clk    :in  std_logic; -- Input clock
+    reset  :out std_logic  -- Output of the counter
+    );
+end timer;
+
+architecture rtl of timer is
+  signal count :   std_logic_vector (26 downto 0);
+  signal temporal: STD_LOGIC;
+begin
+  process (clk) begin
+                  
+  if (rising_edge(clk)) then
+    count <= count + 1;
+    if (count(26)='1') then
+      temporal <= NOT(temporal);
+      count<=(others=>'0');
+    end if;
+  end if;
+                 
+  end process;
+  reset <= temporal;
+  
+end rtl;