Simulink.ModelReference.ProtectedModel.setPasswordForHDLCodeGeneration - Add or provide encryption password for HDL code generation from protected

  model - MATLAB ([original](http://www.mathworks.com/help/hdlcoder/ref/simulink.modelreference.protectedmodel.setpasswordforhdlcodegeneration.html)) ([raw](?raw))

Main Content

Add or provide encryption password for HDL code generation from protected model

Syntax

Description

Simulink.ModelReference.ProtectedModel.setPasswordForHDLCodeGeneration([model](#mw%5Fdf2f8576-a41b-4636-a965-07c879352235),[password](#mw%5F49820c53-ce79-4df5-914f-a32cbe8f2638)) adds an encryption password for HDL code generation if you create a protected model. If you use a protected model, the function provides the required password to generate code from the model.

example

Examples

collapse all

Create a protected model with encryption for HDL code generation.

openExample('sldemo_mdlref_counter'); Simulink.ModelReference.ProtectedModel.setPasswordForHDLCodeGeneration(... 'hdlcoder_referenced_model_gain','password'); Simulink.ModelReference.protect('sldemo_mdlref_counter',... 'Mode','HDLCodeGeneration','Encrypt',true,'Report',true);

A protected model named hdlcoder_referenced_model_gain.slxp is created that requires an encryption password for HDL code generation. To generate HDL code for sldemo_mdlref_counter, set floating-point library toNative Floating-Point and the Oversampling Factor to 14 in HDL code generation configuration parameters.

Use a protected model with encryption for HDL code generation.

Provide the encryption password required for HDL code generation from the protected model.

Simulink.ModelReference.ProtectedModel.setPasswordForHDLCodeGeneration(... 'hdlcoder_referenced_model_gain','password');

After you have provided the encryption password, you can generate code from the protected model.

Input Arguments

collapse all

Model name, specified as a string or character vector. It contains the name of a model or the path name of a Model block that references the protected model.

Password, specified as a string or character vector. If the protected model is encrypted for code generation, the password is required.

Version History

Introduced in R2019a