Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of...

34
ni.com Making the Most of your FPGA Design Rejwan Ali Marketing Engineer

Transcript of Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of...

Page 1: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

ni.com

Making the Most of your FPGA Design

Rejwan Ali

Marketing Engineer

Page 2: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

ni.com

Overview

• Introduction to “Making the most”

• Maintainability through Simulation

• Creating Scalable LVFPGA

• Reactor Pattern in LVFPGA

Page 3: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

ni.com

Making the Most of our FPGA

Maintainable – The code is easy to test and

changeScalable – Maximize FPGA capabilities

Page 4: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

4ni.com

LabVIEW FPGA

• Reconfigurable I/O

• Custom hardware algorithms

Page 5: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

5ni.com

LV FPGA Development Process

Requirements

Design

Implement

Test

Deploy

Page 6: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

6ni.com

LV FPGA Development Process

Implement

Compile

Test

Page 7: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

7ni.com

LV FPGA Development Process

Implement

Compile

Test

15 sec

544 sec

65 sec

87% spent compiling

Page 8: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

8ni.com

Reduce Development Time

• Buy a faster compilation machine

• Improve the compiler (Xilinx, NI)

• Simulation

ni.com/trycompilecloud

Page 9: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

9ni.com

Simulation

Simulation– The imitation of the operation of a real-world system over time.

LVFPGA Simulation Options

1. Simulation on Windows

2. Development Computer with Simulated I/O

3. Conditional Disable Structures

4. LVFPGA Desktop Execution Node

5. Testbench

Page 10: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

10ni.com

Simulation On Windows

Pre-FPGA

WindowsFPGA code Post-

FPGA

Windows

Page 11: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

11ni.com

Simulation On Windows

Quick

Good for inline algorithms

Allows Windows VIs

+No/incorrect timing

I/O does not work

Code snipetsonly

-

Use case: Quick functionality

Page 12: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

12ni.com

Development Computer with Simulated I/O

FPGA Target Press RunGenerate

VHDLCompile

BitfileRun on

Hardware

Development Computer w/

Sim I/OPress Run

Run Diagram on Windows (Simulation)

Debug Code

Page 13: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

13ni.com

Development Computer with Simulated I/O

1.

2.

Page 14: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

14ni.com

Development Computer with Simulated I/O

Page 15: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

15ni.com

Development Computer with Simulated I/O

Full simulation

Memory, FIFOs and I/O supported

Standard debug tool available

+Inputs are random data by default

Windows VIs unsupported on FPGA

-

Use case: Functional test

Page 16: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

16ni.com

Conditional Disable

Allows changing FPGA source easily by switching

between FPGA and Development Computer context

Page 17: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

17ni.com

Conditional Disable

Quick

Changes functionality automatically

+Branches code

Windows VIs unsupported

-

Page 18: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

18ni.com

LV FPGA Desktop Execution Node

LV FPGA

Host-side

Page 19: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

19ni.com

LV FPGA Desktop Execution Node

Page 20: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

20ni.com

LV FPGA Desktop Execution Node

Test Harness

Unit Test

Page 21: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

21ni.com

LV FPGA Desktop Execution Node

Iteration Accurate

Simulates I/O

Memory and FIFO supported

+Not Tick Accurate

-

Use case: Unit Testing &

Integration Testing

Page 22: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

22ni.com

Testbench

Embedded Testbench – An application which verifies functionality of software and hardware through simulation

Page 23: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

23ni.com

Testbench

I/O Simulation

Testbench

FPGA

Example

FPGA Interface

Page 24: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

24ni.com

Testbench

Full Simulation

Test FPGA Interface

UI available

Customizable I/O

Waveform Probes

+Ensure Simulation starts first

-

Use case: System testing

Page 25: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

25ni.com

Scalable LabVIEW FPGA

How difficult to scale this FPGA Code?

Page 26: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

26ni.com

Scalable LabVIEW FPGA

1. Copy/Paste

2. Change IO

3. Add more memory blocks to

the project

4. Add more DMA FIFOs

5. Change the names of

controls and indicators

DO NOT DO THIS:

• Unmaintainable

• Limited DMA FIFOs

• Huge Diagrams make it hard to debug/simulate

Page 27: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

27ni.com

Scalable SubVIs

1. Create SubVI

2. Copy SubVIs

3. …..

4. Profit???

Problems:

1. I/O is incorrect

2. Same memory blocks in each copy

3. Same DMA FIFO in each SubVI

4. How do we change the Delay?

Page 28: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

28ni.com

Purple Wires

VI-Defined

Local FIFOs

Memory

Registers

References

Inputs

Outputs

DMA FIFOs

Local FIFOs

Memory

Registers

Timing

Sources

Page 29: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

29ni.com

Single-cycle Timed Loops

Problems

• Some hardware MUST be run inside a SCTL

• SCTL is not compatible with some operations

Not allowed in

SCTL

Page 30: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

30ni.com

Single-cycle Timed Loops

Bonus

• SCTL code can be used in non-SCTL locations

• SCTL code is typically smaller than non-SCTL

• SCTL code is very deterministic

Page 31: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

33ni.com

Reactor Pattern

Reactor Pattern– A design pattern for handling information that is being sent concurrently. Very common is networking software.

Page 32: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

34ni.com

Reactor Pattern

Channel 0

Channel 1

Channel N

Channel 2

……..

Dispatcher Aggregator

Host Application

FPGA

Local FIFODMA FIFO

Page 33: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

37ni.com

Reactor Pattern

Advantages

• Very scalable

• Works on all NI Targets

• Concurrency

Disadvantages

• Difficult without simulation

• FIFO sizing can be tricky

Page 34: Making the Most of your FPGA Design - NIaustralia.ni.com/sites/default/files/Making The Most Of FPGA.pdf · Making the Most of your FPGA Design Rejwan Ali Marketing Engineer. ni.com

39ni.com

Maintainable Scalable

Questions