The Basics of Programming Your First FPGA Device

0
img source: unsplash.com

FPGA stands for Field-Programmable Gate Array. FPGAs are silicon chips that can be programmed to do many different things in the same way you would program a traditional computer. The difference is, with an FPGA, you don’t need to design and fabricate a circuit board from scratch because it has been pre-programmed from the factory. In this blog post, we will go over some basic steps on how to get started using your first FPGA device.

  1. What You Will Need

The DE0-Nano Development Board -This is a board with a pre-installed FPGA chip. It’s a very affordable option for getting started and comes with USB communications so you can program it from your PC.

A USB cable (Type A to Type B): A micro SD card and a standard SD adapter if you plan on using one. (Note: On the DE0 board, pin one is marked with an orange dot near the end of the board opposite from where the USB port faces. This is important because this pin corresponds to voltage and ground and must be connected to your micro SD card using a 4-wire SPI connection. The FPGA chip on the DE0 board is an EPM1501 -which has a built-in memory controller for interfacing with the flash memory on the standard micro SD cards)

Img source: janssenengineeringgroup.com
  1. Installing ISE Webpack

ISE Webpack is the development software we will be using to program and interface with our board. It is free to download. Once you’ve downloaded it, double click the file and follow the instructions as if you were installing any other program on your computer. Note: ISE Webpack can take a while to install, but it is definitely worth the wait.

  1. Download and Extract HDL Files

Once you’ve installed ISE Webpack and booted up your computer, you should be presented with a screen to work from. From here, we want to click on “File” and then select “New Project.” You should see a menu pop up with a lot of options. From here, you can either give your project a name or leave it as is. Once you’ve done that, the next step is to download and extract an HDL file from Github.

  1. Create and Run Your Design

The next step is to create the HDL module that will be used to program your FPGA chip. You can do this by simply clicking on the project file you just created, which should open up a new window. From there, it’s pretty self-explanatory. Click on “Generate Output Products,” and then the executable file should pop up. Click on it once to select it, then click again to run it. It will take a few seconds to load, but once it’s done, you should see it.

img source: unsplash.com
  1. Installing Xilinx Tools

Now that we have our project opened up and running, we need to install some tools that will help us interface with the board. To do this, open up a command prompt and type in the following what is needed. If everything went well, you should see a list of directories show up. Now we need to add the bin directory from Vivado to this list.

  1. Installing Digilent Adept Runtime

A library is a set of pre-compiled codes that we can use to make our lives easier. Rather than writing everything from scratch, we can use these libraries (which are written by other people.) and avoid monotony (at least in some cases). Although the DE0 Nano board uses an EPM1501 FPGA chip, we can’t use any of the example code provided with ISE because it was written for a different type of FPGA chip. Luckily we have the Digilent Adept Runtime available to us. You can download it .Once you’ve downloaded it, install the library on your computer.

  1. Install Digilent Adept Plug-In

Now that we have the runtime installed on our computer, it’s time to install the plug-in. To do this, start up Vivado and click on “Configure” from the top menu. Then select “Add-Ons,” followed by “Install Add-Ons.”

Click on “Adept Runtime Plug-In,” then click “Install.” This will install the plug-in and add it to your list of available add-ons for Vivado. Once this is done, close out of the Add-On Manager, and you’re ready for the next step.

Img source: unsplash.com
  1. Installing Digilent Adept Hardware Drivers

Once we have everything installed, we actually need to connect to the board. To do this, go to “Add Sources” from the top menu and select “CompactRIO Adept Manager.” Once you’ve done that, click on “Connect” in the bottom right-hand corner of the pop-up window.

  1. Installing Board Support

Once your computer has connected with the DE0 Nano board, you should see a new window appear. In this window, you’ll be able to select which board type you’re using (we only need the primary drivers for DE0 Nano, so make sure it’s selected). Click on “Board Support” and then click on “Add Board.” Now in the bottom left-hand corner of this pop-up, make sure that “DE0-Nano” is selected before clicking on “Add.”

Now click on the button in the bottom right-hand corner, which should tell Vivado to look for any connected boards.

  1. Compiling Verilog Code

Before we can actually program our board, we need to compile the Verilog code that we wrote. To do this, click on “Generate Bitstream” from the top menu and select your project directory . You should see it on your screen.

Now go back to Vivado’s top menu and select “Program” (you might need to connect another USB cable if it tells you to do so). After this is done, Vivado will automatically open up the program file for your board.

If everything was successful, then you should be able to see your code running on DE0 Nano. Congratulations on doing embedded development with FPGA boards. If you have any questions, please let me know in the comments. Thanks for reading.

Img source: catalyte.io

Conclusion

After you push “Generate Bitstream,” go to Vivado’s top menu and select “Program.” After this is done, Vivado will automatically open up the program file for your board. If everything was successful, then you should be able to see your code running on DE0 Nano. Congratulations on doing embedded development with FPGA boards from Directics.com.