matlab based prototyping of fpga projects …...enclustra gmbh technoparkstr. 1 – ch-8005 zürich...

25
Enclustra GmbH Technoparkstr. 1 CH-8005 Zürich Switzerland Phone +41 43 343 39 43 www.enclustra.com 1 MATLAB ® based Prototyping of FPGA Projects Embedded Computing Conference 2016 ZHAW Winterthur, May 31, 2016

Upload: others

Post on 21-Mar-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

1

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Page 2: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

2

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Page 3: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

3

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Page 4: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

4

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Short Profile

Enclustra is a dynamic, innovative and successful FPGA design service company

located in Technopark Zurich, Switzerland.

Our FPGA engineers have in-depth knowledge in various application areas like

software defined radio, drive control, digital signal processing and data acquisition

systems.

Investing in employee training and keeping critical knowledge up to date on a

regular basis enables us to find ideal solutions at a minimal expense for our clients.

We’re vendor-independent, and we’re design service partners of Xilinx®, Altera®

and Lattice Semiconductor – this close communication allows us to be forward-

looking in our design process, and remain on the cutting edge of the most advanced

FPGA technology.

Enclustra – Everything FPGA!

Page 5: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

5

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Page 6: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

6

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Adoption of new Technology

New technology is usually adopted to benefit from its increased capabilities. Even

though there is often some benefit provided by the technology alone, the benefits

can be multiplied by adjusting the methodology to the new technology.

Let’s take the replacement of the good old typewriter by computers as an example.

Certainly there is some benefit from just using the computer: Multiple copies of

documents can be printed and work can be stored in other forms than paper which

is no long-term solution. However, if one still re-types a whole table to just add one

row in the middle (as it was required with a typewriter), big advantages of the new

technology are unused. The same applies for documents which can easily be edited

without re-typing – this was simply not possible in the past.

As a result we changed our methodology. Lists are not growing only at the bottom

end today but are most likely alphabetically sorted and new lines are inserted

somewhere in the middle accordingly. Completely new concepts like the “living

document” which is refined during a whole project popped up and help to improve

our efficiency as well as the quality of results. This nicely shows that the computer

not only has replaced the typewriter in a better way but that we also had to change

the methodology to fully profit from the new features.

On the other hand new technology also rises new problems. Nobody had to care

about anti-virus software for a typewriter.

You are wondering why new technology is emphasized so much? Remember all that

applications where MCUs, DSPs and analog electronics get replaced by FPGAs and

SoCs?

Page 7: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

7

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

One possible Way to Rome

According to Freeman Dyson, an Engineer is a person who makes a design that works

with as few original ideas as possible. So you are strongly encouraged to change the

concepts provided to fit your needs, only pick out some ideas or even decide that

the methodology shown does not fit your needs at all. Do not just apply it and

regard it as “the correct way”.

The presentation mainly consists of experiences from real-world FPGA and SoC

projects at Enclustra and things are therefore optimized to the requirements and

processes of Enclustra.

Page 8: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

8

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Common Prototyping Problems for FPGA Projects

This section gives an overview over some common problems when prototyping FPGA

projects. This helps understanding why MATLAB based prototypes can be beneficial.

Page 9: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

9

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Poor Visibility

One of the main problems when prototyping FPGA projects is the very limited

visibility in the error case, even if the error is perfectly reproducible. For processors

single-stepping through the code and analyzing the content of each variable after

every step is possible and breakpoints can be set. In analog electronics signals can be

measured using a scope. FPGAs don’t provide such kind of an inherent visibility.

There are logic analyzers which can be compiled into the FPGA design to observe

what is happening within the chip. However, these analyzers have very limited

memory and with compile times of hours, routing an additional signal to the logic

analyzer can be quite time consuming.

When the event of failure could be caught using the logic analyzer, data is often not

so easy to interpret since it is not valid all the time, multiple samples are processed in

parallel or data of several channels is mixed up. This is a big contrast to software

debugging where data is often available as array and can be copied away for analysis

easily.

Page 10: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

10

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Accessibility

Most specialists for signal processing, control theory or other areas where FPGAs are

commonly used are familiar with software development tools as well as the

programming languages C and C++. For software written in these languages, they

