Main Content

codegen

Generate HDL or SystemC code from MATLAB code

Description

example

codegen -confighdlcfgmatlab_design_namegenerates HDL or SystemC code from MATLAB®code.

example

codegen -confighdlcfg-float2fixedfixptcfgmatlab_design_nameconverts floating-point MATLAB code to fixed-point code, then generates HDL or SystemC code.

Examples

collapse all

创建一个coder.HdlConfigobject,hdlcfg.

hdlcfg = coder.config('hdl');% Create a default 'hdl' config

Set the test bench name. In this example, the test bench function name ismlhdlc_dti_tb.

hdlcfg.TestBenchName ='mlhdlc_dti_tb';

Set the target language to Verilog®.

hdlcfg.TargetLanguage ='Verilog';

Generate HDL code from your MATLAB design. In this example, the MATLAB design function name ismlhdlc_dti.

codegen-confighdlcfgmlhdlc_dti

创建一个coder.FixptConfigobject,fixptcfg, with default settings.

fixptcfg = coder.config('fixpt');

Set the test bench name. In this example, the test bench function name ismlhdlc_dti_tb.

fixptcfg.TestBenchName ='mlhdlc_dti_tb';

创建一个coder.HdlConfigobject,hdlcfg, with default settings.

hdlcfg = coder.config('hdl');

Convert your floating-point MATLAB design to fixed-point, and generate HDL or SystemC code. In this example, the MATLAB design function name ismlhdlc_dti.

codegen-float2fixedfixptcfg-confighdlcfgmlhdlc_dti

Input Arguments

collapse all

HDL code generation configuration options, specified as acoder.HdlConfigobject.

创建一个coder.HdlConfigobject using the HDLcoder.configfunction.

Name of top-level MATLAB function for which you want to generate HDL code.

Floating-point to fixed-point conversion configuration options, specified as acoder.FixptConfigobject.

Usefixptcfgwhen generating HDL code from floating-point MATLAB code. Create acoder.FixptConfigobject using the HDLcoder.configfunction.

版本History

Introduced in R2013a