Musings of a Fondue

Tag: Vhdl

A VHDL Take on Ben Eater's CPU

IMG_20170903_132332

As part of the Homebrew Computer Project, I have been exploring other CPU architectures and their implementations in order to broaden my understanding of CPU design.

An awesome one that I came across was Ben Eater’s 8-bit computer. It is well documented through a series of videos on Youtube and also on his blog. The architecture is simple which allows you to get a firm understanding of all its components.

Since it is a known working design, I saw it as the perfect opportunity to practice implementing a CPU in VHDL.

Learning VHDL - VGA

Next in line in the awesome tutorial series from Nandland was VGA. I didn’t have a VGA connector for my FPGA, but wondered if I could jury-rig something with what I had on hand.

The wiring diagram below from Grant Seale’s Multicomp gave me a very good idea on how to go about it.

In the Nandland tutorial (image below), three signals are used per channel instead of two so my setup reflects that.

I had five 1Kohm resistors on hand, enough to control one channel. I used two of them in parallel to get the 500 ohms (close enough to 549), two in series to get the 2K ohms, and one on its own for the 1K ohms. Jumper wires were used to connect to the pins (red, green, blue, hsync, vsync). Luckily, all the ground pins were in-line (and the random pin in-between was an unused pin) so I just tied the whole line to ground using one wire (instead of several jumper wires). Here is the final masterpiece:

IMG_20170124_121927

And the overall setup:

IMG_20170124_124112

Learning VHDL

I chose to use VHDL to program the FPGA because it is closer to a schematic representation than Verilog. Verilog seems (to me) like learning a new programming language whereas VHDL is more like describing the circuit.

For example, take the construction of a full adder. Here is a video of the structure generated by my code below: