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

Similar documents
Accelerating FPGA/ASIC Design and Verification

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

Design and Verification of FPGA and ASIC Applications Graham Reith MathWorks

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

VHDL for Synthesis. Course Description. Course Duration. Goals

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

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

Verilog for High Performance

Cover TBD. intel Quartus prime Design software

Effective Team Collaboration with Simulink

8. Best Practices for Incremental Compilation Partitions and Floorplan Assignments

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

Cover TBD. intel Quartus prime Design software

Team-Based Collaboration in Simulink

Applications of Program analysis in Model-Based Design

Design and Verification of FPGA Applications

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

Modeling a 4G LTE System in MATLAB

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

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

Optimize DSP Designs and Code using Fixed-Point Designer

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

A Matlab/Simulink Simulation Approach for Early Field-Programmable Gate Array Hardware Evaluation

MATLAB/Simulink in der Mechatronik So einfach geht s!

From Design to Production

What s New in Simulink in R2015b and R2016a

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

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

Introduction to C and HDL Code Generation from MATLAB

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

A Model-Based Reference Workflow for the Development of Safety-Related Software

Designing and Targeting Video Processing Subsystems for Hardware

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

Rapid Development Platform for C-Programmable DSP using MATLAB and Simulink

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

1 Design Process HOME CONTENTS INDEX. For further assistance, or call your local support center

Accelerating FASGW(H) / ANL Image Processing with Model-Based Design Issue 2

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

