Top Banner
Think Fast: FPGA Design using C Colin O’Flynn NewAE Technology Inc #eelive
34

Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Aug 19, 2018

Download

Documents

hoangdan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Think Fast: FPGA Design using C

Colin O’Flynn

NewAE Technology Inc

#eelive

Page 2: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

This Presentation in 60 Seconds

Page 3: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

This Presentation in 60 Seconds

Page 4: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

This Presentation in 60 Seconds

Page 5: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

About Me

Programmable Logic in Practice (CC Column)

www.ProgrammableLogicInPractice.com (videos, etc)

Currently pursuing PhD, embedded security (power

analysis, clock glitching, etc). See YouTube channel

for cool examples!

Page 6: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

HLS is NOT a way to convert

software blocks to hardware. You

cannot do that and get good results.

No matter what vendors tell you.

Introduction: What is *NOT* High Level Synthesis?

Page 7: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Introduction: What is High Level Synthesis?

• Use C/C++ as HDL-like language

• Ability to compile the C/C++ code to get bit-accurate versions of

code which ‘run’ on your computer (~1000x faster simulations)

• Possible to write C/C++ which can run as both a hardware block via

HLS, or a software block.

• An amazing tool for rapid prototyping

It’s a Design Tool

Page 8: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Introduction: What is High Level Synthesis?

• If using HLS for ‘Protocols’ (e.g. send this, receive that), need to use

special directive to control data clocking

• This is VERY useful as can implement complex state machine in a

few minutes

• Not enough time to explain – see example posted online (link in last

slide) and/or Feb 2014 issue of Circuit Cellar (I’ve got a few copies

with me for you)

Important Information I’m Skipping on Protocol Implementation

Page 9: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

First Steps: Your Interface

Making your First Block

C++ Design

HDL Block

Page 10: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Source: Xilinx UG902

Page 11: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

More Advanced: Zynq / MicroBlaze Integration

Specify an AXI4LITE Interface (other types supported too)

Page 12: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

More Advanced: Zynq / MicroBlaze Integration

Generates a core for XPS

Page 13: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

More Advanced: Zynq / MicroBlaze Integration

These functions were automatically made for me (I just called them)

Page 14: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Next Steps: Working with Fixed-Point Data

Fixed Point Options

Page 15: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Next Steps: Examples of Data Types

Page 16: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Hardware in Use

OpenDAC, 210MSPS DAC(NewAE.com)

OpenADC, 105MSPS ADC(NewAE.com)Spartan6 LX25 Module

(ZTEX.de)

Baseboard (PSU)

Page 17: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Alternate Hardware

Custom ADC/DAC Board

• Spartan 3 Based FPGA Module

• 1x ADC• 1x DAC

Page 18: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Alternate Hardware

Red Pitaya

• Zynq Based!• 2x ADC• 2x DAC

Page 19: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Base Project

• Generates 105 MHz clk

• Outputs clocks to ADC/DAC

– Uses ODDR2 Block for S6

• Links ADC to DAC

Page 20: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Measurement Setup

Using VNWA (Small PC-Based Vector Network Analyzer)

Page 21: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Measurement Setup

Alternate Measurement Setup

Page 22: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

FIR Filter Theory

Filter Equation

1

0

][)(N

k

k knxbny

Page 23: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

FIR Filter Theory

Filter Interpretation

y[2] = b0 * x[2] + b1*x[1] + b3*x[0]

Page 24: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

FIR Filter Theory

Generating Coefficients

e.g. Using MATLAB or arc.id.au/FilterDesign.html

Page 25: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Live Demo Begins Now!

• I’m now going to implement the FIR filter

• Following slides are not used during presentation, but show rough

steps of implementation

Page 26: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

VNA Results – Raw (using LNA Input)

Page 27: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

VNA Results – Raw (using LNA Input)

Page 28: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

VNA Results – After Cheating (Calibration)

Page 29: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Coding the FIR Filter 1/2

Page 30: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Coding the FIR Filter 2/2

Page 31: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Inserting Auto-Generated Code

Page 32: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Inserting the FIR Filter Code & Testing Results

Page 33: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

Done!

• Working demo of implementing an FIR with fixed-point math

• See my YouTube channel for recording of project

Page 34: Think Fast: FPGA Design using C - NewAE … · Think Fast: FPGA Design using C Colin O’Flynn ... Zynq / MicroBlaze Integration ... 105MSPS ADC Spartan6 LX25 Module (NewAE.com)

More Information & Questions

• Check out February 2014 Issue of Circuit Cellar, covers HLS

• www.ProgrammableLogicInPractice.com/?p=87 has examples

• www.ColinOFlynn.com/eelive for material from this presentation

Contact me:

E-Mail: [email protected]

Twitter: colin.oflynn