Hauptinhalt

coder.config

R2026b

Create HDL Coder code generation configuration objects

Description

hdl_config = coder.config("hdl") creates a coder.HdlConfig configuration object for use with the HDL codegen function when generating HDL code from MATLAB® code.

example

hls_config = coder.config("hls") creates a coder.HlsConfig configuration object for use with the codegen function when generating High-Level Synthesis (HLS) code from MATLAB code.

example

fixpt_config = coder.config("fixpt") creates a coder.FixptConfig configuration object for use with the HDL codegen function when generating HDL code from floating-point MATLAB code. The coder.FixptConfig object configures the floating-point to fixed-point conversion.

example

Examples

collapse all

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

Create a coder.HlsConfig object, hlscfg, with default settings.

hlscfg = coder.config("hls");

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

hlscfg.TestBenchName = "myDesign_tb";

Generate HLS code from your MATLAB design. In this example, the MATLAB design function name is myDesign.

codegen -config hlscfg myDesign

Output Arguments

collapse all

HDL code generation configuration object, returned as a coder.HdlConfig object. Use this object with the codegen function to generate HDL code.

HLS code generation configuration object, returned as a coder.HlsConfig object. Use this object with the codegen function to generate HLS code.

Floating-point to fixed-point conversion configuration object, returned as a coder.FixptConfig object. Use this object with the codegen function when converting floating-point MATLAB code to fixed-point before HDL or HLS code generation.

Version History

Introduced in R2013a

expand all