Wednesday, May 29, 2013

FPGA and State Machines

Random Interesting facts on FPGA

1) Because fan-in limitations reduce the speed of carry-lookahead adder, some devices that are characterized by low fan-in include dedicated circuitry for implementation of fast adders.
(Chapter 5, pg-246 of Fundamentals of Digital Logic with VHDL Design)

Thursday, May 23, 2013

Step 1: Getting LED's blink on Digilent ATLYS Board (Xilinx Univeristy Program)

I have been fascinated with power of FPGA's when I started using them for computation application. My programming experience with programming FPGA's using LabVIEW FPGA. National Instruments becomes excellent PXI based FlexRIO boards which are easy to program using LabVIEW FPGA. LabVIEW FPGA abstracts all the complexity of programming in VHDL/Verilog and forces the user to best practices. You can check more details about FlexRIO boards at http://www.ni.com/flexrio/

While I have been using FPGAs for High Performance Computing, I was always interested in playing with FPGA's embedded applications. I started looking for some cheap boards so that I can start playing with them using VHDl so that I can understand the low-level FPGA details. Couple of boards I came across were:

1) Xess Board: Very Cheap and let's us get started easily.

Good Tutorials online about Xess:
http://www.xess.com/appnotes/FpgasNowWhatBook.pdf

Good Book on VHDL
http://www.freerangefactory.org/dl/free_range_vhdl.pdf

2) Digilent Board: Decent Price

I would strongly recommend checking out their videos at
http://www.youtube.com/user/LBEbooks



For the Step 1, I have used ATLYS from Digilent. Why Digilent ATLYS? My wife has this as part of her course work, so I wanted to put good use of some thing I already have available.

Components required for this programming practice:

1) ATLYS Board
2) Xilinx ISE for Synthesis and Simulation
3) Adept Software from Digilent (http://www.digilentinc.com/Products/Detail.cfm?Prod=ADEPT)
4) Sigasi Editor Free Edition(Optional)
 Sigasi makes VHDL Programming easy and fun. Download it from http://www.sigasi.com/


Steps to create LED Blinker:

1) Download the VHDL code attached or create your own

https://github.com/kalyanramu/ATLYS

Important files in the repository to create bit files on your own
VHDL File Name: LEDBlink.vhd

Ready to use bit file:
Final Bit File: ledblink.bit

Most of the code was borrowed and idea was borrowed from
http://www.youtube.com/watch?v=2qx7Xef2LGE

2) Create the UCF File
Changes I have made are really in the UCF File.

Label L15 for the Clock was found from the manual. The board also shows GCLK <L15> label.
NET "CLK" LOC="L15";
NET "LED" LOC="U18";
NET "RST" LOC="A10";

Labels for LED LD0 ---> U18 and Switch SW0 ---> A10 can be found on the board

Note: Don't forget the semicolon at the end of line. Without ; the Xilinx compiler generates error.

3) Synthesize the Bit file
Watch the video tutorial in Step 1 for Synthesis

4) Power ON the board

After connecting the board to power outlet using power cable, flip the POWER switch beside the cable to ON. Verify that PGOOD and DONE LED's are ON.

5) Download/Program the Bitfile onto FPGA
I found that programming the FPGA using Adept Software easy. After installing the Adept Software, connect your board to PC.

Note: Connect the other end of USB cable from PC to USB Port on the board which is labeled as "PROG". If it is connected to other USB ports, proper driver won't be installed and the Adept software won't recognize the board

Adept GUI when ATLYS board is not detected



Adept GUI when ATLYS board is detected



You can download the VHDL Code from the links below: