HDL Coder reset control

6 views (last 30 days)
Andrew on 8 Feb 2013
Commented: luckfy zhang on 21 Apr 2018
Hi, Simulink HDL Coder: is it possible to control the generation of the vhdl reset clause on a block by block basis?
In general, most flops in a datapath design dont require reset. we just reset the input of datapath, and wait long enough for the known input to propagate through the datapath and put the design in a well defined state. Anything with feedback requires a reset. By using reset only when required like this, we save fpga routing resource, and produce more efficient, higher performance designs.
However,HDL coder produces vhdl with a reset on every flop. (we use sychronous reset). Is there a way for us to prevent hdl coder adding resets on all flops? can we control it?
cheers andrew

Accepted Answer

Tim McBrayer
Tim McBrayer on 11 Feb 2013
Edited: Tim McBrayer on 28 Feb 2017
There is a block-level parameter that allows the reset to be disabled on a block by block basis. You can access this parameter by right-clicking on a Delay block and choosing HDL Code -> HDL Block Properties. On this dialog, change ResetType from 'default' to 'none'. This sets the register generated from that Delay block to be generated with no reset.
The ResetType block parameter chooses whether a block will generate a reset or not. 'None' will not generate a reset; 'default' will generate whatever sort of reset is configured for HDL Coder in its Global Settings Configuration Parameters pane.
Since you have stated that you want the default to be no reset, the GUI-based interactive approach will be tedious. To script this, you can use the hdlset_param command, which has the syntax:
hdlset_param(block, parameter, value)
You can combine this with find_system to set all the Delay blocks in your model to have no reset:
hdlset_param(find_system('modelname', 'BlockType', 'Delay'), 'ResetType', 'none')
This will change the value of the HDL block parameter on all Delay blocks in your model to 'none'. Block parameters are persistent and are saved in the model, so this should be a one-time configuration. You can then go back and re-add a reset to those Delay blocks that require it.
Tim McBrayer
Tim McBrayer on 28 Feb 2017
Good catch; I fixed my statement to match yours.
luckfy zhang
luckfy zhang on 21 Apr 2018
Hello, you answer seems do not applicable for me since there are only asynchronous and synchronous choice for ResetType. And I cannot set this parameter to none. My Matlab version is R2015b. Could you provide me for some help?

Sign in to comment.

More Answers (0)


Find more on Code Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!