can analyze problems on their own and try different changes in fast iterations.

Unfortunately application specialists are often not familiar with HDL languages and

FPGA tools. Therefore an implementation specialist is required to help capturing data

for analysis and implement changes suggested by the application specialist. This

slows down the development cycle and also introduces more risk for

misunderstandings because of the communication between the application specialist

and the FPGA implementation specialist.

HDL code generation from more accessible languages such as MATLAB/Simulink® or

C can ease this problem. However, code generation is not applicable in many cases

and even if code can be generated, the FPGA tool flow may involve hand-placement

and timing optimization, which again requires effort of the implementation specialist.

Page 11: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

11

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Advantages of MATLAB based Prototypes

This section discusses how the impact of the problems mentioned on the last few

slides can be minimized using MATLAB based prototypes.

Note that the concept is not limited to data acquisition systems even though a data

acquisition system is used as example.

Page 12: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

12

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

MATLAB – The Childhood of Signal Processing Algorithms

MATLAB is a de facto industry standard tool for signal processing algorithm

development. This not only includes the development of the algorithm itself but also

the implementation of stimuli generators as well as functions for result analysis and

plotting. If subsequent processing steps (post-processing) are implemented in other

parts of the system (existing or not) they are often also modelled to judge the overall

system performance.

MATLAB as User Interface

By establishing a connection between the FPGA implementation and MATLAB, all the

data analysis functions and plotting utilities written during algorithm development

can be reused to analyze the performance of the real implementation of the

algorithm and compare it to simulations. While the figure only shows the data flow,

configuration of the processing within the FPGA is also controlled from MATLAB.

The approach shown makes the FPGA design accessible to the signal processing

specialist. He can play with different parameter sets and analyze the output directly

in MATLAB. Compared to the standard flow with a proprietary software to control

the FPGA design and import/export data via Files from/to MATLAB this speeds up

iterations significantly. Another advantage is that parameters such as filter

coefficients can be calculated directly in MATLAB and the design considerations

leading to a given parameter set are therefore inherently traceable.

Page 13: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

13

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

MATLAB Interface

The easiest way to make the FPGA accessible to an application specialist is to write

FPGA access functions that can be called from normal MATLAB scripts. Usually the

FPGA engineer can write such functions with very little effort since he is aware of all

implementation details. The abstraction level should be chosen in a way to not

expose implementation details to the user of these FPGA access functions.

This approach makes using the actual hardware very similar to just writing a

simulation script as visible from the image on the slide.

Enclustra’s FPGA Manager IP-Solution is a perfect match for the requirements of a

connection between MATLAB and FPGA: It allows configuring the FPGA by doing

register accesses and to receive/transmit streaming data. Its built-in MATLAB

interface further reduces the effort required to access the FPGA from MATLAB. It is

obvious that Enclustra therefore always uses FPGA Manager for MATLAB based

prototyping.

The concept of course also works without FPGA Manager. However, building such a

communication framework from scratch can be quite time consuming.

Page 14: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

14

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Flexible Measurement Infrastructure

By providing a flexible measurement infrastructure with several data acquisition

points, many time consuming iterations can be avoided. If results are not as

expected, the singal processing specialist can locate the point of failure by simply

capturing data at several points.

The effect of vaious changes to the algorithm can be tested by capturing data before

the point of failure and execute the rest of the processing (including the proposed

changes) in MATLAB. Again, overall algorithm performance analysis can be done

easily by using the existing infrastructure from simulations. A new FPGA

implementation iteration is only required after the behavior of the changes proposed

was verified using the combination of hardware and MATLAB models shown on the

slide.

The setup shown provides several advantages over a pure simulation:

• All effects caused by the FPGA implementation of all preceeding processing steps

are included

• Real-world data that led to the misbehavior can be captured

• Tests on hardware are possible before the complete algorithm is implemented

• Simulation time can drastically be reduced because parts of the algorithm are

executed in the FPGA at realtime

The last point especially applies if the part of the algorithm executed in the FPGA

contains any form of data rate reduction.

Page 15: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

15

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Reproducible Regression Testing

In many projects it is desirable to have a regression testing environment which allows

running the same sets of test data after every change. If the communication between

