labview fpga - infn-bo
TRANSCRIPT
![Page 1: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/1.jpg)
LABVIEW FPGA
how to program FPGAs
without any VHDL knowledge
![Page 2: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/2.jpg)
New Labview project: target FPGA
math.vi is no longer targeted to a PC, but to a FPGA
![Page 3: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/3.jpg)
Basic FPGA VI
• F=(A+B)CD
![Page 4: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/4.jpg)
LabVIEW Mapped to FPGA
Implementing Logic on FPGA: F =(A+B)CD
A
B
C
D
F
![Page 5: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/5.jpg)
FPGA palette
FPGA specific functions• Programming structures
• Device I/O
• Arithmetic and Boolean Logic
• Arrays and clusters
• Timing
• Math and control functions
• Synchronization and FIFOs
• Look-up tables
![Page 6: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/6.jpg)
Some LabVIEW VIs and functions are not available or have
restrictions in FPGA VIs.
The following LabVIEW features are not available for FPGA VIs:
• Floating-point functions
• Variable-size and multidimensional arrays
• Error clusters or strings
• Dialog boxes
• File I/O
• Printing
FPGA palette limitations
![Page 7: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/7.jpg)
Integer Math
• No floating point
• Singles and doubles type
are not supported
![Page 8: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/8.jpg)
• For variable scaling, you can determine and set the scaling
factor and bit shift from the host application
For example: Scaling Factor: 11
Downshift: -4 bits
Result Multiplication: 11 / 16 = 0.6875
Integer Math
![Page 9: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/9.jpg)
Compile Process and Server
• Convert LV diagram to intermediate files
• Send intermediate files to the compile server
– Compiles VIs for FPGA
– Returns FPGA bitstream to LabVIEW
– Bitstream is stored in VI
• LabVIEW environment is a client
– Can disconnect from server and reconnect while compiling
Compile
Server
![Page 10: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/10.jpg)
Target FPGA
Download
Windows OS
LabVIEW FPGA Module
• Occurs automatically
after a compile
initiated by the run
button
FPGA VI
Bit File Embedded Download FPGA VI (actually
the bit file)
![Page 11: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/11.jpg)
Interactive Mode
Windows OS
LabVIEW FPGA Module
Target FPGAFPGA VI
(Front Panel)
• Interact with VI on FPGA
through Front Panel
• No Debugging
– VI is running in the FPGA
UpdatesFPGA VI
(running)
![Page 12: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/12.jpg)
Interactive Mode
![Page 13: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/13.jpg)
Host PC Interactive Mode
Windows OS
Target FPGAVI
(Front Panel)
• Interact with FPGA through host
PC based Front Panel
• Allows you to do other
processing in Host VI
UpdatesFPGA VI
(running)
FPGA VIHost VI
![Page 14: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/14.jpg)
Host PC
Interactive Mode
![Page 15: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/15.jpg)
Windows Target Mode
Windows OS
LabVIEW FPGA Module(targeted to Windows)
FPGA VI
• Run FPGA VI on Windows
• Software Emulation– No hardware timing
• Debugging possible– Check logic before compile
![Page 16: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/16.jpg)
Benchmark timing performances
![Page 17: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/17.jpg)
Exercise: timing benchmark
• Create a VI which adds two numbers and runs a
benchmark in parallel that determines how fast code is
running
![Page 18: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/18.jpg)
Benchmarking VIs Size
• Speed
• Size
– IOBs – Input/Output Blocks
– MULT18X18s - multipliers
– SLICEs – Combination of
LookUp Tables (LUTs) and Flip
Flops (FFs)
– BUFGMUXs – portal to the
clock net, which is used to clock
FFs
![Page 19: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/19.jpg)
Configuring FPGA I/O
![Page 20: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/20.jpg)
Using FPGA I/O Nodes
Two ways to use FPGA I/O:
• Drag and drop from LabVIEW Project
• Drop empty I/O node on block diagram and select I/O by left clicking
![Page 21: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/21.jpg)
Exercise
![Page 22: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/22.jpg)
Timing Control Functions
![Page 23: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/23.jpg)
Configure Timing Functions
• Counter Units– Ticks
– µsec
– msec
• Size of Internal Counter– 32 Bit
– 16 Bit
– 8 Bit
![Page 24: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/24.jpg)
Timing Using the Single-Cycle Timed Loop
• Execute multiple functions in a single clock cycle
• Loop executes at compile clock speed by default
• Increases code speed and efficiency
• All code must execute within one clock tick
50 MHz Clock = Spartan 3E HW
![Page 25: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/25.jpg)
Multiple Clock Domains
• Derive different clock domains
based off 50 MHz
• Different Single-Cycle Timed
Loops can have different clocks
• Used for:
– Generating clocks
– Local speed optimization
![Page 26: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/26.jpg)
Triggering when multiple digital signals match a logic condition
Trigger example
![Page 27: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/27.jpg)
Designing counters
using the single-cycled timed loop
![Page 28: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/28.jpg)
Designing counters
using the while loop with a wait inside
![Page 29: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/29.jpg)
Parallel Loop Execution
•Dictate Loop Execution Order
–Structures such as FIFOs and occurrences can
determine program flow and loop execution order
–These structures can also synchronize the
execution of parallel loops
•Data Sharing
–Can pass data between parallel loops on the FPGA
–Use FIFOs, memory, or local variables
![Page 30: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/30.jpg)
FPGA
Loop Ordering With FIFOs
Acquisition
FPGA FIFO
FPGA FIFO
Indicator
Data Flow
• FPGA FIFO passes data
between parallel loops
• FIFO determines loop
execution order
– Acquisition writes data to
FIFO
– Read FIFO to display
data on indicators
![Page 31: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/31.jpg)
Parallel Execution
•Graphical programming promotes parallel code
architectures
•LabVIEW FPGA implements truly parallel
execution
![Page 32: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/32.jpg)
1
2
• Xilinx tools: ISE + Chipscope
• Labview compatible
• Xilinx tools: ISE + Chipscope
• NO Labview
![Page 33: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/33.jpg)
ADC interface DAC interface
RS232 interface
PS2 interface
ADC DAC
RS232
PS2
LCD display
![Page 34: labview Fpga - INFN-BO](https://reader030.vdocuments.mx/reader030/viewer/2022021500/586e00301a28ab114f8baf72/html5/thumbnails/34.jpg)
Task assignment proposal
1. RS232 interface:
• VHDL
• Labview (both FW & SW)
2. ADC interface
• VHDL
• Labview
3. DAC interface
• VHDL
• Labview
4. PS2 interface
• both ways
5. LCD display
• your choice