Main Content

codegen

Generate HDL or High-Level Synthesis (HLS) code from MATLAB code

Description

codegen -config hdlcfg matlab_design_name generates HDL or HLS code from MATLAB® code.

example

codegen -config hdlcfg -float2fixed fixptcfg matlab_design_name converts floating-point MATLAB code to fixed-point code, then generates HDL or HLS code.

example

Examples

collapse all

Create a coder.HdlConfig object, hdlcfg.

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

Set the test bench name. In this example, the test bench function name is mlhdlc_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 is mlhdlc_dti.

codegen -config hdlcfg mlhdlc_dti

Create a coder.FixptConfig object, fixptcfg, with default settings.

fixptcfg = coder.config('fixpt');

Set the test bench name. In this example, the test bench function name is mlhdlc_dti_tb.

fixptcfg.TestBenchName = 'mlhdlc_dti_tb';

Create a coder.HdlConfig object, hdlcfg, with default settings.

hdlcfg = coder.config('hdl');

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

codegen -float2fixed fixptcfg -config hdlcfg mlhdlc_dti

Input Arguments

collapse all

HDL code generation configuration options, specified as a coder.HdlConfig object.

Create a coder.HdlConfig object using the HDL coder.config function.

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

Floating-point to fixed-point conversion configuration options, specified as a coder.FixptConfig object.

Use fixptcfg when generating HDL code from floating-point MATLAB code. Create a coder.FixptConfig object using the HDL coder.config function.

Version History

Introduced in R2013a