Close

VGA - Part II

A project log for BabyBaby or Extremely Small Experimental Computer

An FPGA implementation of the Manchester Baby or Small Scale Experimental Computer.

davedave 12/28/2015 at 16:050 Comments

After reading the ealier log I realized I left out quite a bit of info on the VGA code. Here is a bit more but you will need to read the code to understand in detail how it works...

When I started this project I had assumed that most FPGA to VGA displays worked like a computer VGA adaptor. I expected to find a suitably sized RAM which was filled with data, which was then read out by line and dot (horizontal) counters which feed the memory.

In practice most FPGA displays do not have a frame buffer. Counters are used to generate the various clocks, but they are also used to select or derive the Video data to be displayed. The logic used in the “BabyBaby” is described below. Although it is peripheral to the main purpose of the machine it is the most complex part of the VHDL code.

For the BabyBaby I needed to display 32 words of 32 bits giving 1024 bits in total. On the real Baby the CRT scanning circuitry is devised so each scan line on the screen displays one word of Baby memory, with a suitable gap between the lines so they can be observed clearly. It displays a “Dot” for each “Zero” bit in memory and a “Dash” for each for each one bit. A Dash is approximately three times the length of a dash.

This is why the Baby documentation rather naturally uses the term “Line” whereas we in modern computer jargon we would say “Word”.

A quick calculation revealed that I had 640/32 = 20 pixels per bit along the line. I actually used 16 pixels per bit meaning 512 bits/line are used. That meant I could use the lowest 4-bits of the Horizontal Dot Counter to tell me which pixel I was working on. The pixels are used as follows: -

Pixels 0-4 – Always set to “Green”

Pixels 5-11 - Set to “Green” if the bit being displayed is a “1”

Pixels 12-15- Always set to green

That left the vertical spacing’s to work out. The simplest display would of course be to just use one VGA scan line per word, but this looks very thin. If the “Dots” are to be square, as those on the real Baby appear to be then each line must be repeated four times, making a “Dot” 4x4 pixels and a “Dash” 12x4 pixels.

A gap of 8 blank display lines separates each line of data, so each “Word” occupies 12 lines on the VGA display. This is not quite the correct proportion but it fits well on the screen using 384 lines out of the 480 that are available and the visual effect is quite pleasing.

That left how to find the right bit for the right pixel. This is done using a multiplexor. At the start of each line the word to be displayed is read from memory and fed into a multiplexor. The appropriate bit to be displayed is selected by using bits 8 thru 4 of the dot counter and an arbitrary constant so the display appears in the proper horizontal position on the screen. On reflection simply shifting the word might work better and use less logic...

Blank lines are also left at the top of the screen so the vertical position can be set.

This code is I think the most complex part of the BabyBaby…

Discussions