File tree Expand file tree Collapse file tree 4 files changed +40
-80
lines changed Expand file tree Collapse file tree 4 files changed +40
-80
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,23 +3,23 @@ use ieee.std_logic_1164.all;
33use ieee.numeric_std.all ;
44
55entity vga is
6- port (
7- clk : in std_logic ; -- Pixel clock
8- rst : in std_logic ;
9-
10- hsync : out std_logic ;
11- vsync : out std_logic ;
12-
13- -- Input colors
14- i_red : in std_logic_vector (1 downto 0 );
15- i_blue : in std_logic_vector (1 downto 0 );
16- i_green : in std_logic_vector (1 downto 0 );
17-
18- -- Output colors
19- -- 4 x 4 x 4 yields 64 different colors
20- o_red : out std_logic_vector (1 downto 0 );
21- o_blue : out std_logic_vector (1 downto 0 );
22- o_green : out std_logic_vector (1 downto 0 )
6+ port (
7+ clk : in std_logic ;
8+ rst : in std_logic ;
9+
10+ hsync : out std_logic ;
11+ vsync : out std_logic ;
12+
13+ -- Input colors
14+ i_red : in std_logic_vector (1 downto 0 );
15+ i_blue : in std_logic_vector (1 downto 0 );
16+ i_green : in std_logic_vector (1 downto 0 );
17+
18+ -- Output colors
19+ -- 4 x 4 x 4 yields 64 different colors
20+ o_red : out std_logic_vector (1 downto 0 );
21+ o_blue : out std_logic_vector (1 downto 0 );
22+ o_green : out std_logic_vector (1 downto 0 )
2323 );
2424end entity vga;
2525
@@ -69,13 +69,13 @@ architecture RTL of vga is
6969
7070begin
7171
72- process (clk)
72+ process (clk)
7373
7474 variable wrapped : boolean ;
7575
7676 begin
7777
78- if rising_edge (clk) then
78+ if rising_edge (clk) then
7979
8080 if rst= '1' then
8181
@@ -118,7 +118,7 @@ begin
118118
119119 end if ;
120120
121- end if ;
121+ end if ;
122122
123- end process ;
123+ end process ;
124124end architecture RTL;
Original file line number Diff line number Diff line change @@ -10,21 +10,24 @@ architecture rtl of vga_tb is
1010 -- Clock
1111 constant CLOCK_SPEED : natural := 65e6 ;
1212 constant CLOCK_PERIOD : time := 1.0 sec / CLOCK_SPEED;
13- constant DUTY_CYCLE : real := 0.5 ;
13+ constant CLOCK_DUTY : real := 0.5 ;
14+ constant CLOCK_PHASE : real := 0.0 / 360.0 ;
15+
16+ constant RESET_PERIOD : time := 10 us ;
1417
1518 signal clk : std_logic := '0' ;
1619 signal rst : std_logic := '0' ;
1720
1821 signal hsync, vsync : std_logic ;
1922
20- signal o_red, o_blue, o_green : std_logic_vector (2 downto 0 );
23+ signal o_red, o_blue, o_green : std_logic_vector (1 downto 0 );
2124
2225begin
2326
2427 vga1 : entity work.vga
2528 port map (
26- clk => clk, -- Pixel clock
27- rst => rst,
29+ clk => clk,
30+ rst => rst,
2831
2932 hsync => hsync,
3033 vsync => vsync,
4144 o_green => o_green
4245 );
4346
44-
45- clk <= not clk after CLOCK_PERIOD / 2 ;
47+ clk_gen : process
48+ begin
49+ clk <= transport '1' after (CLOCK_PERIOD * CLOCK_PHASE);
50+ clk <= transport '0' after (CLOCK_PERIOD * (CLOCK_DUTY + CLOCK_PHASE));
51+ wait for CLOCK_PERIOD;
52+ end process ;
53+
54+ reset : process
55+ begin
56+ rst <= '1' , '0' after RESET_PERIOD;
57+ wait ;
58+ end process ;
4659
4760 end architecture rtl;
4861
You can’t perform that action at this time.
0 commit comments