Model-Based Design Using Simulink, HDL Coder, and DSP Builder for Intel FPGAs By Kiran Kintali, Yongfeng Gu, and Eric Cigan

Similar documents
Accelerating FPGA/ASIC Design and Verification

Implementing MATLAB Algorithms in FPGAs and ASICs By Alexander Schreiber Senior Application Engineer MathWorks

Cover TBD. intel Quartus prime Design software

Cover TBD. intel Quartus prime Design software

Model-Based Design for Video/Image Processing Applications

Introduction to C and HDL Code Generation from MATLAB

Connecting MATLAB & Simulink with your SystemVerilog Workflow for Functional Verification

DSP Builder Handbook Volume 1: Introduction to DSP Builder

Accelerate FPGA Prototyping with

Modeling a 4G LTE System in MATLAB

Model-Based Design for effective HW/SW Co-Design Alexander Schreiber Senior Application Engineer MathWorks, Germany

Hardware Implementation and Verification by Model-Based Design Workflow - Communication Models to FPGA-based Radio

Designing and Prototyping Digital Systems on SoC FPGA The MathWorks, Inc. 1

Model-Based Design for Altera FPGAs Using HDL Code Generation The MathWorks, Inc. 1

Integrated Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC

DSP Builder Handbook Volume 1: Introduction to DSP Builder

Case Study on DiaHDL: A Web-based Electronic Design Automation Tool for Education Purpose

Design and Verification of FPGA and ASIC Applications Graham Reith MathWorks

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Hardware-Software Co-Design and Prototyping on SoC FPGAs Puneet Kumar Prateek Sikka Application Engineering Team

DSP Builder Release Notes and Errata

Design and Verification of FPGA Applications

[Sub Track 1-3] FPGA/ASIC 을타겟으로한알고리즘의효율적인생성방법및신기능소개

DSP Builder Release Notes and Errata

MODEL BASED HARDWARE DESIGN WITH SIMULINK HDL CODER

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Four Best Practices for Prototyping MATLAB and Simulink Algorithms on FPGAs by Stephan van Beek, Sudhir Sharma, and Sudeepa Prakash, MathWorks

Optimize DSP Designs and Code using Fixed-Point Designer

Moving MATLAB Algorithms into Complete Designs with Fixed-Point Simulation and Code Generation

MATLAB/Simulink 기반의프로그래머블 SoC 설계및검증

What's new in MATLAB and Simulink for Model-Based Design

Intro to System Generator. Objectives. After completing this module, you will be able to:

Reducing the cost of FPGA/ASIC Verification with MATLAB and Simulink

VHDL Essentials Simulation & Synthesis

Quartus II Prime Foundation

Making the Most of your MATLAB Models to Improve Verification

Model-Based Design: Generating Embedded Code for Prototyping or Production

DSP Builder Release Notes and Errata

DSP Builder User Guide

DSP Builder Release Notes and Errata

DSP Design Flow User Guide

Hardware and Software Co-Design for Motor Control Applications

Implementation and Verification Daniel MARTINS Application Engineer MathWorks

Agenda. Introduction FPGA DSP platforms Design challenges New programming models for FPGAs

Introduction to the Qsys System Integration Tool

A SIMULINK-TO-FPGA MULTI-RATE HIERARCHICAL FIR FILTER DESIGN

Introducing Simulink R2012b for Signal Processing & Communications Graham Reith Senior Team Leader, UK Application Engineering

FFT MegaCore Function User Guide

System Requirements & Platform Availability by Product for R2016b

Tutorial - Using Xilinx System Generator 14.6 for Co-Simulation on Digilent NEXYS3 (Spartan-6) Board

Simulink Matlab To Vhdl Route For Full Custom Fpga Rapid

University of Massachusetts Amherst Department of Electrical & Computer Engineering

Spartan -6 LX150T Development Kit Hardware Co-Simulation Reference Design User Guide

Spartan -6 LX150T Development Kit Hardware Co-Simulation Reference Design Tutorial

Designing and Targeting Video Processing Subsystems for Hardware

FFT MegaCore Function User Guide

Hardware and Software Co-Design for Motor Control Applications

Targeting Motor Control Algorithms to System-on-Chip Devices

Method We follow- How to Get Entry Pass in SEMICODUCTOR Industries for 3rd year engineering. Winter/Summer Training

Model to Code, Made Simple and Easy Sebastien Dupertuis Application Engineer Applications Engineering Group MathWorks Switzerland June 11, 2015

FFT MegaCore Function User Guide

Intel HLS Compiler: Fast Design, Coding, and Hardware

Synphony Model Compiler Release Notes Version F M Actel Edition, March Contents

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point FFT Simulation

