-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathblinky_cora_z7.vhd
More file actions
80 lines (69 loc) · 2.33 KB
/
blinky_cora_z7.vhd
File metadata and controls
80 lines (69 loc) · 2.33 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
------------------------------------------------------------------------------
-- File: blinky_cora_z7.vhd
-- Creation Date: 06-19-2022
------------------------------------------------------------------------------
-- Description:
-- Simple blinky for Digilent Cora-Z7 development boards.
------------------------------------------------------------------------------
-- Revisions:
-- 06-19-2022, cth
-- Initial creation of file.
------------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Entity.
----------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity blinky_cora_z7_top is
generic(
CLK_FREQ_HZ : natural := 125000000
);
port(
-- Reset and clock
Reset_i : in std_logic;
Clk_i : in std_logic;
-- Signals
Led0_o : out std_logic;
Led1_o : out std_logic
);
end entity blinky_cora_z7_top;
----------------------------------------------------------------------------
-- Architecture.
----------------------------------------------------------------------------
architecture rtl of blinky_cora_z7_top is
-- Reset (active low)
signal Reset_n_s : std_logic;
-- Counter register (up to ~134.2 MHz clock)
signal Counter_s : unsigned(26 downto 0);
-- LED blink pulse
signal Pulse_s : std_logic;
begin
-- Reset (active low)
Reset_n_s <= not Reset_i;
-- Counter unit
Counter_proc : process(Reset_n_s, Clk_i)
begin
if (Reset_n_s = '0') then
-- Reset (sync)
Counter_s <= (others => '0');
Pulse_s <= '0';
elsif (rising_edge(Clk_i)) then
if (Counter_s < CLK_FREQ_HZ) then
-- Increment
Counter_s <= Counter_s + 1;
else
-- Reset
Counter_s <= (others => '0');
end if;
if (Counter_s = 0) then
-- Toggle on counter reset
Pulse_s <= not Pulse_s;
end if;
end if;
end process; -- Counter_proc
-- LED 0 pulse
Led0_o <= Reset_n_s and Pulse_s;
-- LED 1 pulse
Led1_o <= Reset_n_s and (not Pulse_s);
end rtl;