aboutsummaryrefslogtreecommitdiff
path: root/basys3/basys3.srcs/ppu_tb.vhd.m4
blob: 97f0aef6c4adc53890b2cda1063b37ce2627d45f (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
45
46
47
48
49
50
51
52
53
54
55
-- vim: ft=vhdl
library ieee;
library unisim;
use ieee.std_logic_1164.all;
use work.ppu_consts.all;
use unisim.vcomponents.all;

entity ppu_tb is
end ppu_tb;

architecture behavioral of ppu_tb is
	component ppu port(
		CLK100 : in std_logic; -- system clock
		RESET : in std_logic; -- global (async) system reset
		WEN : in std_logic; -- PPU VRAM write enable
		ADDR : in std_logic_vector(PPU_RAM_BUS_ADDR_WIDTH-1 downto 0); -- PPU VRAM ADDR
		DATA : in std_logic_vector(PPU_RAM_BUS_DATA_WIDTH-1 downto 0);
		R,G,B : out std_logic_vector(PPU_COLOR_OUTPUT_DEPTH-1 downto 0);
		VSYNC, HSYNC : out std_logic; -- VGA sync out
		VBLANK : out std_logic); -- vblank for synchronization
	end component;
	signal CLK100, RESET, WEN : std_logic := '0';
	signal ADDR : std_logic_vector(PPU_RAM_BUS_ADDR_WIDTH-1 downto 0);
	signal DATA : std_logic_vector(PPU_RAM_BUS_DATA_WIDTH-1 downto 0);
begin
	uut : ppu port map (
		CLK100 => CLK100,
		RESET => RESET,
		WEN => WEN,
		ADDR => ADDR,
		DATA => DATA,
		R => open,
		G => open,
		B => open,
		VSYNC => open,
		HSYNC => open,
		VBLANK => open);

	process
	begin
		for i in 0 to 3200000 loop
			wait for 5 ns;
			CLK100 <= '1';
			wait for 5 ns;
			CLK100 <= '0';
		end loop;
		wait; -- stop for simulator
	end process;
	
	process
	begin
		-- undivert(`test-image-ppu.tb.vhd') -- m4 macro expansion (see makefile)
		wait; -- stop after one loop (process loops in simulator)
	end process;
end Behavioral;