Modeling and Verifying Mixed-Signal Designs with MATLAB and Simulink

Introducing Simulink Release 2012b for Control System Development Mark Walker MathWorks

Intel Quartus Prime Pro Edition Software and Device Support Release Notes

Codegenerierung für Embedded Systeme leicht gemacht So geht s!

FPGA for Software Engineers

NEW FPGA DESIGN AND VERIFICATION TECHNIQUES MICHAL HUSEJKO IT-PES-ES

Modeling HDL components for FPGAs in control applications

Extending Model-Based Design for HW/SW Design and Verification in MPSoCs Jim Tung MathWorks Fellow

AN 839: Design Block Reuse Tutorial

What s New with the MATLAB and Simulink Product Families. Marta Wilczkowiak & Coorous Mohtadi Application Engineering Group

Automatic Code Generation Technology Adoption Lessons Learned from Commercial Vehicle Case Studies

Synphony Model Compiler Release Notes Version H , March Contents

An Independent Analysis of Floating-point DSP Design Flow and Performance on Altera 28-nm FPGAs. Berkeley Design Technology, Inc.

Using HDL Coder for Complex Algorithm Deployment Steve Hamilton, James Hui & Ian Brown

DSP Builder. DSP Builder v6.1 Issues. Error When Directory Pathname is a Network UNC Path

Reuse MATLAB Functions and Simulink Models in UVM Environments with Automatic SystemVerilog DPI Component Generation

8. Best Practices for Incremental Compilation Partitions and Floorplan Assignments

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point FFT Simulation

Vivado Design Suite User Guide

CORDIC Reference Design. Introduction. Background

Applications of Program analysis in Model-Based Design

Designing and Analysing Power Electronics Systems Using Simscape and SimPowerSystems

FIR Compiler User Guide

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point Fast Fourier Transform Simulation

Chapter 5. Hardware Software co-simulation

AccelDSP tutorial 2 (Matlab.m to HDL for Xilinx) Ronak Gandhi Syracuse University Fall

AES1. Ultra-Compact Advanced Encryption Standard Core AES1. General Description. Base Core Features. Symbol. Applications

DSP Flow for SmartFusion2 and IGLOO2 Devices - Libero SoC v11.6 TU0312 Quickstart and Design Tutorial

Using Model-Based Design to Accelerate FPGA Development for Automotive Applications

Addressing Fixed Point Design Challenges

What s New in Simulink in R2015b and R2016a

Intel Arria 10 Native Floating- Point DSP Intel FPGA IP User Guide

AL8253 Core Application Note

DSP Design Flow User Guide

SerialLite III Streaming IP Core Design Example User Guide for Intel Arria 10 Devices

Introduction to DSP/FPGA Programming Using MATLAB Simulink

Transcription:

Model-Based Design Using Simulink, HDL Coder, and DSP Builder for Intel FPGAs By Kiran Kintali, Yongfeng Gu, and Eric Cigan WHITE PAPER

Summary This document describes how HDL Coder from MathWorks can be used with DSP Builder for Intel FPGAs in an integrated FPGA workflow. We use an example to show how designers can integrate models built with DSP Builder Advanced Blockset into a Simulink model, and how HDL Coder can generate HDL code for the complete design. This capability allows designers to reuse existing DSP Builder models when using HDL Coder to create new designs, or to incorporate target-optimized Intel FPGA IP blocks created for use with HDL Coder within Simulink models. Introduction MATLAB and Simulink for Model-Based Design provide signal, image, and video processing engineers with a development platform that spans design, modeling, simulation, code generation, and implementation. Engineers who use Model-Based Design to target FPGAs or ASICs can design and simulate systems with MATLAB, Simulink, and Stateflow and then generate bit-true, cycle-accurate, synthesizable Verilog and VHDL code using HDL Coder. Alternatively, engineers who specifically target Intel FPGAs can use DSP Builder for Intel FPGAs, a plug-in to Simulink, to generate synthesizable hardware description language (HDL) code mapped to pre-optimized Intel FPGA implementations. DSP Builder includes the Advanced Blockset, a high-level synthesis technology that optimizes the high-level, untimed netlists into low-level, pipelined hardware for the target Intel FPGA device and desired clock rate. Some projects benefit from implementing a workflow that combines the native Simulink workflow, device-independent code, and code readability offered by HDL Coder, with Intel-specific features and optimizations offered by DSP Builder Advanced Blockset. 1 This paper describes a new workflow for designs that are created with blocks from both Simulink and DSP Builder Advanced Blockset. 2 Prior experience with MATLAB, Simulink, and DSP Builder will help you make the most of the examples in this paper. Required Software The models described in this paper are from the example included with HDL Coder, Using Altera DSP Builder Advanced Blockset with HDL Coder. Simulation and code generation from the model have been tested with the following versions of the software: MATLAB (R2013b or later) 3 Simulink HDL Coder (requires MATLAB Coder and Fixed-Point Designer ) Intel FPGA DSP Builder for Intel FPGAs (version 13.0sp1 or later) 1 For a summary of the features of HDL Coder and Intel DSP Builder Advanced Blockset, see appendix. 2 This integrated workflow is limited to models built with the DSP Builder Advanced Blockset. Models built using the Standard Blockset of DSP Builder for Intel FPGAs are not supported in this workflow. All subsequent references to DSP Builder (DSPB) subsystems describe models built from the DSP Builder Advanced Blockset. 3 For the latest information, consult HDL Coder documentation, Create an Altera DSP Builder Subsystem. WHITE PAPER 2

