How can I get the checksum of a compiled model?

2 次查看(过去 30 天)
When I execute Code Inspector on a set of source code generated from a model, the top of the report lists the checksum of the model. The checksum is also included in model coverage results. How can I use the MATLAB language to get this checksum from the command window? This would be useful to check that a model is the same as the one used in Code Inspector without having to actually execute Code Inspector again (it can take a long time to run for larger models).
With the coverage results, the results explorer will indicate when the results are not applicable to the model (presumably by using this checksum data).
  1 个评论
Nathan B
Nathan B 2018-3-9
I discovered the Simulink.BlockDiagram.getChecksum function, and was able to get 3 different checksums from it: the main check, the content and then the interface. However, none of these match the checksum I get from a System Design Description report or the Code Inspector.
Still not sure how I can generate a checksum in the same format as the 2 reports I mentioned. Would be nice to be able to see if reports match the model that is in the workspace.

请先登录,再进行评论。

回答(1 个)

Akshat Dalal
Akshat Dalal 2025-4-15
Hi Nathan,
The checksum obtained via Simulink.BlockDiagram.getChecksum is typically used for determining if Simulink needs to regenerate code for accel-mode targets or if we explictly ask it to generate code. Other products might be calculating their own checksum which may differ from the checksum obtained from Simulink.BlockDiagram.getChecksum. Individual products might have unique checksums based on the kind of reusability of cache they support.
Another reason for this difference might be that the code-inspector might be showing an aggregated checksum as outlined in the following documentation: https://www.mathworks.com/help/slci/ref/slci.configuration.getincludetopmodelchecksumforrefmodels.html
It could also be that the code-inspector is giving the compiled model checksum. Simulink.BlockDiagram.getChecksum does not return the compile state checksum by default, The process for getting the compiled checksum is outlined in the following documenation: https://www.mathworks.com/help/simulink/slref/simulink.blockdiagram.getchecksum.html
I hope the above steps help in identifying the root cause for the difference in checksums.

类别

Help CenterFile Exchange 中查找有关 Verification, Validation, and Test 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by