Papilio Playground

The playground is an area where anyone can contribute code, examples, documentation, or just pictures of the Papilio in action. Anything Papilio or FPGA related is welcome.

The playground is a publicly editable wiki and we encourage anyone to add or edit content, the password is "gadget". To edit any page scroll to the very bottom of the page and select "Edit Page". There are instructions for wiki markup at the bottom. The password to upload images is also "gadget".

TV Output Wing

Author - BenL


NTSC/PAL TV and audio output using 14 resistors and a low pass audio filter. This design can be built in a couple minutes using parts from Radio Shack. Open Source VHDL code and EAGLE PCB design files are available.


Quick Links


  • 7/13/2011 Revision 1.0 of Wing was designed and submitted to BatchPCB for manufacturing.
  • 7/15/2011 The design is available for $8 at BatchPCB, please be aware that it is not verified yet and may not work correctly.
  • 7/26/2011 Design is built and verified. There is an issue with the example bit file having the pins defined in opposite of the Wing.


BenL is working on a Sega Master implementation on the Papilio FPGA board. During that process he created a TV Output Wing:

"This TV output wing could be an interesting replacement for the VGA+jack outputs of the arcade kit. It's a very simple R-2R ladder 7 bit DAC for the video line, and a plain low pass filter for the audio (the DAC must be implemented through logic).

You can very easily output B/W video, and colors with some efforts :"

The schematics :

You should use R=115 ohms and 2R=230 ohms to get 0.3V from "010000" (black) on the input and 1.0V from "110000" (white), the remaining "001111" being left for color modulation at high luminance.

A picture of the homemade prototype :

Color Test Bar

A small demo : compile this, plug your tv_output wing in A8-A15 and enjoy 8 color bars in the middle of the screen: yellow, cyan, green,magenta,red, blue, black and white. And overscan is grey.

You can switch in main.vhd between pal and ntsc (*_video to produce the correct sync, *_encoder to transform rgb to quadrature modulated yuv)

The image is good, but far from perfect: low sat on yellow and cyan, interferences between luminance and color carrier, some dot crawl (although you might not notice it because it scrolls vertically really fast)

TVOutput Schematic

Click image for PDF Schematic

How it works

You need to generate sync, luminance (monochrome image) and color information. See for details on the theory.

The provided encoder turns 2 bit RGB (64 colors) into YUV by a table lookup, and modulates the U/V signals by multiplying them by a square wave at the color carrier frequency (3.45MHz for NTSC, 4.62MHz for PAL) in phase (for U) and quadrature (for V). The color clok is generated from a 64MHz clock (thanks to a 21 bits accumulator), itself derived from the main 32MHz clock of the Papilio.

sync, Y, U and V are summed into the FPGA, and converted by the R-2R DAC into the corresponding voltage: the resistor values are chosen to turn the 3.3V of the Papilio output into the 0, 0.3 and 1.0V under 75 ohms that the tv requires.

Useful Links


Share |