To simulate, synthesize, and implement HDL code generated from the model, the following software is also required: Intel Quartus Prime (version 13.0sp1 or later) Setting Up the MATLAB Environment for HDL Code Generation and DSP Builder Advanced Blockset Integration Before you can begin working on your model, you need to ensure that the MATLAB environment is aware of DSP Builder and that DSP Builder is configured to work with MATLAB. To start DSP Builder, follow one of these steps (see DSP Builder for Intel FPGAs Handbook Volume 1: Introduction to DSP Builder for more details): From Microsoft Windows, click Start, point to All Programs, click Intel FPGA<version>, click DSP Builder, and click Start in MATLAB<version>. If you have multiple versions of MATLAB installed, you can start DSP Builder in your desired version from this menu. On Linux OS, use the following command, which automatically finds MATLAB: <path to the Quartus II software>/dsp _ builder/dsp _ builder.sh> You can use the following options after the dsp _ builder.sh command: m <path to MATLAB> to specify another MATLAB path glnx86 to run 32-bit DSP Builder Your MATLAB environment also needs to be made aware of the Quartus II installation. This is accomplished through the hdlsetuptoolpath command in MATLAB. The command below shows the typical path for a Windows PC Quartus II installation. >> hdlsetuptoolpath( ToolName, Intel FPGA Quartus II, ToolPath, C:\intelfpga\13.0sp1\quartus\bin64\quartus.exe ); Note that hdlsetuptoolpath changes the system path and system environment variables for the current MATLAB session only. To execute the hdlsetuptoolpath command automatically when MATLAB starts, add it to your startup.m script. Example: Design with Blocks from Simulink and DSP Builder Advanced Blockset The example model (hdlcoder _ sldspba.slx) performs FIR filtering. The top level of the design contains two subsystems, one implemented with blocks from the DSP Builder Advanced Blockset, and the other with native Simulink blocks (Figure 1). Because they are designed for synthesis on Intel FPGAs, Intel FPGA blocks will yield an optimized implementation of this FIR filter on an Intel FPGA. The Simulink subsystem contains a Stateflow block and a MATLAB function block, which provide flexibility in modeling complex control algorithms. Users can also explore various optimizations on the Simulink subsystem through HDL Coder. WHITE PAPER 3

Figure 1. Simulink model of an FIR system (hdlcoder_sldspba.slx). WHITE PAPER 4

Preparing a Model for HDL Code Generation In a typical development workflow, engineers model and simulate a design in Simulink, completing multiple iterations to identify and eliminate design problems in preparation for implementation. Before using HDL Coder and DSP Builder Advanced Blockset to generate code, you must prepare the model by: Creating a DSP Builder (DSPB) subsystem Setting code generation options for DSPB subsystems Setting code generation options for HDL Coder Creating a DSPB Subsystem To create a DSPB subsystem: 1. Put all the DSP Builder blocks in one subsystem. (Note: In general, HDL Coder supports the use of multiple DSPB subsystems provided that all DSP Builder blocks must be contained in DSPB subsystems; this example, however, demonstrates use of a single DSPB subsystem.) 2. Ensure the subsystem s Architecture parameter is set to Module (the default value). See the Code Generation Options for HDL Coder section (page 8) for more on this setting. 3. Place a Device block at the top level of the subsystem. You can have subsystem hierarchy in a DSPB subsystem, but there must be a Device block at the top level of the hierarchy. 4. Place a Control block and a Signals block at the top level of the model. You can use the following MATLAB command to open the DSPB subsystem in the example model (Figure 2). >> open _ system( hdlcoder _ sldspba/slanddspba/dspba Subsystem ); WHITE PAPER 5

