File Exchange

image thumbnail

HDL Coder Self-Guided Tutorial

version 1.3 (2.02 MB) by Jack Erickson
Learn how to deploy an algorithm to an FPGA using MATLAB and Simulink.

135 Downloads

Updated 14 Feb 2020

GitHub view license on GitHub

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This tutorial will guide you through the steps necessary to implement a MATLAB algorithm in FPGA hardware, including:
* Create a streaming version of the algorithm using Simulink
* Implement the hardware architecture
* Convert the design to fixed-point
* Generate and synthesize the HDL code

Cite As

Jack Erickson (2020). HDL Coder Self-Guided Tutorial (https://www.github.com/mathworks/HDL-Coder-Self-Guided-Tutorial), GitHub. Retrieved .

Comments and Ratings (17)

Curie Chung

Hi Jose - You can now download the R2018b tutorial files from GitHub:
https://github.com/mathworks/HDL-Coder-Self-Guided-Tutorial/releases

Hi Gill - Are you using R2018b or R2019b? The error is not expected for R2019b, even though the instructions have not been updated. Please feel free to contact us if you need further assistance.

Curie Chung

Hi Gill - Are you using R2018b or R2019b? The error is not expected for R2019b, even though the instructions have not been updated. Please feel free to contact us if you need further assistance.

I am using R2019b and have the same error posted by Jose Caballero on 7 Jan 2020. I have downloaded the 14Feb2020 version from Github but still get the error reported about dot indexing not supported for this data type (line 11).
Was there a fix and I missed it? Thanks for any help on this.

Ryan Bosley

Excellent intro to using Simulink/HDL Coder for signal processing!
Thanks for posting!!

Hi, is there any way to easily adapt this tutorial to R2018b? I am trying to run the testbench at step 7 and get the error:

Warning: Unconnected output line found on 'pulse_detector_v1/Discrete FIR Filter' (output port: 1)
> In pulse_detector_v1_tb (line 8)
Dot indexing is not supported for variables of this type.

Error in pulse_detector_v1_tb (line 11)
FilterOutSL = squeeze(slout.logsout.getElement('filter_out').Values.Data);

Jing Ma

Jack Erickson

Hi Suranga - thanks for pointing that out. In 2019a Simulink changed the way it names the simulation workspace data. We have updated the kit for 2019a.

The example doesn't work with 2019a. I get the error "Undefined variable "logsout" or class "logsout.getElement"" when trying to run the model.

Figured out the answer to my own question - posting in case some one else makes the same mistake. I used the first simulink "from workspace" I saw. That block , from a comment in this link https://uk.mathworks.com/matlabcentral/answers/359452-error-input-uint8-simulink "From Workspace blocks are not able to import "just plain data". From Workspace blocks are intended to deliver data at a particular time: they are blocks for execution of a model, where as importing plain data is something that would be used in a procedural language.”".

As it turns out there are two simulink from workspace block. One specifies “signal from workspace” and can be used to import “just plain data”.

Summarily, make sure to use "signal from workspace". You'll get an error otherwise.

Eric Cigan

Eric Cigan

Very helpful step-by-step guide for users new to HDL Coder.

Updates

1.3

Moved to GitHub repository

1.2

Updated for R2019a

1.1.1

Minor edits to two slides

1.1.0

Updated for R2018b

MATLAB Release Compatibility
Created with R2018a
Compatible with R2018a to R2018b
Platform Compatibility
Windows macOS Linux

pulse_detector/work