float to fixed

52
FLOAT TO FIXED Taylor L. Riché, Jim Nagle, Joyce Xu, Don Hubbard National Instruments Using Executable Models to Make FPGA Design Easier

Upload: others

Post on 29-Jul-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FLOAT TO FIXED

FLOAT TO FIXEDTaylor L. Riché, Jim Nagle, Joyce Xu, Don Hubbard

National Instruments

Using Executable Models to Make FPGA Design Easier

Page 2: FLOAT TO FIXED

WHO AM I?

Taylor L. RichéPrincipal Product OwnerNational InstrumentsManagerLocal Arrangements Chair MODELS 2017DeveloperPostdoc (Riché et. al, MODELS 2010)PhD Student

Page 3: FLOAT TO FIXED

FPGA𝑓𝑓 𝑥𝑥 = 𝑎𝑎0 + �𝑛𝑛=1

𝑎𝑎𝑛𝑛 cos𝑛𝑛𝑛𝑛𝑥𝑥𝐿𝐿 + 𝑏𝑏𝑛𝑛 sin

𝑛𝑛𝑛𝑛𝑥𝑥𝐿𝐿

PROBLEM: THIS IS HARD!

GOAL:

Page 4: FLOAT TO FIXED

SOLUTION:1. Have algorithm designers model their new

algorithms in LabVIEW NXG2. Use the executable nature of LabVIEW NXG to

generate an initial model transform3. Provide tools to help designers create and

apply the remaining transforms4. Along the way, executability gives constant

feedback on “correct enough” by construction

Page 5: FLOAT TO FIXED

A QUICK INTRO TO G

Page 6: FLOAT TO FIXED

SO THIS IS G…

Page 7: FLOAT TO FIXED

AND THIS IS LABVIEW NXG…

Page 8: FLOAT TO FIXED

A FEW DETAILS

1. Graphical dataflow language2. Test and Measurement DSL3. Allows you to model computation4. Allows you to model hardware configuration5. Different libraries of mathematical tools6. Allows creation of EXEs and reusable IP7. Maps computation to desktop, FPGA, and Realtime

http://www.ni.com/labviewnxg

Page 9: FLOAT TO FIXED

EXECUTABILITY

Page 10: FLOAT TO FIXED

IT RUNS

Page 11: FLOAT TO FIXED

FPGA𝑓𝑓 𝑥𝑥 = 𝑎𝑎0 + �𝑛𝑛=1

𝑎𝑎𝑛𝑛 cos𝑛𝑛𝑛𝑛𝑥𝑥𝐿𝐿 + 𝑏𝑏𝑛𝑛 sin

𝑛𝑛𝑛𝑛𝑥𝑥𝐿𝐿

GOAL:

Page 12: FLOAT TO FIXED

FPGA

GOAL:

Page 13: FLOAT TO FIXED

THE PROBLEM:

• Throughput constraints require HW• FPGAs have limited resources• Floating point takes many resources• Digital design experts are expensive

Page 14: FLOAT TO FIXED

THE RESOURCE SOLUTION:FIXED-POINT ARITHMETIC

Page 15: FLOAT TO FIXED

XXXX.YYYYYYYYYYYY

FIXED POINT

4 integerbits

12 fractionalbits

Page 16: FLOAT TO FIXED

FIXED POINT CHALLENGES

• Too few integer bits overflow• Too few fractional bits loss of precision• More bits use more FPGA resources

Page 17: FLOAT TO FIXED

Precision

Resources

AcceptableRegion

Pareto FrontFor a Modeland a Device

RESOURCES V. PRECISION

Page 18: FLOAT TO FIXED

RESOURCE EXAMPLE

Page 19: FLOAT TO FIXED

RESOURCE EXAMPLE

Page 20: FLOAT TO FIXED

OUR SOLUTION:LABVIEW NXG F2F

Page 21: FLOAT TO FIXED

DESIGN TENANTS:

• Not trying to make the best F2F tool• Usability was paramount

• Don’t hire a FXP or DD expert• No spreadsheets!

• Don’t try to encode all constraints• Focus on Signal-to-Noise Ratio (SNR)

• Perfect is the enemy of shipping

Page 22: FLOAT TO FIXED

BUT FIRST, SOME FORMALISMS

Page 23: FLOAT TO FIXED
Page 24: FLOAT TO FIXED

+

+x

Page 25: FLOAT TO FIXED

+

+x

Page 26: FLOAT TO FIXED

+

+x

Page 27: FLOAT TO FIXED

integer bits requiredfor no overflow

Page 28: FLOAT TO FIXED

fractional bits requiredto meet local SNR

Page 29: FLOAT TO FIXED
Page 30: FLOAT TO FIXED
Page 31: FLOAT TO FIXED
Page 32: FLOAT TO FIXED

XXXX.YYYYYYYYYYYY

FINDING FRACTIONAL BITS

SNR

# of bits

Page 33: FLOAT TO FIXED

XXXX.YYYYYYYYYYY

FINDING FRACTIONAL BITS

SNR

# of bits

Page 34: FLOAT TO FIXED

XXXX.YYYYYYYYYY

FINDING FRACTIONAL BITS

SNR

# of bits

Page 35: FLOAT TO FIXED

XXXX.YYYYYYYYY

FINDING FRACTIONAL BITS

SNR

# of bits

Page 36: FLOAT TO FIXED

XXXX.YYYYYYYY

FINDING FRACTIONAL BITS

SNR

# of bits

Page 37: FLOAT TO FIXED

XXXX.YYYYYYYYY

FINDING FRACTIONAL BITS

9 fractional bits

SNR

# of bits

Page 38: FLOAT TO FIXED
Page 39: FLOAT TO FIXED

THE WORKFLOW

Page 40: FLOAT TO FIXED
Page 41: FLOAT TO FIXED
Page 42: FLOAT TO FIXED
Page 43: FLOAT TO FIXED
Page 44: FLOAT TO FIXED

LOCAL ERROR V.REAL ERROR

Page 45: FLOAT TO FIXED
Page 46: FLOAT TO FIXED

CORRECT ENOUGHBY CONSTRUCTION

Page 47: FLOAT TO FIXED
Page 48: FLOAT TO FIXED
Page 49: FLOAT TO FIXED
Page 50: FLOAT TO FIXED
Page 51: FLOAT TO FIXED

EXECUTABILITY ALLOWSFOR CONTINUAL FEEDBACK

Page 52: FLOAT TO FIXED

CONCLUSION

1. Lets algorithm designers model their new algorithms in LabVIEW

2. Uses the executable nature of LabVIEW to generate an initial model transform

3. Provides tools to help designers create and apply the remaining transforms

4. Gives constant feedback on “correct enough” by construction

Our F2F tool in LabVIEW NXG FPGA: