New VGA Driver Tutorial
Introduction
This tutorial provides a method for using the VGA video output from the DE1-SoC.
Differences from Display Interface Lab Driver
- Color: Supports RGB color values instead of defaulting to only black and white pixels.
-
Pixel specification: Employs a "scanning" method.
Instead of the user specifying the color (black or white) of an
arbitrary pixel, the driver cycles through one pixel at a time
(given by the outputs
xandy) and the user supplies the RGB color for that pixel.- Note that this means that writing is always active, unlike the display interface lab driver, which had an enable signal.
- Complexity: Uses modules from the standard library that weren't present in the display interface lab driver.
-
Window size: Can specify display width and height as
parameters instead of using the fixed max size of 640x480.
- The VGA interface implemented only supports 640x480 resolution, so user specified resolutions are emulated by creating large user pixels from several pixels in the native resolution. The driver achieves this by selecting an integer that specifies both the width and height in native resolution pixels of each user pixel. This integer is chosen such that the user pixels are as large as possible without any of the display being cropped out. The region which the user draws in is centered on the display and any margins to the top and bottom or left and right are colored black. This scheme is optimal in that it provides the largest display with uniform pixels sizes and no stretching or non-square pixels.
Using the New VGA Video Driver
The video driver included with this tutorial is designed to offer a
very simple interface for common video needs.
The driver module contained in video_driver.sv is
parameterized with WIDTH and HEIGHT.
Any resolution up to the native resolution of the interface,
640 pixels wide by 480 pixels high, may be specified by the user.
The driver provides the user with x- and y-coordinates of the
current pixel (origin is the upper-left corner), and the user
provides the driver with a color to draw at that pixel, which must
be valid within two clock cycles of the coordinates changing.
Colors are expressed as three 8-bit, unsigned integers, each
specifying the light intensity in its respective color channel,
red, green, or blue.
-
Parameters
WIDTH— the number of pixels wideHEIGHT— the number of pixels high
-
User Inputs
CLOCK_50— 50MHz clockreset— an active high synchronous resetr,g,b— 8-bit unsigned integer color channels
-
Driver Outputs
x— 10-bit unsigned integer x-coordinatey— 9-bit unsigned integer y-coordinate
All other ports are used to drive the VGA and should be connected to top-level pins of the same name.
Tutorial developed by Professor Scott Hauck and Kyle Gagner. Last updated by Cole Van Pelt. Code for video driver adapted from tutorials supplied by Altera.