-
Notifications
You must be signed in to change notification settings - Fork 0
/
vga_simple_test.vhd
59 lines (52 loc) · 1.38 KB
/
vga_simple_test.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
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.vga_util.all;
entity vga_simple_test is
port (
clk: in std_logic;
vga_r: out std_logic_vector(3 downto 0);
vga_g: out std_logic_vector(3 downto 0);
vga_b: out std_logic_vector(3 downto 0);
vga_hs: out std_logic;
vga_vs: out std_logic
);
end entity;
architecture rtl of vga_simple_test is
signal pixel_clk: std_logic;
signal hstate: vga_hstate;
signal vstate: vga_vstate;
begin
pixel_clock: vga_pixel_clock
port map (
clk => clk,
pixel_clk => pixel_clk
);
sync_ctrl: vga_sync_ctrl
generic map (
mode => (width => 640, height => 480, refresh_rate => 60)
) port map (
clk => pixel_clk,
en => '1',
reset => '0',
hsync => vga_hs,
vsync => vga_vs,
htimer => open,
vtimer => open,
hstate => hstate,
vstate => vstate
);
emit_pixel: process (hstate, vstate)
begin
if hstate = HActiveVideo and vstate = VActiveVideo then
vga_r <= (others => '1');
vga_g <= (others => '1');
vga_b <= (others => '1');
else
vga_r <= (others => '0');
vga_g <= (others => '0');
vga_b <= (others => '0');
end if;
end process;
end architecture;