Copyright 2007 Society of Photo-Optical Instrumentation Engineers. This paper was published in Proceedings of SPIE (Proc. SPIE Vol.

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

Addressing Verification Bottlenecks of Fully Synthesized Processor Cores using Equivalence Checkers

Design Guidelines for Optimal Results in High-Density FPGAs

Using Model-driven Engineering Techniques for Integrated Flight Simulation Development

Model-Based Design for Video/Image Processing Applications

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

FPGA for Software Engineers

Model-Based Design: Design with Simulation in Simulink

Synthesis of Combinational and Sequential Circuits with Verilog

Abstraction Layers for Hardware Design

Digital Design and Computer Architecture

Model-Based Design for High Integrity Software Development Mike Anthony Senior Application Engineer The MathWorks, Inc.

CMPE 415 Programmable Logic Devices Introduction

Programming with HDLs

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Best Practices for Incremental Compilation Partitions and Floorplan Assignments

Enabling Performance & Stress Test throughout the Application Lifecycle

Accelerate FPGA Prototyping with

Hardware and Software Co-Design for Motor Control Applications

System Debugging Tools Overview

Choosing an Intellectual Property Core

FPGAs: High Assurance through Model Based Design

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

Floating-Point to Field-Tests: A Unified Development Environment for Algorithm Research

קורס VHDL for High Performance. VHDL

Hardware and Software Co-Design for Motor Control Applications

Laboratory Exercise 3 Comparative Analysis of Hardware and Emulation Forms of Signed 32-Bit Multiplication

9 th CA 2E/CA Plex Worldwide Developer Conference 1

HIERARCHICAL DESIGN. RTL Hardware Design by P. Chu. Chapter 13 1

Outline HIERARCHICAL DESIGN. 1. Introduction. Benefits of hierarchical design

CHAPTER 1 INTRODUCTION

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Leveraging Formal Verification Throughout the Entire Design Cycle

Overview. Design flow. Principles of logic synthesis. Logic Synthesis with the common tools. Conclusions

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

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

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

Chapter 5: ASICs Vs. PLDs

Verification, Validation, and Test with Model-Based Design

Data Virtualization Implementation Methodology and Best Practices

EE 4755 Digital Design Using Hardware Description Languages

Rapid Software Testing Guide to Making Good Bug Reports

Achieving the Science DMZ

Designing and Analysing Power Electronics Systems Using Simscape and SimPowerSystems

Chapter 3. HDL Editor. Introduction. Figure 3-1. HDL Editor Welcome Screen. Introduction 3-1

Computer Systems Assignment 4: Scheduling and I/O

Implementation and Verification Daniel MARTINS Application Engineer MathWorks

Contemporary Design. Traditional Hardware Design. Traditional Hardware Design. HDL Based Hardware Design User Inputs. Requirements.

Guidelines for deployment of MathWorks R2010a toolset within a DO-178B-compliant process

Basic Xilinx Design Capture. Objectives. After completing this module, you will be able to:

What s New in MATLAB and Simulink Prashant Rao Technical Manager MathWorks India

Xilinx Vivado/SDK Tutorial

2015 The MathWorks, Inc. 1

Making the Most of your MATLAB Models to Improve Verification

Final Presentation AUTOCOGEQ GMV, 2017 Property of GMV All rights reserved UNCLASSIFIED INFORMATION

Introduction to Control Systems Design

MODEL BASED HARDWARE DESIGN WITH SIMULINK HDL CODER

What s New in Simulink Release R2016a and R2016b

Sunburst Design - Comprehensive SystemVerilog Design & Synthesis by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc.

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

Transcription:

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

sensor interfaces external memory controller 2 / Context Image and signal processing in firmware Is complex! Requires significant algorithm re-structuring Conversion from frame-based to serialised architecture Considerable data throughput High data rates High resolution sensors Multiple sensor feeds processed by one device Parallel processing chains Memory intensive line & frame buffers Fixed-point considerations Requires supporting infrastructure Sensor interfaces External memory controller / interface Communication peripherals A System-On-Chip design philosophy infrastructure firmw are memory controller client memory controller client memory controller client memory controller client algorithm modules verification ports PBIT Comms HUMS

3 / Rationale for adopting HDL auto-coding Traditional Workflow Algorithm specifications are passed to F/W developers at onset and this may be the only juncture of information exchange Communication can be ad hoc with no process steps to enforce review Can lead to functional divergence between specification and implementation Algorithm developers are often not involved after the specification is defined Regardless of the suitability for FPGA deployment Quality of verification relies on F/W developers comprehension of the algorithm Co-simulation can trap differences, but is dependant on the quality of the test vectors and how lengthy the time is to execute the simulation It is difficult for F/W developers to determine the functional correctness of low level units Algorithm bug fixes / updates are only applied to the F/W This decouples the implementation from the specification Another source of divergence Compromises traceability to specification Estimating process can be difficult It is often difficult for F/W developers to estimate the implementation effort for complex algorithms

HDL Coder based workflow

5 / Algorithm Specification Algorithm specification is fundamental Specification consists of Algorithm Description Document (functionality & rationale) Executable Reference Specification (MATLAB / C++) Test vectors / expected outputs Should be explicit and detailed Modifications to the specification must be handled formally Must be reviewed from a firmware/hardware implementation perspective Challenge the specification if it seems excessive / unnecessary! The interaction between the algorithm and infrastructure firmware is critical The processing timeline and clocking scheme must be designed to meet the requirements of algorithms, infrastructure and the targeted device Interface definitions Memory access patterns must be considered Careful consideration must be given to partitioning of functionality Algorithmic functionality between FPGA and other processors Not all algorithmic operations are well suited to firmware Between algorithms firmware and infrastructure firmware

6 / A development & verification process Algorithm implementation stages Process breakdown (effort) Code-generation Requirements Capture Implementation Workflow Breakdown Verification Implementation Verification Requirements Code generation Detailed development & verification process

7 / Algorithm implementation process stages

8 / Detailed development & verification process

9 / Approximate relative effort Code-generation Requirements Capture Workflow Breakdown Implementation Implementation Verification Requirements Code generation Verification

10 / The people Collaboration between engineering disciplines is critical This process requires a combination of Algorithms, Firmware/Electronics and Systems Engineering expertise and resource Effective communication is key to success Establish a common language Partition tasks appropriately (play to existing strengths while developing capability) The diagram below outlines a typical breakdown of effort between engineering disciplines Effort contribution Architectural design FW ALG SYS Algorithm implementation FW ALG Algorithm verification ALG S Y S HDL generation FW ALG Integration with design Verification on target FW FW ALG A S L Y GS S Y S The importance of firmware domain expert consultancy through the process cannot be overestimated!

The Tools

12 / HDL Coder Generates VHDL (or Verilog) from Simulink (and/or MATLAB) Algorithms are expressed at a similar level as in hand-coded VHDL from library blocks Arithmetic, logical and relational operators Counters, registers, shift-register, RAM blocks Allows maintenance of IP in the modelling domain MATLAB / Simulink integration MATLAB function blocks can be used inside Simulink It is often easier or more intuitive to express logic using M-code Care must be taken regarding coding style to ensure efficient generated HDL! Code generation is a small automatic part of an otherwise manual process Various tools in MATLAB/Simulink can help with other stages Fixed-Point Advisor Verification/debug blocks excluded from code-generation Integrates well with external firmware tools to streamline synthesis and resource/timing analysis This is very helpful and encourages users to synthesise generated code on a module-bymodule basis

13 / HDL Verifier HDL Verifier is a key component of our verification workflow Modelsim co-simulation Generates a co-simulation model and all of the scripts required to coordinate simulation of autogenerated HDL in an external simulator Co-simulation is a critical component in our workflow Verifies the generated HDL against the Simulink implementation FPGA-in-the-loop Can accelerate throughput of test cases by hardware acceleration Though performance is limited by any co-simulation in Simulink Capability limited by interface considerations Limited support for current Ethernet protocols (restricts FPGA board selection) Successfully used to deploy algorithmic modules to hardware for confidence testing Black-boxing existing VHDL Allows hand-coded VHDL to be integrated with Simulink models for code generation A behavioural model is created in Simulink, but no code is generated for the black-box R2013a has poor support for VHDL Generic lists (requiring workaround)

Case studies

15 / Sorting algorithms In-place bubble sort A timing bottleneck was alleviated by changing the output behaviour of the algorithm (see diagrams) The selectable output was replaced by shift-register like behaviour outputting from only one register This removed a large multiplexer simplifying routing Very rapid turnaround for this modification Analyse the output of synthesis tools and optimise the model accordingly Parallel bubble sort A pipelined parallel bubble sort was implemented using HDL Coder and compared with an optimised hand-coded VHDL implementation The post-synthesis resource utilisations were identical No bloat was introduced by auto-coding process While this is a simple algorithm it is an encouraging result! t ODD select Sorting Registers t EVEN 8 6 6 4 1 0 0 MUX staging register Sorting Registers sort t ODD t EVEN complete fixed output 8 6 6 4 1 0 0 selectable output staging register

16 / Sensitivity to MATLAB coding style Coding style is key to efficient HDL Persistent variables must be initialised with if (isempty( )) This is a compile-time operation, there should be no trace of this in the schematic If this isempty( ) is logically OR d with a signal as shown in the 1st listing an extra register and logic gate are produced Ensuring that state initialisation is separate from algorithmic reset logic avoids this extra logic Otherwise, the code listings below are functionally equivalent Over a large design this may result in a significant resource saving Extra register Extra logic gate

Our experiences

18 / General observations Expectation management Auto-coders will not generally be as efficient as hand-coded optimised implementations They aim to improve the development process, not the efficiency of the HDL Some are quick to judge workflows of this sort without sufficient understanding of the process Adopting this workflow is enabling, but disruptive Enables Algorithms / Systems Engineers to contribute to algorithm deployment more effectively Enables larger more complex algorithmic systems to be deployed on FPGA May change the focus of Firmware Engineers effort This process moves a complex subset of hardware design into modelling domain Simulink / HDL Coder tools are permissive Care must be taken to avoid overly naïve modelling of algorithm constructs This is the responsibility of the modeller not the tools! Generated HDL is neat and well structured There is a steep learning curve due to the number of process steps and tools involved Don t expect massive improvements in delivery time on the first attempt!

19 / HDL Coder workflow benefits Graphical design entry in Simulink Helps visualise the processing architecture Integrates well with existing firmware design tools Simplifies obtaining resource and timing estimates Facilitates monitoring and early reporting of device utilisation Complements existing traditional Firmware design workflow The generated VHDL integrates well with hand-coded firmware There is no need for an all or nothing approach to HDL autocoding! Rapid turnaround on minor design iterations A rich suite of verification & visualisation modules are available Developers can easily create and integrate bespoke debugging tools for simulation I.e. frame synchronous image displays, RAM content monitors, data logging etc. Enables more task-parallelism in Firmware development Algorithm Engineers can focus on algorithm implementation while Firmware Engineers concentrate on architecture design, sensor & memory interfaces, data management etc. Remember that Firmware consultancy / supervision is required throughout the process

20 / Limitations of HDL Coder (Alg Eng/User perspective) MATLAB to HDL workflow is less mature and stable than Simulink to HDL We tried this flow for various algorithms and encountered several failures Error messages frequently fail to reach user in large complex models Sometimes errors such as Code generation failed due to above error would be shown in dialog windows Generating code on a module-by-module basis minimised these occurrences but became tedious and time-consuming Could a verbose text log file be provided in the event of failure / crash? Launching external firmware tool processes freezes Simulink Can we tell HDL Workflow Advisor that we have performed synthesis etc. externally? Some instabilities in recent releases (R2012b, R2013a) Opening documentation frequently closes Simulink Support for reusing library subsystems is a little clunky MATLAB & Simulink do this well but there are limitations for code-generation Support for Simulink buses and matrices is limited (particularly on interfaces) Standard maths functions are code-gen compatible, but perform poorly We were unable to distribute registers through division & square-root operations and black-boxed existing VHDL IP Occasionally fails to recognise equivalent data types Boolean / ufix1, uint8 / ufix8 Documentation for some HDL Coder options/settings is a little sparse

21 / HDL Coder limitations (Firmware Eng perspective) Hidden hardware signals (clock_enable & reset) Don t appear in Simulink model and control of them is minimal Prevents some optimisation techniques which would be implemented by hand Often become heavily loaded resulting in timing bottlenecks Generated code is very sensitive to coding style Great care is required in MATLAB function blocks (in Simulink) It is important to understand the implications of various coding constructs for HDL generation Default behaviour for registers is to include a reset pin This is not clear from the Simulink model (see first bullet) Can prevent SRLC s being inferred for shift registers in the FW tools resulting in increased resource utilisation No obvious warnings are provided when accidentally including non-synthesisable elements in a model Forgetting to change the data type of a constant from double can waste quite a bit of time! It isn t currently possible to attach VHDL attributes to signals This complicates optimisations such as signal preservation No clear way to preset contents of RAM modules

22 / Conclusion Auto-coding automates one part of a complex process This should be viewed as a development & verification process not a big red button! Our experience has been quite positive overall However we still have much to learn We have never had any issues with the functional correctness of the generated VHDL Algorithms considered are complex image and signal processing functions Our design iterations were typically driven by timing and/or area optimisation Significant investment is required to become productive The correct mix of complimentary skills are key Initially this workflow should be used as complimentary to existing development processes It takes time to become familiar with the nuances of HDL Coder to avoid common pitfalls We used Mathworks consultancy throughout our ramp-up phase It was very useful but the cost should be factored in to the decision to adopt these tools Communication between Algorithms and Firmware Engineers has been improved by this workflow This has effectively been accomplished by hybrid engineers acting as conduits between Algorithms and Firmware teams