hdlcoder.CodingStandard
Create HDL coding standard customization object
Description
creates
an HDL coding standard customization object that you can use to customize
the rules and the appearance of the coding standard report.cso = hdlcoder.CodingStandard(standardName)
If you do not want to customize the rules or appearance of the coding standard report, you do not need to create an HDL coding standard customization object.
Examples
Create an HDL Coding Standard Customization Object
Create a coding standard customization object cso.
cso = hdlcoder.CodingStandard('Industry');
Customize the Coding Standard Options
Do not show passing rules in the coding standard report.
Set the maximum if-else nesting depth to 2.
Disable the check for line length.
cso.ShowPassingRules.enable = false; cso.IfElseNesting.depth = 2; cso.LineLength.enable = false;
Create HDL Codegen Configuration and Coding Standard Customization Object
hdlcfg = coder.config('hdl');
Specify the coding standard and coding standard customization object.
hdlcfg.HDLCodingStandard = 'Industry'; hdlcfg.HDLCodingStandardCustomizations = cso; hdlcfg.TreatRealsInGeneratedCodeAs = 'None';
Generate HDL Code and Test Bench
Specify your test bench function name. In this example, the design function is mlhdlc_dti.m and the test bench function is mlhdlc_dti_tb.m.
hdlcfg.TestBenchName = 'mlhdlc_dti_tb';
Generate HDL code for the design and check the code according to the customized HDL coding standard rules.
codegen -config hdlcfg mlhdlc_dti
### Begin MATLAB to HDL Code Generation...
### Working on DUT: mlhdlc_dti.
### Using TestBench: mlhdlc_dti_tb.
### Begin VHDL Code Generation
### Working on mlhdlc_dti as <a href="matlab:edit('/tmp/Bdoc25b_2988451_707604/tpf3976775/hdlcoder-ex26183455/codegen/mlhdlc_dti/hdlsrc/mlhdlc_dti.vhd')">mlhdlc_dti.vhd</a>.
### Generating Resource Utilization Report <a href="matlab:hdlcoder.report.openDdg('/tmp/Bdoc25b_2988451_707604/tpf3976775/hdlcoder-ex26183455/codegen/mlhdlc_dti/hdlsrc/resource_report.html')">resource_report.html</a>.
### Generating Optimization report
### To rerun codegen evaluate the following commands...
---------------------
cgi = load('/tmp/Bdoc25b_2988451_707604/tpf3976775/hdlcoder-ex26183455/codegen/mlhdlc_dti/hdlsrc/codegen_info.mat');
inVals = cgi.CodeGenInfo.inVals;
cfg = cgi.CodeGenInfo.codegenSettings;
codegen -config cfg -args inVals -report
---------------------
### Industry Compliance report with 0 errors, 1 warnings, 4 messages.
### Generating Industry Compliance Report <a href="matlab:web('/tmp/Bdoc25b_2988451_707604/tpf3976775/hdlcoder-ex26183455/codegen/mlhdlc_dti/hdlsrc/mlhdlc_dti_Industry_report.html')">mlhdlc_dti_Industry_report.html</a>
### Generating HDL Conformance Report <a href="matlab:web('/tmp/Bdoc25b_2988451_707604/tpf3976775/hdlcoder-ex26183455/codegen/mlhdlc_dti/hdlsrc/mlhdlc_dti_hdl_conformance_report.html')">mlhdlc_dti_hdl_conformance_report.html</a>.
### HDL Conformance check complete with 0 errors, 0 warnings, and 0 messages.
### Code generation successful: To view the report, open('codegen/mlhdlc_dti/hdlsrc/html/report.mldatx')
Create an HDL Coding Standard Customization Object
Load the sfir_fixed model
Create a coding standard customization object
cso
load_system('sfir_fixed') cso = hdlcoder.CodingStandard('Industry');
Customize the Coding Standard Options
Do not show passing rules in the report.
Set maximum line length to 80 characters.
Check that module, instance, and entity names are between 5 and 50 characters long.
cso.ShowPassingRules.enable = false; cso.LineLength.length = 80; cso.ModuleInstanceEntityNameLength.length = [5 50];
Generate HDL Code for Your Design
Generate HDL code and check it according to the customized HDL coding standard rules. The DUT subsystem is symmetric_fir.
makehdl('sfir_fixed/symmetric_fir','HDLCodingStandard','Industry',... 'HDLCodingStandardCustomizations',cso, 'TargetDirectory', 'C:/coding_standard/hdlsrc')
### Working on the model <a href="matlab:open_system('sfir_fixed')">sfir_fixed</a>
### Generating HDL for <a href="matlab:open_system('sfir_fixed/symmetric_fir')">sfir_fixed/symmetric_fir</a>
### Using the config set for model <a href="matlab:configset.showParameterGroup('sfir_fixed', { 'HDL Code Generation' } )">sfir_fixed</a> for HDL code generation parameters.
### Running HDL checks on the model 'sfir_fixed'.
### Begin compilation of the model 'sfir_fixed'...
### Working on the model 'sfir_fixed'...
### Working on... <a href="matlab:configset.internal.open('sfir_fixed', 'GenerateModel')">GenerateModel</a>
### Begin model generation 'gm_sfir_fixed'...
### Copying DUT to the generated model....
### Model generation complete.
### Generated model saved at <a href="matlab:open_system('C:\coding_standard\hdlsrc\sfir_fixed\gm_sfir_fixed.slx')">C:\coding_standard\hdlsrc\sfir_fixed\gm_sfir_fixed.slx</a>
### Begin VHDL Code Generation for 'sfir_fixed'.
### Working on sfir_fixed/symmetric_fir as C:\coding_standard\hdlsrc\sfir_fixed\symmetric_fir.vhd.
### Code Generation for 'sfir_fixed' completed.
### Industry Compliance report with 4 errors, 0 warnings, 2 messages.
### Generating Industry Compliance Report <a href="matlab:web('C:\coding_standard\hdlsrc\sfir_fixed\symmetric_fir_Industry_report.html')">symmetric_fir_Industry_report.html</a>
### Generating HTML files for code generation report at <a href="matlab:hdlcoder.report.openDdg('C:\coding_standard\hdlsrc\sfir_fixed\html\index.html')">index.html</a>
### Creating HDL Code Generation Check Report file:///C:/coding_standard/hdlsrc/sfir_fixed/symmetric_fir_report.html
### HDL check for 'sfir_fixed' complete with 0 errors, 1 warnings, and 0 messages.
### HDL code generation complete.
Input Arguments
Specify the HDL coding standard to customize. The standardName value must
match the HDLCodingStandard property value.
Example: 'Industry'
Output Arguments
HDL coding standard customizations, returned as an HDL coding standard customization object.
Version History
Introduced in R2014b
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)