HDL Coder Workshop R2015b
HDL Coder Workshop R2015b
What to do?
Agenda
09:00
Who is Who?
Before we start
c:\class\coursefiles\hdl03
(and the handouts on your desk)
Things to remember .
Agenda
09:00
10
11
FPGA Designer
Algorithm Design
RTL Design
Verification
Fixed-Point
Environment Models
IP Interfaces
Behavioral Simulation
Analog Models
HW Architecture
Functional Simulation
Architecture Exploration
Digital Models
Algorithms / IP
Algorithms / IP
Timing Simulation
Implement Design
FPGA Requirements
Hardware Specification
Test Stimulus
Back Annotation
Synthesis
Map
Place & Route
FPGA Hardware
12
FPGA Designer
Algorithm Design
RTL Design
Verification
Fixed-Point
Environment Models
IP Interfaces
Behavioral Simulation
Analog Models
HW Architecture
Functional Simulation
Architecture Exploration
Digital Models
Algorithms / IP
Algorithms / IP
Timing Simulation
Implement Design
FPGA Requirements
Hardware Specification
Test Stimulus
Back Annotation
Synthesis
Map
Place & Route
FPGA Hardware
13
Automatic HDL
Code Generation
HDL Co-Simulation
Behavioral Simulation
Back Annotation
Implement Design
Synthesis
Map
Place & Route
Verification
Functional Simulation
Static Timing Analysis
Timing Simulation
FPGA Hardware
FPGA-in-the-Loop
14
Automatic HDL
Code Generation
HDL Co-Simulation
Model-Based Design
Behavioral Simulation
Back Annotation
Implement Design
Synthesis
Map
Place & Route
Verification
Functional Simulation
Static Timing Analysis
Timing Simulation
FPGA Hardware
FPGA-in-the-Loop
15
Example
16
17
18
Microcontroller
19
FPGA
Corner
Detection
Microcontroller
20
21
22
Test Bench
23
Test Bench
24
Simulation
Behavioral
Simulation
Stand Alone
Prototype
25
Algorithms to HDL?
26
1.
2.
MATLAB to HDL
Simulink to HDL
(with MATLAB and Stateflow)
1
3.
Hybrid workflow
3
Agenda
09:00
28
MATLAB at a glance
Exercise
29
Exercise
30
31
MATLAB to HDL
The big challenges
MATLAB
HDL
Floating point
Procedural
Matrices
Algorithm Land
Architecture Land
Fixed-Point
Concurrent + optimized
Block RAMs
Untimed
Loops
Streaming, Unrolling
Functions
System objects
Hardware-efficient
implementations
32
MATLAB to HDL
Workflow
MATLAB Algorithm and System Design
Model Refinement for Hardware
Iterative
Refinement
using
Fixed-Point Advisor
HDL Simulation
Implement Design
Synthesis
Map
Place & Route
33
34
MATLAB to HDL
How do I get good results on my FPGA?
35
MATLAB to HDL
How do I get good results on my FPGA?
36
Test Bench
+
Hardware Algorithm
Example :
Hardware Algorithm
37
RAM or ROM
Constant arrays
State machines
Think like
hardware
!
38
Wires
Flip-Flops
RAM
ROM
Think about how arrays are used in the design to get the best results
39
MATLAB to HDL
How do I get good results on my FPGA?
40
42
Exercise
43
44
46
Select options:
(1) Log histogram data
(2) Show code coverage
47
49
51
Exercise
52
53
54
56
57
Agenda
09:00
59
Stimulus
MATLAB Design
Targeted to Hardware
Reference
Results
Stimulus
HDL Design
Actual
Results
60
Exercise
61
62
63
MATLAB Functions
Stimulus
Input
stimuli
Response
HDL
Entity
Output
response
Out
In
HDL Simulator
HDL Verifier
Connects HDL simulation with
the MATLAB environment!
64
67
Demo
68
Input
stimuli
MATLAB Functions
Response
Output
response
HDL Verifier
Connects FPGA HW with the
MATLAB environment!
69
Demo
70
73
MATLAB to HDL
How do I get good results on my FPGA?
74
Project creation
Synthesis
Place and Route
Reporting
Resource utilization
Timing analysis
Use loop streaming to reduce
resource utilization
75
Challenge
Accelerate the implementation of advanced thermal imaging filters and algorithms
on FPGA hardware
Solution
Use MATLAB to develop, simulate, and evaluate algorithms, and use HDL Coder
to implement the best algorithms on FPGAs
Results
Time from concept to field-testable prototype
reduced by 60%
Enhancements completed in hours, not weeks
Code reuse increased from zero to 30%
76
MATLAB to HDL
Summary
Agenda
09:00
78
1.
2.
MATLAB to HDL
Simulink to HDL
(with MATLAB and Stateflow)
1
3.
Hybrid workflow
3
Exercise
(Getting Started)
82
83
(3) Open
Simulink Library Browser
(1) Navigate to folder
06_Simulink_intro
84
Simulink/Sources
Simulink/Math Operations
Simulink/Sinks
85
Simulink/Discrete
Simulink/Math Operations
DSP System Toolbox/Transforms
DSP System Toolbox/Sinks
(7) Select
Scope Properties:
Input Domain: Frequency
Axis Properties:
Y-axis scaling: Magnitude
(5) Select
Output: Magnitude
(2) Define
Sample time: T
(3) Define
Output buffer size: L
(4) Tick
Scale result by FFT length
(6) Set
Gain: 2
86
87
Simulink to HDL
Model-Based Design for Implementation
2. Fixed-Point Conversion
3. HDL Creation
88
Simulink to HDL
Model-Based Design for Implementation
2. Fixed-Point Conversion
3. HDL Creation
89
Exercise
(Design and Simulation)
90
(3) Launch
Filter Design & Analysis Tool
91
(2) Open
Filter Manager
93
(4) Hit
Realize Model
(1) Select
Realize Model
(3) Select
Build model using basic
elements
94
95
Simulink to HDL
Model-Based Design for Implementation
2. Fixed-Point Conversion
3. HDL Creation
96
97
98
Exercise
(Fixed-Point Conversion)
99
100
(3) Select
Log signal data
101
(2) Right-click on
filter_bank_right
and select
Fixed-Point Tool
102
103
104
105
106
107
109
110
111
Simulink to HDL
Model-Based Design for Implementation
2. Fixed-Point Conversion
3. HDL Creation
112
Full bi-directional
traceability!!
113
Exercise
(Automatic HDL Code Generation)
114
115
(2) Select
HDL Coder Properties
(1) Right-click on
Equalizer_Subsystem
116
(4) Hit
Run Compatibility Checker
(5) Hit
Generate
117
(3) Right-Click and select HDL Code > Navigate to Code to follow link
from model to HDL code
118
119
NCOs, FFTs, Digital Filters (FIR, IIR, Multi-rate, Adaptive, Multichannel), Rate Changes (Up &Down Sample), Statistics
(Min/Max)
Communications Blocks
MATLAB
Relevant subset of the MATLAB language for modeling and
generating HDL implementations
Useful MATLAB Function Block
Design Patterns for HDL
Stateflow
Modeling FSMs (Mealy, Moore)
Use different modeling paradigms (Graphical Methods,
State Transition
Tables, Truth Tables)
Integrate MATLAB
121
Engineer 2
122
123
124
125
Simulink to HDL
Model-Based Design for Implementation
2. Fixed-Point Conversion
3. HDL Creation
126
127
Simulink to HDL
How do I get good results on my FPGA?
2. Speed Optimization
3. Area Optimization
128
132
Integer Delay
FFTs
133
Simulink to HDL
How do I get good results on my FPGA?
2. Speed Optimization
3. Area Optimization
134
135
Demo
136
137
138
139
140
141
142
143
144
Fixed-Point Conversion
Optimal Fixed-Point will save area and improve critical path
Pipelining
Input / Output pipeling
(Hierarchical) Distributed pipelining
Delay Balancing
145
Exercise
(Pipelining)
146
147
148
149
150
151
Simulink to HDL
How do I get good results on my FPGA?
2. Speed Optimization
3. Area Optimization
154
Goal
Area reduction
Means
Time-multiplexed re-use of
resources
Algorithms
Resource Sharing
Resource Streaming
Re-use of vectorized
operators or subsystems
155
Exercise
(Area Optimization)
156
157
158
159
160
161
163
164
165
167
=
System
+
Hardware
Software
169
170
FPGA
171
FPGA
ARM Cortex A9
172
173
174
Hardware generation
HDL Coder (VHDL and Verilog)
Software
Hardware
AXI Bus
Embedded Coder
HW IP Core
HW IP Core
ZYNQ
175
DEMO
(SoC Workflow - Zynq)
176
Challenge
Improve performance: from 50 Frames Per Second (fps) to >400 fps
Timeframe: complete project by end of 2015
Embedded software engineer heard about Zynq but never programmed FPGAs
Solution
Mathworks Model-Based Design approach for Zynq
Xilinx ZC702 development board
Results
Customer plans to release a new product to market in H1 of 2014;
a year ahead of schedule
Save costs replacing 3 processors and 3 cameras with one Zynq device
and one camera
Expects to sell > 100,000 units a year!
177
Agenda
09:00
178
1. Requirement Traceability
2. Structural Testing
3. Regression Testing
4. Rapid Prototyping
179
Full bi-directional
traceability!!
Requirements
180
Exercise
(Requirement Traceability)
181
182
184
185
1. Requirement Traceability
2. Structural Testing
3. Regression Testing
4. Rapid Prototyping
186
Missed
coverage
100%
coverage
187
188
Exercise
(100% Coverage Testing)
189
190
(1) RMB > Design Verifier > Generate Tests for Subsystem
192
193
Response
Input stimuli
Output
response
Input stimuli
Output
response
194
Exercise
(100% Code Coverage)
195
196
1. Requirement Traceability
2. Structural Testing
3. Regression Testing
4. Rapid Prototyping
198
Stimulus
Input stimuli
Response
Output
response
199
DEMO
(FPGA-in-the-Loop)
200
201
1. Requirement Traceability
2. Structural Testing
3. Regression Testing
4. Rapid Prototyping
202
Music in
Music out
Demo
203
DEMO
(FPGA Turnkey)
204
Workshop
Summary
207
Jumpstart
Services
Pilot Programs
208
23,000+ Companies
7+ Major Industries
Headquarters in Natick, MA
World-wide footprint
2,400 total staff world-wide
World-wide technical and customer support
Technology focus
30% of revenue invested in R&D
Web-based Resources
-
General Services
-
Technical Support
Training
Seminars
Workshops
Focused Services
-
Evaluations
Pilot Projects
Professional Services
210
211
212