LabVIEW FPGA

19,603 views

Published on

Howto implement a boolean logic function into hardware silicon? The hardware silicon used in this presentation is an FPGA (Xilinx Spartan3E starter kit). The software used is LabVIEW with the LabVIEW FPGA module and the SPARTAN3E driver.

Published in: Technology

LabVIEW FPGA

  1. 1. Regeltechniek (LabVIEW) 3pBA EA LabVIEW FPGA Implementing a Boolean function Vincent Claes
  2. 2. LabVIEW FPGA <ul><li>This presentation </li></ul><ul><ul><li>Starting a project </li></ul></ul><ul><ul><li>Creating a LabVIEW FPGA VI </li></ul></ul><ul><ul><li>Running the VI from SPARTAN3E Flash </li></ul></ul><ul><ul><li>Creating a HOST VI that communicates with LabVIEW FPGA VI in Xilinx Spartan3E starter kit </li></ul></ul>Vincent Claes
  3. 3. Xilinx SPARTAN3E Starter kit <ul><li>Board Information </li></ul><ul><ul><li>http://www.xilinx.com/products/devkits/HW-SPAR3E-SK-US-G.htm </li></ul></ul><ul><li>User guide </li></ul><ul><ul><li>http://www.digilentinc.com/Data/Products/S3EBOARD/S3EStarter_ug230.pdf </li></ul></ul>Vincent Claes
  4. 4. Xilinx SPARTAN3E Starter kit Vincent Claes
  5. 5. Xilinx SPARTAN3E Starter kit <ul><li>Xilinx XC3S500E Spartan-3E FPGA </li></ul><ul><li>Up to 232 user-I/O pins </li></ul><ul><li>320-pin FBGA package </li></ul><ul><li>Over 10,000 logic cells </li></ul><ul><li>Xilinx 4 Mbit Platform Flash configuration PROM </li></ul><ul><li>Xilinx 64-macrocell XC2C64A CoolRunner CPLD </li></ul><ul><li>64 MByte (512 Mbit) of DDR SDRAM, x16 data interface, 100+ MHz </li></ul><ul><li>16 MByte (128 Mbit) of parallel NOR Flash (Intel StrataFlash) </li></ul><ul><li>FPGA configuration storage </li></ul><ul><li>MicroBlaze code storage/shadowing </li></ul><ul><li>16 Mbits of SPI serial Flash (STMicro) </li></ul><ul><li>FPGA configuration storage </li></ul><ul><li>MicroBlaze code shadowing </li></ul><ul><li>2-line, 16-character LCD screen </li></ul><ul><li>PS/2 mouse or keyboard port </li></ul><ul><li>VGA display port </li></ul><ul><li>10/100 Ethernet PHY (requires Ethernet MAC in FPGA) </li></ul><ul><li>Two 9-pin RS-232 ports (DTE- and DCE-style) </li></ul><ul><li>On-board USB-based FPGA/CPLD download/debug interface </li></ul><ul><li>50 MHz clock oscillator </li></ul><ul><li>SHA-1 1-wire serial EEPROM for bitstream copy protection </li></ul><ul><li>Hirose FX2 expansion connector </li></ul><ul><li>Three Digilent 6-pin expansion connectors </li></ul><ul><li>Four-output, SPI-based Digital-to-Analog Converter (DAC) </li></ul><ul><li>Two-input, SPI-based Analog-to-Digital Converter (ADC) with programmable-gain pre-amplifier </li></ul><ul><li>ChipScope™ SoftTouch debugging port </li></ul><ul><li>Rotary-encoder with push-button shaft </li></ul><ul><li>Eight discrete LEDs </li></ul><ul><li>Four slide switches </li></ul><ul><li>Four push-button switches </li></ul><ul><li>SMA clock input </li></ul><ul><li>8-pin DIP socket for auxiliary clock oscillator </li></ul>Vincent Claes
  6. 6. Before you start <ul><li>Install LabVIEW 8.5 </li></ul><ul><li>Install LabVIEW FPGA module </li></ul><ul><li>Download and install the LabVIEW FPGA for Xilinx SPARTAN-3E XUP Driver (read the license agreement) </li></ul><ul><ul><li>http://digital.ni.com/express.nsf/bycode/spartan3e </li></ul></ul><ul><li>Connect USB Cable with board </li></ul><ul><li>Put SWP of board to ON </li></ul>Vincent Claes
  7. 7. Starting an Empty Project <ul><li>Start LabVIEW 8.5 </li></ul><ul><li>Choose “Empty Project” </li></ul>Vincent Claes
  8. 8. Project Explorer <ul><li>The Project Explorer window should open </li></ul><ul><li>Be sure to have a look at the tree of the project </li></ul>Vincent Claes
  9. 9. Add the SPARTAN3E board as a hardware target to your project <ul><li>Right click on “My computer” </li></ul><ul><li>Select New </li></ul><ul><li>Select Targets and Devices </li></ul><ul><li>A new window should open </li></ul>Vincent Claes
  10. 10. Select the Spartan-3E Starter Board <ul><li>Click the option “New target or device” </li></ul><ul><li>Select the “Spartan-3E Starter board” under the “Xilinx University Program” option </li></ul>Vincent Claes
  11. 11. Project Explorer view <ul><li>Look now at the Project Explorer </li></ul><ul><li>FPGA Target should be added </li></ul><ul><li>The next step is to add peripherals to the FPGA target </li></ul>Vincent Claes
  12. 12. Add FPGA target Peripherals <ul><li>Right click on the FPGA target </li></ul><ul><li>Select “New” </li></ul><ul><li>Click FPGA IO (Input/Output Peripherals) </li></ul><ul><ul><li>You could also add a FIFO or Memory block at this location </li></ul></ul>Vincent Claes
  13. 13. Adding new FPGA I/O <ul><li>This Window shows all the FPGA I/O of the SPARTAN3E Starter Kit </li></ul><ul><li>You can click the “+” to have more details </li></ul><ul><li>Select the I/O you want and push “Add” </li></ul><ul><li>You should see the FPGA I/O on the right side that you wanted to add </li></ul><ul><li>Be sure for this exercise to add the LED’s and Slide Switches </li></ul>Vincent Claes
  14. 14. Project Explorer View <ul><li>In the Project Explorer view you should see all the peripherals you have added </li></ul><ul><li>Now we are ready to program a VI on the FPGA </li></ul>Vincent Claes
  15. 15. Create a VI for the FPGA target <ul><li>Right Click on the FPGA target you added </li></ul><ul><li>Select “New” </li></ul><ul><li>Select “VI” </li></ul>Vincent Claes
  16. 16. Overview <ul><li>Project Explorer </li></ul><ul><li>Front Panel </li></ul><ul><li>Block Diagram </li></ul>Vincent Claes
  17. 17. LabVIEW Functions for FPGA targets <ul><li>Memory & FIFO </li></ul><ul><li>FPGA I/O </li></ul><ul><li>FPGA Math & Analysis </li></ul>Vincent Claes
  18. 18. Implementing Boolean logic <ul><li>On the Block diagram you can now add the functions you want to use </li></ul><ul><li>Be sure to put them into a loop </li></ul>Vincent Claes
  19. 19. FPGA I/O <ul><li>Next step: getting I/O </li></ul><ul><li>Select “Functions” </li></ul><ul><li>“ Programming” </li></ul><ul><li>“ I/O Node” </li></ul><ul><li>Place this on the block diagram </li></ul>Vincent Claes
  20. 20. FPGA I/O <ul><li>Right mouse click </li></ul><ul><li>You can select and FPGA I/O </li></ul><ul><li>You can add more I/O’s </li></ul>Vincent Claes
  21. 21. FPGA I/O <ul><li>For this exercise: </li></ul><ul><li>Put 2 I/O nodes on the block diagram </li></ul><ul><li>Select SW0 untill SW3 </li></ul><ul><li>Select LED0 untill LED 3 </li></ul><ul><li>Connect as in the screenshot </li></ul>Vincent Claes
  22. 22. Indicators on Front Panel <ul><li>If we put Indicators in the code we can watch the value of the wires over the JTAG interface on the Front Panel on our PC </li></ul>Vincent Claes
  23. 23. Indicators on Front Panel Vincent Claes
  24. 24. Running the Example <ul><li>Press the Run arrow </li></ul>Vincent Claes
  25. 25. Running the Example <ul><li>Be sure to save your VI first otherwise you get this message </li></ul>Vincent Claes
  26. 26. Compile report <ul><li>After you pressed “Run arrow” </li></ul><ul><li>The PC start compiling and synthesizing your code </li></ul><ul><li>When this process is finished you see the Compiler Report </li></ul><ul><li>You have to press “OK” </li></ul><ul><li>Now you should see the code running on your FPGA (try it!) </li></ul><ul><li>And you can watch the indicators on your computer too. </li></ul>Vincent Claes
  27. 27. To Flash <ul><li>The following slides show you howto put the code into the flash </li></ul><ul><li>Right click on the FPGA target </li></ul><ul><li>Select “Properties” </li></ul>Vincent Claes
  28. 28. To Flash <ul><li>You have to check the option “Run when loaded to FPGA” </li></ul><ul><li>Otherwise the FPGA will not start running your program when you download it to the Flash </li></ul>Vincent Claes
  29. 29. To Flash <ul><li>To download the bitfile to the Flash right click on the FPGA VI in the Project Explorer View </li></ul><ul><li>Select the “Download VI to Flash Memory” </li></ul>Vincent Claes
  30. 30. To Flash <ul><li>It could happen that this message is appearing </li></ul><ul><li>You have to recompile </li></ul><ul><li>This is because you first compiled (synthesized  remember we are talking in hardware not software !!!) and afterwards did the run when loaded setting. </li></ul><ul><li>So solution: “Recompile it!” </li></ul><ul><li>When you try the download to Flash option again the is says everything is downloaded successful and you have to see the VI running on the FPGA board. </li></ul>Vincent Claes
  31. 31. Setting up HOST VI <ul><li>The next slides show you how to create a host VI that communicates with the LabVIEW FPGA VI on the SPARTAN3E Starter board over JTAG interface (“USB Programming Cable”) </li></ul><ul><li>Click “My Computer” </li></ul><ul><li>Select “New” </li></ul><ul><li>Select “VI” </li></ul><ul><li>Watch where LabVIEW places it in the Project Explorer Tree </li></ul>Vincent Claes
  32. 32. HOST VI <ul><li>Option for “FPGA Interfacing” on Host VI </li></ul>Vincent Claes
  33. 33. HOST VI <ul><li>Select “Open FPGA VI Reference” </li></ul><ul><li>Place in on the Block Diagrom of the HOST VI </li></ul><ul><li>Right Click on the icon </li></ul><ul><li>You can choose to “select the FPGA VI” or “Select Bitfile” if you already compiled it. </li></ul>Vincent Claes
  34. 34. HOST VI <ul><li>This is an example HOST VI </li></ul><ul><li>Read/Write Control is placed in a Loop </li></ul><ul><li>You can select all indicators/controls of the FPGA VI from this function </li></ul>Vincent Claes
  35. 35. HOST VI <ul><li>Create indicators from the Read/Write Control to create indicators on the HOST VI </li></ul>Vincent Claes
  36. 36. HOST VI <ul><li>Finished HOST VI </li></ul><ul><li>Now you can run this HOST VI; this is executed on your computer! </li></ul>Vincent Claes
  37. 37. Running HOST VI  FPGA VI example Vincent Claes
  38. 38. <ul><li>Contact information </li></ul><ul><li>claesvincent @ gmail.com </li></ul><ul><li>http://www.xios.be </li></ul><ul><li>http://pwo.fpga.be </li></ul><ul><li>http://www.mobile-it.be </li></ul>Vincent Claes

×