vhdlnerd

VN VGA Controller

Recommended Posts

I figured I'd start a new topic to post the status of my first Papilio One project - a VGA controller.

The basic features of the controller are:

  • Targets the 250k Papilio One board (should work in the 500k board, too)
  • Uses the VGA Wing
  • Generates a text display
  • Glorious 3-bit Color Output
  • Hardware Cursor (with selectable style)
  • Completely Scalable Design:
  • The controller can be reconfigured via a few constants
  • Many different VGA resolution standards may be selected (I've tested a few from 640x480 to 1600x1200, already)
  • Different fonts can be selected - fonts can be of different sizes (width and height) - I have three font sets defined currently: one 8x12 and two 8x16 (with 128 or 256 chars in each)
  • All logic and RAMs are inferred -- no Xilinx cores (except for the DCM primitive -- cannot infer that one)

(Note: The controller's configuration is static -- you choose one VGA resolution and font in VHDL before implementation.)

I'm hoping this will be a good example of how to create a scalable design in VHDL and I plan to create a nice wiki page in the playground for it.

Right now I have the core VGA stuff working: VGA signal timing generation and outputting a display of all the font characters repeatedly. This was enough to test how well the core scales to handle a 1600x1200 VGA resolution. This requires a 160MHz pixel clock and I was happy to see I still have some margin for the clock rate (however, I don't have much else in the FPGA; so, it may be hard to meet timing at that speed when the FPGA starts to fill up).

I'm thinking about having a final demo design of the VN VGA Controller with a SPI interface so an Arduino board can hook up to it and create a sketch to show off what the controller can do.

I'm hoping to have some code to show in a week or two. Since I'm new to this open project thing, I'm learning how git works and setting up something on github.

I'll post progress soon , I hope.

-vn

Share this post


Link to post
Share on other sites

Sounds like a fun project, we look forward to following it.

Have you seen the AVR8 and ZPUino soft processors? They are Arduino compatible soft processors that let you run sketches without the arduino hardware.

Jack.

Share this post


Link to post
Share on other sites

Yes, I looked in the AVR8.  Unfortunately, it uses all but two BRAMs on the 250k Papilio One.  The VGA controller needs at least four.  I guess I should have got a the 500k  :) .

-vn

Share this post


Link to post
Share on other sites

I finally have a first cut at the VN VGA controller done.  Please, check it out and leave some feedback.

A few points:

  • The ISE project targets the P1 250k board (should be easy to change for a P1 500k).
  • A VGA wing needs to be plugged into CH (or move the wing to the port of your choice and update the ucf file).
  • A SPI interface is on the CL port.  There is a Arduino sketch that will show off some of the VN VGA features.  So, you need to hook up an Ardruino board (or another P1 with an Ardruino compatible softcore) to port CL.  See the ucf file for correct hook up.
  • WARNING: If you use a real Ardruino board, it has 5V I/O!  Do not hook this directly to your Papilio! You need to use series resistors -- 330 ohms will work.  For more info, see Xilinx AR#19146.  You only need the resistors on the signals being driven by the Ardruino board (SPI Clk, SPI CS, and SPI Master to slave data).
  • Even without a Ardruino board, you can try out one of the many bit files.  By default the demo design will fill the screen with all the characters in the font in green with a black background.  So, you can see what the different resolutions/font combos look like.  (I think the DIS_1024x768_128x64x256 display type is the nicest -- its a 1024x768 pixel display, using a 8x12 pixel font (with 256 char defined) yielding a 128 column by 64 row text display.  This display type uses the BRAMs efficiently and the number of rows & columns are a nice power of two.)
  • The code is on github.

There is still a lot I would like to do with the design:

[list type=decimal]

[*]Make a self-contained demo (no external Ardruino board required).  This will require a P1 500k.  I don't have one  :( .  But, I do have the use of a Spartan 3E eval board, which has the same 500K size FPGA.  I might make a new demo with a ARV8 or ZPUino together with my VGA controller and have someone here verify it on their P1 500k board.

[*]Add more comments to the code.

[*]Add a hardware scroll feature.

[*]Support a raw mode and a text mode.  Raw mode is what I have implemented so far -- the user must reposition the cursor location a lot to display text on the screen.  The new "text mode" would give the user a dumb terminal for output -- where CF, LF, FF characters would be handled and automatic line wrapping & scrolling would be implemented.

[*]Add more display types (see the displayPack.vhd file).

[*]Add more fonts (see the fontPack.vhd file).

[*]Add support of fonts wider than 8 pixels -- could be useful with the higher res displays.

[*]Create a Wiki page to explain the design, if there is any interest.

[*]Re-target the design for the Papilio Plus board as soon as I get my hands on one  :) .  This should take very little effort -- should only need to mod the pixel clock generation code (for DCM differences between the S3E and S6).

I'm hoping this is a good example of a scalable design.  Please, let me know what you think. (And, let me know if there is anything missing from github -- this is the first time I've used git and github.)

-vn

Share this post


Link to post
Share on other sites

I'm sorry, so many things have been coming at me at once that I haven't had a chance to try this out. But believe me, it is on my list of things to do! As soon as things calm down a bit I will give this a spin. :)

Jack.

Share this post


Link to post
Share on other sites

If you want to lower your clock rate or power usage you could use DDR outputs, allowing you to halve your pixel clock (I've generated 1920x1080 this way). Is easy to implement as long as your font is always an even number of pixels wide. Would give you a heap of slack in your design too.

I've only created a DDR output through primitives. Not 100% sure how you would infer one...

Share this post


Link to post
Share on other sites

I never thought of using the DDR outputs to reduce the internal pixel clock by two -- I might have to play with that.  But, I think you are correct, you cannot infer DDR outputs (or inputs) -- at least, not yet.

However, creating a high rez VGA display with a high rate pixel clock on these hobby boards is not very useful -- you really only need a 800x600 (or my favorite, 1024x768) pixel display.  But, still fun to play with the higher speed stuff for a learning experience!

This does remained me: my demo uses the pixel clock for all of the design.  It would be better to use a slower clock for the non-VGA stuff.  (I already have the DCM code written to generate a second, slower, clock.)  Then, this would be an example of a multi-clock design, also.  I think I'll work on that next (after I'm dome playing with my CRAM wing).

-vn

Share this post


Link to post
Share on other sites

I was able to get a Papilio Plus board with the S6 LX9 FPGA.  So, I created a new VGA demo using this board and the Arduino Soft Core.  Its now a standalone demo.  The code, with bit files, can be found on github.  I built a Papilio One 500k version (there is a bit file for this in the project) but I don't have this board to test it on.  Please, if someone could try this bit file and let me know if it works, I would greatly appreciate it.

Since I'm targeting the Papilio Plus board now, I'll continue this thread in that forum.

-vn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now