About HDL CODER and simulink

1 view (last 30 days)
Prashanth n
Prashanth n on 30 Mar 2016
Commented: Prashanth Nayak on 3 Apr 2016
I am doing modelling of DC motor using basic blocks in MATLAB 2015. after modelling i tried to convert this simulink file to VHDL code using HDL coder but it giving error stating that integrator blocks cannot be converted and model contains some algebraic blocks which is also not possible to convert to VHDL code. I have attached my simulink model and M file. Please help me in solving this problem.
Thank you in advance
  1 Comment
Walter Roberson
Walter Roberson on 30 Mar 2016
You need to delete the lines
clear all;
clc;close all
You might be having other difficulty as well.

Sign in to comment.

Answers (1)

Tim McBrayer
Tim McBrayer on 30 Mar 2016
Edited: Tim McBrayer on 30 Mar 2016
HDL Coder does not work with blocks that require continuous time. This makes sense, as the targeted hardware operates in discrete time, controlled via clocks. So, you can not use the Continuous Integrator block as the error message says. The same logic holds for your use of the (continuous time) Transfer Function blocks. The HDL code generation report explicitly calls out all the unsupported blocks to you.
You need to replace your usage of these continuous time blocks with their discrete time counterparts; namely, the Discrete Time Integrator and the Discrete Transfer Function blocks.
You will also need to remodel your use of the unsupported Step blocks. Decide if these are part of the model or part of the testbench, and locate them accordingly. If they are part of the design they could be remodeled with a constant and a Delay block. The Scope block will be ignored by HDL Coder, but it should be pulled out of the design and into a test bench.
After all this, you may need to work with the data types. Your entire model currently uses MATLAB's default double data type, which in general is not supported for HDL synthesis. HDL Coder can generate code using doubles; you just won't be able to realize the design on a FPGA. You will need to understand your design's numeric accuracy requirements and convert it to use fixed point types. The Simulink Fixed-Point Tool can help you with this conversion.
  1 Comment
Prashanth Nayak
Prashanth Nayak on 3 Apr 2016
Thank you so much for the reply. I will try with that

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!