Test Protected Models
To test a protected model that you created, compare the simulation results of the protected model to the output of the original model. As you supply the protected model from the original model, both the original and the protected model might exist on the MATLAB® path.
In the parent model, if the Model block Model name
parameter names the model without providing a suffix, the protected model takes precedence
over the unprotected model. To override this default when testing the output, in the
Model block Model name parameter, specify the file name
with the extension of the unprotected model,
To compare the unprotected and protected versions of a Model block, you can
use the Simulation Data Inspector. This example uses
hdlcoder_protected_model_parent_harness and the protected model,
hdlcoder_referenced_model_gain.slxp, which you created in Create Protected Models to Conceal Contents and Generate HDL Code.
If it is not already open, open the model
Make sure that the Model block in the
hdlcoder_protected_model_parent_harness/DUT/mynestedsubsystem is referencing the original model
hdlcoder_referenced_model_gain.slxand not the protected model.
Enable logging for the output signals of the Model block. Right-click the output signals and select Log Selected Signals.
Simulate the model and click the Simulation Data Inspector. In the Simulation Data Inspector, select the signals that you logged to see the simulation results. Save this simulation run with a name such as
Now, in the Block Parameters dialog box for the Model block, change the Model name to
A badge icon appears on the Model block indicating that you are referencing the protected model. If you haven't already created the protected model, follow the steps mentioned in Create Protected Models to Conceal Contents and Generate HDL Code.
Simulate the model, which now refers to the protected model. When the simulation is complete, a new run appears in the Simulation Data Inspector. Save this run as
In the Simulation Data Inspector, click the Compare tab. From the Baseline and Compare To lists, select the
protected_model_run. To compare the runs, click Compare Runs.
This figure displays the comparison between the Baseline and Compare To lists. You see that the simulation results match.