%% Overwrite Previously Saved HDL Parameters File
% This example shows how to set HDL parameters on a model, save the parameters
% in a MATLAB(R) script, and then overwrite the saved parameters.
%% Set Model HDL Parameters 
% Open the |sfir_fixed| model. 
sfir_fixed  
%% 
% Verify that model parameters have default values. 

hdlsaveparams('sfir_fixed/symmetric_fir')  
%%
% Set HDL-related model parameters for the |symmetric_fir| subsystem.

hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3)
hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5) 
%% Save Model HDL Parameters
% Verify that model parameters are set.

hdlsaveparams('sfir_fixed/symmetric_fir')  
%%
% Save the model parameters to a MATLAB(R) script, |sfir_saved_params.m|.

hdlsaveparams('sfir_fixed/symmetric_fir', 'sfir_saved_params.m')              
%% Verify Saved Parameters
% Reset HDL-related model parameters to default values. 

hdlrestoreparams('sfir_fixed/symmetric_fir')  
%%
% Verify that model parameters have default values. 

hdlsaveparams('sfir_fixed/symmetric_fir')  
%%
% Restore the saved model parameters from |sfir_saved_params.m|.

hdlrestoreparams('sfir_fixed/symmetric_fir', 'sfir_saved_params.m')                   
%%
% Verify that the saved model parameters are restored

hdlsaveparams('sfir_fixed/symmetric_fir')   
%% Modify Saved HDL Parameters
% Modify HDL-related model parameters set for the |symmetric_fir| subsystem.

hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 4)
hdlset_param('sfir_fixed/symmetric_fir', 'OutputPipeline', 2) 
hdlset_param('sfir_fixed', 'ShareAdders', 'on')
%% Overwrite Saved Parameters File
% Set the |force_overwrite| flag to |true| to overwrite the parameters file
% |sfir_saved_parameters.m| with the new parameters. If you do not
% specify this flag, HDL Coder(TM) generates an error and doesn't overwrite the
% parameter values. When you run |hdlsaveparams| with the parameter set to |true|, HDL
% Coder(TM) generates a warning that it overwrites the file. 

hdlsaveparams('sfir_fixed/symmetric_fir', 'sfir_saved_params.m','true') 
%% Verify Resaved Parameters
% Reset HDL-related model parameters to default values. 

hdlrestoreparams('sfir_fixed/symmetric_fir')  
%%
% Verify that model parameters have default values. 

hdlsaveparams('sfir_fixed/symmetric_fir')
%%
% Restore the saved model parameters from |sfir_saved_params.m|.

hdlrestoreparams('sfir_fixed/symmetric_fir', 'sfir_saved_params.m')                   
%%
% Verify that the saved model parameters are restored

hdlsaveparams('sfir_fixed/symmetric_fir')  



%% 
% Copyright 2012 The MathWorks, Inc.