George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 1 VGA Synchronization ECE 448 Lecture 9.

Slides:



Advertisements
Similar presentations
Lecture #28 Page 1 ECE 4110– Sequential Logic Design Lecture #28 Agenda 1.Counters Announcements 1.HW #13 assigned 2.Next: Test #2 Review.
Advertisements

1 COMP541 Video Monitors Montek Singh Oct 1, 2014.
Arbitrary Waveform Discussion 5.5 Example 34.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Display Technology  Images stolen from various locations on the web...
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
VGA Port Discussion D9.1. Raster Scan Displays Electron beam CRT.
Algorithmic State Machine (ASM) Charts
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 448 Lecture 7 VGA Display Part 1
Introduction to VGA Wei Miao Yuxuan Zhou 1. 2 VGA VGA = Video Graphics Array Introduced by IBM in 1987, still using today All points addressable Transmitting.
Video Monitor Uses raster scanning to display images
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
ECE 448: Lab 6 VGA Display (mini chess game). Video Graphic Array (VGA) Resolution: 640x480 Display: 16 colors (4 bits), 256 colors (8 bits) Refresh Rate:
Introduction to Experiment 5 VGA Signal Generator ECE 448 Spring 2009.
ECE 448 Lecture 8 VGA Display Part 2
EE4OI4 Engineering Design UP1core Library Functions.
Introduction to VGA 數位電路實驗 TA: 吳柏辰 Author: Trumen.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
COMP541 Video Monitors Montek Singh Oct 2, 2015.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 2 Animation ECE 448 Lecture 9.
ENG241 Digital Design Week #8 Registers and Counters.
ECE FPGA Microprocessor Design Erik Lee, Edward Jones, Emily Kan.
ECE 448: Lab 4 VGA Display Mini-Pacman. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.
ECE 448: Lab 4 VGA Display. Bouncing Ball.. Organization and Grading.
ECE 448: Lab 5 VGA Display. Breaking-Bricks..
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
ECE 448: Lab 4 VGA Display The Frogger. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 3 Animation ECE 448 Lecture 11.
Data Flow Modeling in VHDL
CRT Display Technology
Algorithmic State Machines Sorting Signed & Unsigned Data Types
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 1 Synchronization & Pixel Generation ECE 448 Lecture 8.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
ECE 448: Lab 4 VGA Display Snake Game. Flexibility in the Second Part of the Semester Lab 4: VGA display (2 weeks) – 8 points Lab 5: Computer Graphics.
1 COMP541 Video Monitors Montek Singh Mar 11, 2016.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 3 Animation ECE 448 Lecture 11.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 5 The Complete Pong Game ECE 448 Lecture 13.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
COMP541 Video Monitors Montek Singh Oct 7, 2016.
COMP541 Video Monitors Montek Singh Sep 15, 2017.
VGA Display Part 1 VGA Synchronization
Describing Combinational Logic Using Processes
Registers and Counters
VGA Display Part 2 Pixel Generation
COMP541 Video Monitors Montek Singh Feb 20, 2015.
VGA Display Part 4 Text Generation
VGA Display Part 3 Animation
VGA Display Part 5 The Complete Pong Game
Sequential-Circuit Building Blocks
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
ECE 448 Lecture 13 Multipliers Timing Parameters
Introduction to VGA Digital Circuit Lab TA: Po-Chen Wu.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
Data Flow Description of Combinational-Circuit Building Blocks
COMP541 Video Monitors Montek Singh Feb 6, 2019.
Modeling of Circuits with a Regular Structure
Figure 8.1. The general form of a sequential circuit.
Data Flow Description of Combinational-Circuit Building Blocks
FPro Video Subsystem: VGA Frame Buffer Core
Modeling of Circuits with Regular Structure
VGA Display: VGA Synchronization & Pixel Generation
VGA Port CSE 678.
Sequntial-Circuit Building Blocks
(Sequential-Circuit Building Blocks)
Presentation transcript:

George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 1 VGA Synchronization ECE 448 Lecture 9

2ECE 448 – FPGA and ASIC Design with VHDL Required Reading P. Chu, FPGA Prototyping by VHDL Examples Chapter 12, VGA Controller I: Graphic Source Codes of Examples Nexys 3 Board Reference Manual VGA Port, pages 15-17

3ECE 448 – FPGA and ASIC Design with VHDL Basics

