OpenCores
URL https://opencores.org/ocsvn/simpletousesha2/simpletousesha2/trunk

Subversion Repositories simpletousesha2

[/] [simpletousesha2/] [trunk/] [src/] [stepCount.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 shadow7853
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
library work;
5
use work.shaPkg.all;
6
 
7
entity stepCount is
8
        port (
9
                cnt             : out integer range 0 to STMAX-1;
10
                clk             : in std_logic;
11
                rst             : in std_logic
12
        );
13
end stepCount;
14
 
15
architecture phy of stepCount is
16
begin
17
        process (clk)
18
                variable c : integer range 0 to STMAX-1;
19
        begin
20
                if (rising_edge(clk)) then
21
                        if rst = '1' or c = STMAX-1 then
22
                                c := 0;
23
                        else
24
                                c := c + 1;
25
                        end if;
26
                end if;
27
 
28
                -- Output the current count
29
                cnt <= c;
30
        end process;
31
 
32
end phy;
33
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.