MATLAB and FPGA is not limited to acquiring data but also allows injecting data,

such regression tests can easily be controlled from MATLAB. In terms of speed, such

a setup outperforms every simulation by factors.

A big advantage of using MATLAB instead of any proprietary software to run such

regression tests is that MATLAB provides a lot of functionality to analyze the output.

This allows analyzing the output in a qualitative way (e.g. statistical analysis,

constellation analysis) which is by far more convienient than a bit-by-bit comparison

to expected output data which will produce many false positives.

Page 16: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

16

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Real-World Example

This section proves the usability of MATLAB based prototyping by discussing the

use-cases of a real-world project.

Page 17: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

17

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Project Overview

The picture on the slide shows a simplified block diagram of the spectrum analyzer

developed in the project discussed. The large range of configuration values lead to

many cases which cannot reasonably be simulated. Especially high downsampling

ratios together with large FFTs lead to unreasonably long simulation times even for a

single FFT.

Another difficulty is that the application specialist who is responsible for achieving

sufficient overall system performance is employed at the customer and does not

have any FPGA knowledge. Due to simulations not being reasonable, a setup

allowing easy data capturing and analysis without FPGA knowhow must be provided.

Therefore the decision to build a MATLAB based prototype was taken.

Page 18: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

18

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Early Perfomance Analysis

Thanks to the MATLAB based prototyping approach, the impact of the down

converter implementation on the performance of the complete system could be

analyzed as soon as the down converter was implemented. For low downsampling

ratios, the performance was known from simulations but for high downsampling

ratios, simulations were not reasonably feasible.

This example nicely shows how a MATLAB based prototype can be used to allow

iterative development. Tests for the down converter performance could be executed

while the FFT was implemented. If any defect was found, it could be fixed early in the

project with little effort.

Page 19: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

19

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

System Perfomance Analysis

The customer for this project analyzed the system performance in MATLAB. Having

all functions and toolboxes of MATLAB at hand significantly simplified this step.

Page 20: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

20

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Debugging

A test data generator was implemented to ensure 100% reproducibility of the input

data that led to a given issue. This concept allowed to reproduce all issues reported

by the customer at Enclustra’s office for finding the root-cause. To track down the

source of any misbehavior quickly, data can be captured at various points in the

design and then analyzed in MATLAB.

A good example for the advantages of this setup is an issue the customer reported in

the early bring-up phase. They reported that the noise level at the output of the

system is higher than expected while the signal-to-noise-ratio (SNR) was still quite

good (70dB instead of 100dB). At these SNR levels the distinction between good and

bad signals cannot be made without a spectral analysis. Fortunately such an analysis

can be implemented in MATLAB easily. Data was then captured at various points in

the design and the component introducing the problem could be identified quickly

by comparing spectrums of input and output.

Page 21: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

21

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Page 22: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

22

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Risk Reduction

The approach of MATLAB based prototyping significantly reduces development risk.

It allows early testing of critical entities on the hardware by the application specialist.

This greatly reduces the risk of finding problems with the system performance late in

the project where changes can be very costly. The accessibility of the system to the

application specialist is very important since this prevents misunderstandings

between application and implementation specialist from not being detected until

late in the project.

The availability of all the algorithms and toolboxes MATLAB provides leads to more

thorough testing.

Page 23: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

23

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Time Savings

MATLAB based prototypes save a lot of time during the bring-up and debug phase

of a project. They not only lead to faster identification of root causes for problems

but also help reducing the number of iterations required to fix issues. Since those

iterations are quite time consuming for FPGA/SoC projects with their long compile

times, this is a very important advantage.

FPGA/SoC projects are also well known for their long simulation times. By running

tests on hardware and only analyzing results in MATLAB, regression tests times can

be significantly reduced.

Page 24: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

24

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016

Page 25: MATLAB based Prototyping of FPGA Projects …...Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland Phone +41 43 343 39 43 – 4 MATLAB® based Prototyping of FPGA

Enclustra GmbH Technoparkstr. 1 – CH-8005 Zürich – Switzerland

Phone +41 43 343 39 43 – www.enclustra.com

25

MATLAB® based Prototyping of FPGA Projects

Embedded Computing Conference 2016

ZHAW Winterthur, May 31, 2016