4 VGA – Video Graphics Array ECE 448 – FPGA and ASIC Design with VHDL Video display standard introduced in the late 1980’s Widely supported by PC graphics hardware and monitors Used initially with the CRT (cathode ray tube) monitors Later adopted for LCD (liquid-crystal display) monitors as well

5 VGA – Characteristic Features ECE 448 – FPGA and ASIC Design with VHDL Resolution: 640x480 Refresh Rate: 25Hz, 30Hz, 60Hz (frames / second) Display: up to 256 colors (8 bits) RGB: Red, Green and Blue analog signals

6ECE 448 – FPGA and ASIC Design with VHDL Operation of a CRT monitor

7 CRT Monitor – Conceptual Diagram ECE 448 – FPGA and ASIC Design with VHDL

8 CRT Monitor – Scanning Pattern ECE 448 – FPGA and ASIC Design with VHDL

9 CRT Monitor – Horizontal Scan ECE 448 – FPGA and ASIC Design with VHDL

10ECE 448 – FPGA and ASIC Design with VHDL VGA Controller

11 VGA Controller – Simplified View ECE 448 – FPGA and ASIC Design with VHDL

12 Three-bit VGA Color Combinations ECE 448 – FPGA and ASIC Design with VHDL

13ECE 448 – FPGA and ASIC Design with VHDL VGA Synchronization

14 Horizontal Synchronization ECE 448 – FPGA and ASIC Design with VHDL

15 Four regions of hsync ECE 448 – FPGA and ASIC Design with VHDL Display: , width = 640 Right border (front porch): , width = 16 Retrace (horizontal flyback): , width=96 Left border (back porch): , width=48

16 Vertical Synchronization ECE 448 – FPGA and ASIC Design with VHDL

17 Four regions of vsync ECE 448 – FPGA and ASIC Design with VHDL Display: , width = 480 lines Bottom border (front porch): , width = 10 Retrace (vertical flyback): , width=2 Top border (back porch): , width=33

18 Pixel Rate ECE 448 – FPGA and ASIC Design with VHDL p: the number of pixels in a horizontal scan line p = 800 pixels/line l: the number of horizontal lines in a screen l = 525 lines/screen s: the number of screens per second (refresh rate) s = 60 screens/second Pixel Rate = p  l  s = 25 Mpixels/second

19ECE 448 – FPGA and ASIC Design with VHDL VHDL Code of VGA Sync

20 Assumptions ECE 448 – FPGA and ASIC Design with VHDL 50 MHz clock => 2 clock cycles per pixel => p_tick generated every second clock period used as an enable for the horizontal counter

21 VHDL Code of VGA Sync (1) ECE 448 – FPGA and ASIC Design with VHDL library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity vga_sync is port( clk, reset: in std_logic; hsync, vsync: out std_logic; video_on, p_tick: out std_logic; pixel_x, pixel_y: out std_logic_vector (9 downto 0) ); end vga_sync;

22 VHDL Code of VGA Sync (2) ECE 448 – FPGA and ASIC Design with VHDL architecture arch of vga_sync is -- VGA 640-by-480 sync parameters constant HD: integer:=640; --horizontal display area constant HF: integer:=16 ; --h. front porch constant HR: integer:=96 ; --h. retrace constant HB: integer:=48 ; --h. back porch constant VD: integer:=480; --vertical display area constant VF: integer:=10; --v. front porch constant VR: integer:=2; --v. retrace constant VB: integer:=33; --v. back porch

23 VHDL Code of VGA Sync (3) ECE 448 – FPGA and ASIC Design with VHDL -- mod-2 counter signal mod2_reg, mod2_next: std_logic; -- sync counters signal v_count_reg, v_count_next: unsigned(9 downto 0); signal h_count_reg, h_count_next: unsigned(9 downto 0); -- output buffer signal v_sync_reg, h_sync_reg: std_logic; signal v_sync_next, h_sync_next: std_logic; -- status signal signal h_end, v_end, pixel_tick: std_logic;

