Clear Filters
Clear Filters

HDL Workflow advisor to convert a difference equation into verilog

4 views (last 30 days)
I have a Simulink model of a DC-DC convertor (attached below). The PID block is to control the duty cycle which is modeled using Delays, Gains and Adder. Now i want to model the PID block in verilog. I need help doing it in below two ways.
1. Convert the PID block directly using the HDL Workflow advisor with fixed-point conversion of Gains and other signals 2. convert the PID block into a Matlab function block in simulink. convert the function to verilog using HDL Workflow advisor with fixed point conversion of Gains and other signals

Answers (1)

Tim McBrayer
Tim McBrayer on 21 Oct 2016
I'm not entirely sure what your question is. Both approaches are perfectly valid as input for HDL Coder and are both very well supported. Both will need conversion to fixed point data. Once you choose the appropriate data types for your arithmetic operators, to balance word size vs. precision, HDL Coder can generate your platform-independent Verilog code.
As a new feature in R2016b, HDL Coder now has Native Floating Point support. This feature generates HDL compliant with the IEEE-754 floating point standard for the single (32-bit) data type. Should you want to explore this route, the only model modification necessary would be to convert your model to use the single datatype instead of double. You will need to understand the effects that this has on your generated code as well.
  1 Comment
Anojh kumaran Rajendra
Anojh kumaran Rajendra on 21 Oct 2016
My problem is Fixed point conversion. in the first approach, when i run the fixed point tool; the tool also alters the data types of the blocks outside PID (ADC, DPWM). i need to fix the ADC output to int8 and DPWM input to int8.

Sign in to comment.



Community Treasure Hunt

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

Start Hunting!