hdlsaveparams
Save nondefault block- and model-level HDL parameters
Syntax
Description
hdlsaveparams(
saves nondefault block- and model-level HDL parameters to a MATLAB script and specifies whether to overwrite the previously saved
parameters MATLAB script.dut
,filename
,force_overwrite
)
Examples
Display HDL-Related Nondefault Model Parameters
Open the model.
sfir_fixed
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)
Display HDL-related nondefault model parameters for the symmetric_fir
subsystem.
hdlsaveparams('sfir_fixed/symmetric_fir')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir'); % Set SubSystem HDL parameters hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5); hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
The output identifies the subsystem and displays its HDL-related parameter values.
Save and Restore HDL-Related Model Parameters
This example shows how to set HDL parameters on a model and save the parameters in a MATLAB® script.
Set Model HDL Parameters
Open the sfir_fixed
model.
sfir_fixed
Verify that model parameters have default values.
hdlsaveparams('sfir_fixed/symmetric_fir')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', '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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir'); % Set SubSystem HDL parameters hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5); hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
Save the model parameters to a MATLAB® 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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed');
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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir'); % Set SubSystem HDL parameters hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5); hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
Overwrite Previously Saved HDL Parameters File
This example shows how to set HDL parameters on a model, save the parameters in a MATLAB® 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 Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', '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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir'); % Set SubSystem HDL parameters hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5); hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
Save the model parameters to a MATLAB® 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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed');
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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir'); % Set SubSystem HDL parameters hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5); hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
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™ generates an error and doesn't overwrite the parameter values. When you run hdlsaveparams
with the parameter set to true
, HDL Coder™ generates a warning that it overwrites the file.
hdlsaveparams('sfir_fixed/symmetric_fir', 'sfir_saved_params.m','true')
Warning: HDL parameters file 'sfir_saved_params.m' already exists. By overwriting it now, you will lose any parameter settings made earlier.
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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed');
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')
%% Set Model 'sfir_fixed' HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir'); hdlset_param('sfir_fixed', 'ShareAdders', 'on'); % Set SubSystem HDL parameters hdlset_param('sfir_fixed/symmetric_fir', 'InputPipeline', 5); hdlset_param('sfir_fixed/symmetric_fir', 'OutputPipeline', 2); hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 4);
Save and Access Non-Default HDL Parameters in a Structure Array
This example shows how to save non-default HDL model and block parameters in a structure array and access individual parameters.
Open the model
sfir_single
sim('sfir_single')
Save HDL Model and Block parameters
hparams = hdlsaveparams('sfir_single/symmetric_fir');
%% Set Model 'sfir_single' HDL parameters fpconfig = hdlcoder.createFloatingPointTargetConfig('NATIVEFLOATINGPOINT' ... , 'MantissaMultiplyStrategy', 'FullMultiplier' ... ); hdlset_param('sfir_single', 'FloatingPointTargetConfiguration', fpconfig); hdlset_param('sfir_single', 'HDLSubsystem', 'sfir_single/symmetric_fir'); hdlset_param('sfir_single', 'UseFloatingPoint', 'on'); % Set SubSystem HDL parameters hdlset_param('sfir_single/symmetric_fir', 'InputPipeline', 1); hdlset_param('sfir_single/symmetric_fir', 'OutputPipeline', 1);
View and Access Block Parameters
hparams
hparams = 1x5 struct array with fields: object parameter value
To see specific non-default parameters saved in the structure, you can access individual elements of the structure.
hparams(2)
ans = struct with fields: object: 'sfir_single' parameter: 'HDLSubsystem' value: 'sfir_single/symmetric_fir'
To view the parameters and values specified for the model, in the MATLAB™ Workspace, double-click the hparams
variable. You see the fields of the structure array and the corresponding values in the MATLAB Editor.
Input Arguments
dut
— DUT subsystem name
character vector
DUT subsystem name, specified as a character vector, with full hierarchical path.
Example: 'modelname/subsysTarget'
Example: 'modelname/subsysA/subsysB/subsysTarget'
filename
— Name of file
character vector
Name of file to which you are saving model parameters, specified as a character vector.
Example: '
mymodel_saved_params.m'
force_overwrite
— Overwrite parameters file
boolean
Specify whether to overwrite the previously saved parameters file as a boolean.
Example: '
true'
Output Arguments
varname
— Name of variable containing saved parameters
struct
Specify the name of the variable that contains the saved model parameters. The variable are saved as a structure array.
Example: '
hparams'
Version History
Introduced in R2012b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)