-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclocks.vhd
69 lines (57 loc) · 1.15 KB
/
clocks.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
-------------------Slow clock----------------
library ieee;
use ieee.std_logic_1164.all;
entity sclock is
port (
clk: in std_logic;
sclk: out std_logic;
led: out std_logic
) ;
end entity ; -- sclock
architecture behaviour of sclock is
signal count, ncount: integer:= 0;
constant lim: integer:= 750000000; --period=5s
begin
process(clk) is
begin
count <= ncount;
if(clk'event and clk='1') then
ncount <= count + 1; --increment counter.
end if;
if(count = lim) then
ncount <= 0;
sclk <='1';
led <= '1';
else
sclk <='0';
led <= '0';
end if;
end process;
end architecture ;
-------------------Super slow clock----------------
library ieee;
use ieee.std_logic_1164.all;
entity ssclock is
port (
clk: in std_logic;
ssclk: out std_logic
) ;
end entity ; -- ssclock
architecture behaviour of ssclock is
signal count, ncount: integer:= 0;
constant lim: integer:= 75;--0000000; --period=5s
begin
process(clk) is
begin
count <= ncount;
if(clk'event and clk='1') then
ncount <= count + 1; --increment counter.
end if;
if(count = lim) then
ncount <= 0;
ssclk <='1';
else
ssclk <='0';
end if;
end process;
end architecture;