Introduction

VGA is a high-resolution video standard used mostly for computer monitors, where ability to transmit a sharp, detailed image is essential. VGA uses separate wires to transmit the three color component signals and vertical and horizontal synchronization signals.

VGA Signals

Like any video format, VGA video is a stream of frames: each frame is made up of a series of horizontal lines, and each line is made up of a series of pixels. The lines in each frame are transmitted in order from top to bottom (VGA is not interlaced), and the pixels in each line are transmitted from left to right. Separate horizontal and vertical synchronization signals are used to define the ends of each line and frame. A composite synchronization signal (actually an XOR of the horizontal and vertical signals) is also encoded on the green color channel.

The ADV7125 video DAC reads an 8-bit value for each of the red, green, and blue channels on each cycle of the pixel clock. There is a two-cycle pipeline delay between when the digital codes are read by the DAC and when the corresponding analog voltages appear on the DAC outputs. The RGB input signals can be overridden by the sync and blank signals: The active low blank signal forces all three DAC outputs to their black level, while the active low sync signal forces the green DAC to a special sync level below the normal black level.

Each line of video begins with an active video region, in which RGB values are output for each pixel in the line. The active region is followed by a blanking region, in which black pixels are transmitted. In the middle of the blanking interval, a horizontal sync pulse is transmitted. The blanking interval before the sync pulse is known as the "front porch", and the blanking interval after the sync pulse is known as the "back porch". Note that the dedicated horizontal sync signal output from the FPGA directly to the VGA connector must be delayed by two clock cycles relative to the composite sync signal passed to the DAC chip, to account for the pipeline delay of the DAC.

Frames are constructed from lines in much the same way as lines are constructed from pixels. The beginning of a frame contains all of the lines that will actually be displayed on the screen, followed by a number of black lines that make up the front porch. Next comes a vertical sync pulse that lasts for several lines, and then more black lines to make up a back porch. Note that the composite sync signal embedded in the green channel appears inverted during the vertical sync pulse: remember that the composite sync is an XOR of the horizontal and vertical sync signals.