Intro to FPGA development using: the Elbert V2

  • What is an FPGA? 
    • Field Programmable Gate Array is a programmable MCU that can be altered. Its configuration is specified using HDL (Hardware Description Language) which is similar to that of an ASIC.
  • FPGA's vs MCU's
    • Cost: MCU's such as Arduino starts with $5 market-rate whereas, FPGA's start off with $20.
    • Speed: Depends on the application. For datapath application such as video/audio processing or parallel instructions really operate faster than pipelined instructions. Microprocessors are more programming oriented whereas, considering speed-wise applications FPGAs are used.
    • Application: Video, Audio, Networking, and where parallel instructions, FPGAs are used.
    • Difficulty in code/design: HDLs are used.
  • Elbert V2 - Spartan 3A FPGA Development Board
    • Provided with Ancilliary Peripherals which really help us while working on our code to make sure everything's functioning properly when we get into our first example.
    • 7 seg display
    • SD card
    • Audio jack
    • VGA
    • DIP switch
  • To get started with this FPGA board, vendor IDE is specified to be used and downloaded  (can be downloaded from Gadget Factory) but that isn't the case always (ISE WebPack made by Xilinx). 
  • Also recommended to use: Xilinx Vivado but, that doesn't work with spartan 3 A and Spartan chips.

  • Blink program (first Xilinx ISE program for your FPGA board):
Once ISE is successfully installed, start with a New Project > LEDblink > HDL > New Project Wizard (Click Next) > Next > Next Next > Finish

On the sidebar right-click LEDblink > New Source > select Verilog > File name: led > Define Module skip > Finish

`timescale 1ns / 1ps
////////////////////////////////////////
module led(clock, led);
 
input clock;
output led;
reg [31:0] counter;


always @(posedge clock) counter <= counter + 1;


endmodule


Now, Right-Click on Synthesize - XST > Run
Warning: Output <led> is never assigned.


`timescale 1ns / 1ps
////////////////////////////////////////
module led(clock, led);
 
input clock;
output led;
reg [31:0] counter;


always @(posedge clock) counter <= counter + 1;
assign led = counter[21];

endmodule


Synthesize > 'Successfully Compiled'

To edit constraints > ucf file: right-click the ucf file and open to look at the netlist gpio.

Now > 'Save' everything and Synthesize.

Setting the constraint (.ucf) file:


A constraint file tells functions of the program which pins are connected to which part of the chip. A 7-segment display, audio component, LED, all other different components that we have are connected through specific pins on the chip - relating peripherals to the chip. 

# This file is a .ucf for ElbertV2 Development Board #
# To use it in your project : #
# * Remove or comment the lines corresponding to unused pins in the project #
# * Rename the used signals according to the your project #
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#
#**************************************************************************************************************************************************#
# UCF for ElbertV2 Development Board #
#**************************************************************************************************************************************************#
CONFIG VCCAUX = "3.3" ;
#
# Clock 12 MHz
NET "clock" LOC = P129 | IOSTANDARD = LVCMOS33 | PERIOD = 12MHz;
###################################################################################################
# LED
###################################################################################################
#
# NET "LED[0]" LOC = P46 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
# NET "LED[1]" LOC = P47 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
# NET "LED[2]" LOC = P48 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
NET "led" LOC = P49 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
# NET "LED[4]" LOC = P50 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
# NET "led1" LOC = P51 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
NET "led1" LOC = P54 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
# NET "LED[7]" LOC = P55 | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12; Uploading the code with a bitstream to Elbert: right-click on Generate Programming File > Properties > check 'create binary configuration file' > Generate Programming File right-click > run To open and run the project with Elbert: First check in the device manager if the board is connected. Next, Open Elbert V2 Configuration Tool > Select COM port > click on C-Drive > User1 > Xil_Projs > LEDblink folder > led.bin file > open > Program Once uploading is done, the assigned LED starts blinking.

Comments

Post a Comment