model-based design for medical applications using hdl coder · hightech systems medical systems...

17
Rob Reilink, M.Sc Ph.D Model-Based Design for Medical Applications using HDL Coder

Upload: others

Post on 10-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

Rob Reilink, M.Sc Ph.D

Model-Based Design for Medical Applications using HDL Coder

Page 2: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

2

DEMCON Profile

MEDICAL SYSTEMSHIGHTECH SYSTEMS EMBEDDED SYSTEMS

INDUSTRIAL SYSTEMS & VISION

OPTOMECHATRONIC SYSTEMS

From early idea through to product

6 locations

• Established in 1993 (25 yr)• ~ 500 employees• ~ €50M turnover• >10 year experience with Model-Based Design

Page 3: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

3

Link between model and requirements

Simulation of concepts

What-if studies

Detailed simulation of components

Rapid prototyping

Code generation

Hardware in the loop

Continuous integration

Unit testing

Processor in the loop

Model

Executablespecs

Design withsimulation

Automaticcode

generation

Test & verification

Model-based design @ DEMCON

2007PCxPC / Simulink Realtime

2011DSP / microcontrollerEmbedded Coder

2017FPGAHDL Coder

More compact Higher speed

Page 4: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

4

Use case: precision cut surgical instrument

▪ Piezo actuator driven by adjustable sine wave

▪ Class-D power amplifier for energy efficiency

▪ Business case: more compact, more energy-efficient, more flexible

Analog filter & transformerPower amplifier Piezo stackPWM generator

Software (FPGA) Hardware

Page 5: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

5

Frequency domain behavior of a piezo actuator

▪ Piezo actuator needs to be driven at its resonance frequency (~40kHz)

▪ Adjust frequency to achieve 0° phase difference between voltage and current

Capacitive behavior

Piezo impedance Z = U/I

Resistive behavior

Highest power output

Page 6: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

6

Frequency domain behavior of a piezo actuator

▪ Phase-locked loop is used to control piezo frequency

Voltage outputCurrent input

Page 7: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

7

Challenges

▪ Uncertainty in piezo actuator behavior

▪ Product variations

▪ Interaction with tissue

▪ Desired behavior for optimal cutting

▪ Short development time

▪ Reliable PLL stability / locking

▪ More complicated control & signal processing

▪ High loop frequency

Need for testing using actual actuator on tissue!

Page 8: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

8

Use case: precision cut surgical instrument high-level model

Sine generation Measurement of phase of current

Measurement of phase of voltageMeasured piezo voltage and current

PI-controller

To PWM generator

Page 9: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

9

From reference implementation to FPGA: fixed point

▪ High-level (golden reference) model designed by Mechatronic System Engineer

▪ Fixed-point conversion

▪ ‘Sine Wave Function’ blocks replaced by ‘Sine and Cosine HDL Optimized’ blocks

▪ Trigonometric block <atan2> replaced by CORDIC-based four quadrant inverse tangent Matlab function

▪ Target low-cost Xilinx Artix-7 FPGA (no SoC required)

Page 10: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

10

Model-based design verification: FPGA model vs reference

Page 11: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

11

HDL Coder Workflow

fixed-point conversion

floating-point support

discrete-time

HDL supported blocks

oversampling factor

workflow advisors

Implementation on target

Page 12: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

12

HDL Coder timing analysis, critical path

▪ Very useful feature to find computational bottle-necks

▪ In our case: sine & cosine computation

Page 13: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

13

HDL Coder Pipelining

Lesson learned:

automatic delay

balancing is great

for complex signal

path applications

Page 14: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

14

HDL Coder Resource Sharing

12 June 2018

Lesson learned:

Automatic resource

sharing is a very

powerful and

flexible feature.

Page 15: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

15

From reference implementation to FPGA: floating point

▪ For the final implementation: use of floating point

▪ Model synthesizable within few days

▪ Only minor adaptions required: single precision datatypes and non-HDL blocks replaced

▪ IEEE (native) floating point support for all trigonometric & math blocks (sin, cos, sincos, atan, atan2)

Fixed point Floating point

LUTs 10k 25k

DSP slices 50 100

Development time ~1 week ~1 day

~2x more resources~5x less development effort

Page 16: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

16

Achievements

▪ Early prototype with limited development effort

▪ Energy-efficient piezo actuator

▪ Cost-efficient by incorporating controller in the existing FPGA

▪ Reliable PLL operation

▪ Fast iterations using HDL coder

Page 17: Model-Based Design for Medical Applications using HDL Coder · HIGHTECH SYSTEMS MEDICAL SYSTEMS EMBEDDED SYSTEMS INDUSTRIAL SYSTEMS & VISION ... DSP / microcontroller Embedded Coder

17

Conclusions

▪ Less chances of coding errors due to high-level implementation

▪ Improves collaboration between FPGA engineers and other disciplines (system engineers)

▪ Resource sharing & pipelining optimizations are much easier as compared to bare VHDL coding

▪ Only setting appropriate numbers / check boxes instead of re-implementing

▪ Native floating point support speeds up transition from high-level model to implementation

▪ No / less need to worry about data types

▪ Good support of a.o. trigonometric functions

▪ Same model for ‘high level’ simulations and for FPGA code generation

Current project status: alpha-phase hardware validation