blob: 0fa229f2f9847f5b081a0ee5f1c6df433a0d314f (
plain)
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
|
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity pixeldata is
port (
pixel_clk, bounce_clk, reset: in std_logic;
x, y: in std_logic_vector(9 downto 0);
red, green, blue: out std_logic);
end pixeldata;
architecture Behavioral of pixeldata is
component bounce
port (
clk, reset: in std_logic;
x, y: out std_logic_vector(9 downto 0));
end component;
signal sx, sy: std_logic_vector(9 downto 0); -- square x and y
begin
bounce_pos: component bounce
port map (
reset => reset,
clk => bounce_clk,
x => sx,
y => sy);
process(pixel_clk, sx, sy)
begin
if rising_edge(pixel_clk) then
if (x >= sx) and (x < sx + 10) and (y >= sy) and (y < sy + 10) then
-- draw 10x10 pixel box in white
red <= '1';
green <= '1';
blue <= '1';
else
-- blue background
red <= '0';
green <= '0';
blue <= '1';
end if;
end if;
end process;
end Behavioral;
|