FPGA: 4 Bit Counter

The heart of the VGA controller described in previous articles is a modified binary counter. The VHDL code provided below is a simple 4 bit counter with clock enable and reset inputs. The  4BitCounter_Test file provides a testbench to stimulate the counter and verify it’s operation.

A counter can also be implemented as an altium designer schematic, writing no VHDL, with little effort.  In this case an 8 bit counter is used to simplify connection to the on board LEDs.  A clock divider is used to create a 2 Hz clock signal to drive the counter.  When uploaded to the FPGA board the LEDs will cycle indicating that the counter is working.

Both the VHDL files and designer schematic are available for download at the end of this post.

 

Altium 8 Bit Converter Schematic
Altium 8 Bit Converter Schematic

 

Continue reading “FPGA: 4 Bit Counter”

FPGA NES: VGA (Part 2)

Previously a basic VGA controller was designed that had the capability to display a solid color across an entire computer monitor. This post builds on that design in an attempt to verify that the controller is able to correctly display more advanced patterns. In this example the code for the clock sub-circuit remained unchanged. However the color generator code was hacked up to create a moving 100 pixel horizontal and vertical bar. Color selection still works as before with the upper two bits now being used to enable or disable either bar. The animation of the bars works fairly well, however both bars are expected to be a solid color which is not the case as shown in the image below.

 

Update:

I’ve found the bug.  It turns out I was not shutting off pixel color when the active pixel left the boundaries of the screen.  The code has been modified with the changes from line 73-77. I believe the problem is related to the monitor expecting an absence of data during H-Blank.  It looks as though the monitor may be setting the black level by averaging the voltages measured during H-Blank.  A fade to black would occur with a persistent input signal if this were the case.  This also explains why the vertical bar is unaffected.

Continue reading “FPGA NES: VGA (Part 2)”

FPGA NES: VGA (Part 1)

Any good video game requires one very fundamental feature: video. The nanoboard includes a VGA port and seeing as I don’t know anything about the VGA protocol it seems like the perfect place to start.  The nanoboard also has a built in touch-screen, however I feel like that would be easier to implement and will be covered in a later post.  My goal for this section is to display the “SMPTE color bars” on a standard computer monitor.

Continue reading “FPGA NES: VGA (Part 1)”

Altium NanoBoard 3000

The Nanoboard 3000 is a Field Programmable Gate Array (FPGA) development board that is packed full of peripherals and features.  The hardware layout is really top notch and includes USB, VGA, audio amplifiers, MIDI ports, speakers, a TFT touch screen, an IR remote, and much much more.  A one year license to Altium Designer is also included with the board.  This provides access to Altium’s library of schematic tools as well as pre-built interfaces for all of the on board peripherals.  Altium Designer allows for the creation of complicated FPGA designs complete with graphical interfaces all without writing a single line of VHDL.  While Altium Designer is powerful, it’s also my biggest complaint about the package so far.  After a year your license drops dead and there’s no hobbyist friendly renewal option.  You have to purchase the full corporate license or abandon Altium Designer and program all of your designs using a JTAG adapter.

For now my plan is to learn VHDL (Which was my original intent before stumbling across the nanoboard and instantly becoming entitled) while using Altium Designer as a first attempt or supplementary design tool.  I think my first major project will be to emulate an NES using the nanoboard hardware.  This isn’t a trivial goal for someone who has never worked with FPGA’s before.  However, I’ve had success emulating the Game boy system using the Android SDK and find the whole concept of hardware emulation fascinating so this should be a fun and self-motivating project.

Step one is definitely not going to be ‘Create the NES’ and I plan on documenting all the smaller steps along the way to the final goal, both for myself and anyone else who finds the concept interesting.