-
Notifications
You must be signed in to change notification settings - Fork 2
/
ball_out_handler.vhd
47 lines (39 loc) · 1.02 KB
/
ball_out_handler.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ball_out_handler is
Port ( ball_out : in bit;
rgb_in : in STD_LOGIC_VECTOR (2 downto 0);
rgb_out: out STD_LOGIC_VECTOR (2 downto 0);
clk25 : in bit);
end ball_out_handler;
architecture Behavioral of ball_out_handler is
component inverter
Port (
inverse : in bit;
rgb_in : in STD_LOGIC_VECTOR (2 downto 0);
rgb_out: out STD_LOGIC_VECTOR (2 downto 0)
);
end component;
signal count_up : integer range 0 to 10250000 := 0;
signal ball_out_inverse : bit;
begin
process (clk25, rgb_in) --for ball_out
begin
if clk25'event and clk25 = '1' then
if ball_out = '1' then
ball_out_inverse <= '1';
end if;
count_up <= count_up + 1;
if count_up = 10250000 then
ball_out_inverse <= '0';
count_up <= 0;
end if;
end if;
end process;
inverse : inverter port map (
inverse => ball_out_inverse,
rgb_in => rgb_in,
rgb_out => rgb_out);
end Behavioral;