What I did when I didn’t feel like working on schoolwork for half a day

I’ve always been fascinated with FPGAs ever since I was introduced to them. I’ve wanted to make a small project using Verilog to sharpen my HDL skills for a long time now. Well, today is the day I got around to it. I had lying around an Altera Cyclone II DSP Development Board. It’s a pretty old evaluation kit, but for my purposes, it does the trick.

Altera Cyclone II – DSP Development Board

I downloaded Altera’s programming toolsuite for linux and got started on making a project. You can get the final product here: QuartusFPGA

I basically did what I’m sure everyone does when starting off with some new hardware: try to make it do Knight Rider lights. To start off, I followed this guide making sure that I put the right chip in when prompted. I had some prior experience with Verilog, so I was able to easily modify the starter code to make all the LEDs light up in sequence. When it came time to select the pins (in the Assignments->Pin Planner), I had used the schematics to match up to the verilog.

Next, compilation came pretty easily once I set in the project settings for Analysis & Synthesis->Verilog HDL Input->Verilog version = SystemVerilog. This is because I was using the fancy constructs for my output variables being larger than a bit. Now for the POF file to be correct (which is what is written into the FLASH memory that can configure the FPGA on powerup) you’ll need to edit the Device settings and click on “Device and Pin Options”, and under “Configuration”, set the “Configuration device” to ‘EPCS64’ instead of ‘auto’. For some reason it kept detecting a EPCS16 for me. While you’re there, the other thing I needed to set was the “Unused Pins” to ‘As input tri-stated with weak pull-up’.

You can program the FPGA directly by connecting the USB Blaster to the JTAG programming port and using the Tools->Programmer utility with the “Mode” set to ‘JTAG’. With this, you can select the SOF file and program that into the IC. If you want to program the FLASH, you need to set the mode to ‘Active Serial Programming’, select the POF file, and plug the USB Blaster into J13 with the cable going away from the RAM slot.

Another feature of my code is that I also have a module for turning on the 7 Segment displays which count the number of times the LEDs sweep back and forth while properly wrapping around 100.

Let me know if you have any problems by writing in the comments below.

Liked it? Take a second to support me on Patreon!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.