Figure 2. The image processing system s DSPB subsystem. Setting Code Generation Options for DSP Builder HDL Coder supports DSP Builder code generation with the following settings only: Device block (Figure 3): The same Device must be chosen by all Device blocks and by HDL Coder if applicable. Control block (Figure 4): Generate Hardware must be checked. Create Automatic Testbenches must be unchecked. Signals block (Figure 5): Reset Active must be same the setting in HDL Coder. You do not need to configure these settings yourself. HDL Coder will modify and restore these settings on the DSP Builder blocks during code generation. WHITE PAPER 6

Figure 3. Options for the DSPB Device block. Figure 4. Options for the DSPB Control block. Figure 5. Options for the DSPB Signals block. WHITE PAPER 7

Setting Code Generation Options for HDL Coder In addition to the settings described above for HDL code generation, HDL Coder requires the Architecture parameter of DSPB subsystems to be set to Module (Figure 6). If code generation is performed with HDL Workflow Advisor, the device settings for Workflow Advisor and DSPB Device blocks must be identical, as shown in Figures 3 and 7. Figure 6. DSPB subsystem implementation parameters in HDL Coder. Figure 7. Tool and device options in HDL Workflow Advisor. Generating HDL You can generate HDL code from the configured model with the command line interface or with the GUI, as with any other model. For this example model, the command to generate code is: >> makehdl( hdlcoder _ sldspba/slanddspba ) WHITE PAPER 8

Refer to the HDL Code Generation from a Simulink Model tutorial provided with HDL Coder for details on how to generate code using the GUI. Generating HDL Test Bench and Simulation Scripts For this example model, the command to generate test bench and simulation scripts is: >> makehdltb( hdlcoder _ slsysgen/slandsysgen ); Handling Simulation Mismatch When Valid Signal Not Asserted The DSPB subsystem simulation may not match its generated code s behavior when the valid signal is not asserted under certain circumstances, such as when the design employs the folding optimization and/or floating-point support. You may observe such mismatches by turning on the Folding option in both hdlcoder _ sldspba/slanddspba/dspba Subsystem/ChannelIn and hdlcoder _ sldspba/slanddspba/dspba Subsystem/ChannelOut. The mismatch affects the downstream Simulink design and causes a test bench simulation failure. To see the mismatch, you can turn on the folding setting for the ChannelIn and ChannelOut blocks: >> set _ param( hdlcoder _ sldspba/slanddspba/dspba Subsystem/ChannelIn, Fold i ngen a ble d, 1); >> set _ param( hdlcoder _ sldspba/slanddspba/dspba Subsystem/ChannelOut, Fold i ngen a ble d, 1); Then, generate the HDL code and test bench again: >> makehdl( hdlcoder _ sldspba/slanddspba ); >> makehdltb( hdlcoder _ sldspba/slanddspba ); After simulating the generated code and test bench, you can see that the outputs from HDL Coder match the reference data only when the valid signal is asserted as shown in Figure 8. Figure 8. Simulation mismatch when valid signal not asserted. WHITE PAPER 9

As the message from the test bench indicates, the mismatch is expected. To avoid this simulation mismatch, insert an enabled subsystem at the DSPB subsystem output signals, before they reach the Simulink part of your design or the output ports of the overall design. Figure 9 shows how to connect signals to the enabled subsystem. >> open _ system( hdlcoder _ sldspba/slanddspba2 ); Figure 9. Use of enabled subsystem with DSPB subsystem to avoid mismatch when valid not asserted. Further Reading For more HDL Coder videos and examples, visit mathworks.com/products/hdl-coder/examples.html. WHITE PAPER 1 0

Appendix: Feature Comparison of HDL Coder and DSP Builder for Intel FPGAs Advanced Blockset The table below summarizes the complementary features and benefits of HDL Coder and DSP Builder Advanced Blockset. Used independently, each approach provides an effective FPGA design flow. Feature Software and hardware code generation HDL Coder X DSP Builder Advanced Blockset Benefit Partition algorithms between processors and hardware Access to Simulink block library X Rapidly assemble system models using existing blocks Support for native Simulink blocks X Easily migrate system model to hardware Floating- to fixed-point conversion X Shorten design cycles Design exploration X X Rapidly explore hardware solution space Automatic test bench generation X X Verify hardware against system models Transaction-Level Model (TLM) component generation X Use system-level modeling methodologies Hardware cosimulation X X Verify hardware implementations on Intel FPGA development boards MATLAB to HDL code generation and hardware cosimulation X Follow a hardware design workflow without using Simulink Readable, traceable HDL code X Streamline standards compliance and reporting Access Intel FPGA IP in Simulink X (when used with DSP Builder) X Generate implementations optimized for Intel FPGA targets Analog data acquisition X Verify algorithms with real-world analog data Hardware deployment X X Deploy designs in hardware without FPGA design experience 2014 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. WHITE PAPER 1 1 92161v00 02/14