24 VHDL Code of VGA Sync (4) ECE 448 – FPGA and ASIC Design with VHDL process (clk, reset) begin if reset='1' then mod2_reg <= '0'; v_count_reg '0'); h_count_reg '0'); v_sync_reg <= '0'; h_sync_reg <= '0'; elsif (clk'event and clk='1') then mod2_reg <= mod2_next; v_count_reg <= v_count_next; h_count_reg <= h_count_next; v_sync_reg <= v_sync_next; h_sync_reg <= h_sync_next; end if; end process;

25 VHDL Code of VGA Sync (5) ECE 448 – FPGA and ASIC Design with VHDL -- mod-2 circuit to generate 25 MHz enable tick mod2_next <= not mod2_reg; MHz pixel tick pixel_tick <= '1' when mod2_reg='1' else '0'; -- status h_end <= -- end of horizontal counter '1' when h_count_reg=(HD+HF+HR+HB-1) else '0'; v_end <= -- end of vertical counter '1' when v_count_reg=(VD+VF+VR+VB-1) else '0';

26 VHDL Code of VGA Sync (6) ECE 448 – FPGA and ASIC Design with VHDL -- mod-800 horizontal sync counter process (h_count_reg, h_end, pixel_tick) begin if pixel_tick='1' then MHz tick if h_end='1' then h_count_next '0'); else h_count_next <= h_count_reg + 1; end if; else h_count_next <= h_count_reg; end if; end process;

27 pixel_tick and pixel_x generation ECE 448 – FPGA and ASIC Design with VHDL pixel_x

28 HSC: horizontal sync counter (combinational logic) ECE 448 – FPGA and ASIC Design with VHDL

29 pixel_x generation (alternative view) ECE 448 – FPGA and ASIC Design with VHDL

30 VHDL Code of VGA Sync (7) ECE 448 – FPGA and ASIC Design with VHDL -- mod-525 vertical sync counter process (v_count_reg, h_end, v_end, pixel_tick) begin if pixel_tick='1' and h_end='1' then if (v_end='1') then v_count_next '0'); else v_count_next <= v_count_reg + 1; end if; else v_count_next <= v_count_reg; end if; end process;

31 pixel_y generation ECE 448 – FPGA and ASIC Design with VHDL

32 VSC: vertical sync counter (combinational logic) ECE 448 – FPGA and ASIC Design with VHDL

33 pixel_y generation (alternative view) ECE 448 – FPGA and ASIC Design with VHDL

34 VHDL Code of VGA Sync (8) ECE 448 – FPGA and ASIC Design with VHDL -- horizontal and vertical sync, buffered to avoid glitch h_sync_next <= ‘0' when (h_count_reg >= (HD+HF)) and (h_count_reg <= (HD+HF+HR-1)) else ‘1'; v_sync_next <= ‘0' when (v_count_reg >= (VD+VF)) and (v_count_reg <= (VD+VF+VR-1)) else ‘1'; -- video on/off video_on <= '1' when (h_count_reg<HD) and (v_count_reg<VD) else '0';

35 h_sync, v_sync registers ECE 448 – FPGA and ASIC Design with VHDL

36 h_sync_next logic ECE 448 – FPGA and ASIC Design with VHDL

37 Horizontal Synchronization ECE 448 – FPGA and ASIC Design with VHDL

38 Vertical Synchronization ECE 448 – FPGA and ASIC Design with VHDL

39 VHDL Code of VGA Sync (9) ECE 448 – FPGA and ASIC Design with VHDL -- output signal hsync <= h_sync_reg; vsync <= v_sync_reg; pixel_x <= std_logic_vector(h_count_reg); pixel_y <= std_logic_vector(v_count_reg); p_tick <= pixel_tick; end arch;

40 VGA Sync Testing Circuit (1) ECE 448 – FPGA and ASIC Design with VHDL library ieee; use ieee.std_logic_1164.all; entity vga_test is port ( clk, reset: in std_logic; sw: in std_logic_vector(2 downto 0); hsync, vsync: out std_logic; rgb: out std_logic_vector(2 downto 0) ); end vga_test; architecture arch of vga_test is signal rgb_reg: std_logic_vector(2 downto 0); signal video_on: std_logic;

41 VGA Sync Testing Circuit (2) ECE 448 – FPGA and ASIC Design with VHDL begin vga_sync_unit: entity work.vga_sync port map(clk=>clk, reset=>reset, hsync=>hsync, vsync=>vsync, video_on=>video_on, p_tick=>open, pixel_x=>open, pixel_y=>open); process (clk, reset) begin if reset='1' then rgb_reg '0'); elsif (clk'event and clk='1') then rgb_reg <= sw; end if; end process; rgb <= rgb_reg when video_on='1' else "000"; end arch;

42 VGA Controller – Simplified View ECE 448 – FPGA and ASIC Design with VHDL