It just occurred to me that learning to program FPGAs is making me feel young again. It's not taking years off my countenance or anything, but I'm once again working with circuits I was building in my high school electronics class back in the age of dinosaurs and dweebs.
In this column, I've added a binary to seven-segment decoder to the binary counting configuration I used in my previous blog. The seven-segment display I'm using is an old FND500 that I purchased in 1980 when building my first computer -- a CDP1802-based single-board thing.
My primary objectives with this project are to build on my starting project by adding more functions and to get something running that I can use to learn about the ChipScope virtual logic analyzer (a device discussed here before).
I've used almost all the available I/O on my Spartan FPGA, but I was able to bring out both the binary count and the seven-segment hex count. My push-on/push-off switch starts and stops the count, while my plain momentary contact push-button switch activates the decimal point. I've uploaded the complete UCF and Verilog file here, so you can follow our "create project" steps from previous blogs to start with working code before heading to ChipScope.
I named my project "FND500count." You can skip the "New Source Wizard" steps and just put the Verilog file and UCF into your empty project as complete source files. Copy the two files, "7-segment count.v" and "7-segment.ucf," into a "source" folder in your project folder. (Click here to see a larger version of the following image.)
After that, you just add the Verilog file, followed by the UCF file, into the project through the "Add file" option.
Since we'll be using ChipScope once this is all done, actual hardware isn't really necessary. However, if you want to build it up, here's what I've got.
In our previous sample code, the binary counting came out on the four LEDs built into the Spartan 6 LX9 board. I started out using that sample code (both the Verilog file and the UCF). For this exercise, I changed the binary count to drive four external LEDs, just to make it easier to see both the binary count and the seven-segment count.
Next page >