-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathVGA_tb.vhd
71 lines (58 loc) · 1.27 KB
/
VGA_tb.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
69
70
71
library std;
use std.env.stop;
library ieee;
context ieee.ieee_std_context;
use work.VGA_config.all;
entity tb_vga is
generic (
SCREEN : natural := 22
);
end entity;
architecture arch of tb_vga is
constant clk_period : time := (1.0/real(VGA_configs(SCREEN).clk)) * 1 ms;
signal clk, rst, save_video: std_logic := '0';
type vga_t is record
hsync: std_logic;
vsync: std_logic;
rgb: std_logic_vector(2 downto 0);
end record;
signal vga: vga_t;
begin
clk <= not clk after clk_period/2;
proc_main: process
begin
report "start simulation" severity note;
rst <= '1';
wait for 10*clk_period;
rst <= '0';
wait for 100 ms;
report "end simulation" severity note;
save_video <= '1';
wait for 200 ns;
stop(0);
wait;
end process;
VIRT_VGA: entity work.VGA_screen
generic map (
G_SCREEN => SCREEN
)
port map (
RST => rst,
HSYNC => vga.hsync,
VSYNC => vga.vsync,
RGB => vga.rgb,
VID => save_video
);
UUT: entity work.Design_Top(demo)
generic map (
G_SCREEN => SCREEN
)
port map (
CLK => clk,
EN => '1',
RST => rst,
HSYNC => vga.hsync,
VSYNC => vga.vsync,
RGB => vga.rgb
);
end architecture;