coder.HlsConfig
R2026bDescription
A coder.HlsConfig object contains the configuration
parameters that the codegen function requires to generate High-Level
Synthesis (HLS) code from MATLAB® code. To pass this object to the codegen function, use
the -config option.
Creation
Description
hlscfg =
coder.config("hls") creates a coder.HlsConfig object for
HLS code generation.
Properties
Report
Option to generate a code replacement report, specified as a numeric or logical
1 (true) or 0 (false). When
true, generates a report showing which functions and
operators were replaced by entries from the code replacement library.
Data Types: logical
Option to generate an HLS code generation report, specified as a numeric or
logical 1 (true) or 0 (false).
Data Types: logical
Option to open the code generation report after code generation completes,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Name of the variable in the base workspace to store code generation report information, specified as a character vector or string scalar.
Data Types: char | string
Comments
Option to include comments in the generated HLS code, specified as a numeric or
logical 1 (true) or 0 (false).
Data Types: logical
Option to include MATLAB source code as comments in the generated HLS code, specified as a
numeric or logical 1 (true) or 0 (false).
When true, each line of generated code is preceded by the
corresponding MATLAB source code as a comment.
Data Types: logical
General
Name of the design function for HLS code generation, specified as a character vector or string scalar.
Data Types: char | string
Option to enable traceability between MATLAB source code and generated HLS code in the code generation report,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Option to generate a resource utilization report, specified as a numeric or
logical 1 (true) or 0 (false).
Data Types: logical
Target language of the generated HLS code, specified as a character vector or string scalar.
Data Types: char | string
Test bench function name, specified as a character vector or string scalar. The test bench function exercises the design function with representative input data. Specify a test bench to enable HLS test bench generation and verification.
Data Types: char | string
HLS code generation workflow, specified as a character vector or string scalar.
Data Types: char | string
Workflow
Option to check design conformance before generating HLS code, specified as a
numeric or logical 1 (true) or 0
(false).
Data Types: logical
Option to generate HLS code, specified as a numeric or logical
1 (true) or 0 (false).
Data Types: logical
Option to generate an HLS test bench, specified as a numeric or logical
1 (true) or 0 (false). When
true, generates a test bench that verifies the generated HLS
code against the MATLAB design.
Data Types: logical
HLS test bench stimulus source, specified as a character vector or string scalar.
Data Types: char | string
Option to open the conformance report after the conformance check completes,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Option to simulate the generated HLS code by using the synthesis tool,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Option to synthesize the generated HLS code by using the synthesis tool,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
IP Core Options
Bitstream build mode, specified as a character vector or string scalar.
Data Types: char | string
Option to build the FPGA bitstream after synthesis, specified as a numeric or
logical 1 (true) or 0 (false).
Data Types: logical
Option to create an embedded system project, specified as a numeric or logical
1 (true) or 0 (false).
Data Types: logical
Embedded system tool name, specified as a character vector or string scalar.
Data Types: char | string
IP core execution mode, specified as a character vector or string scalar.
Data Types: char | string
Option to generate a host interface script, specified as a numeric or logical
1 (true) or 0 (false).
Data Types: logical
IP address of the target device, specified as a character vector or string scalar.
Data Types: char | string
IP core name, specified as a character vector or string scalar.
Data Types: char | string
IP core vendor name, specified as a character vector or string scalar.
Data Types: char | string
IP core version, specified as a character vector or string scalar.
Data Types: char | string
Option to program the target device with the generated bitstream, specified as
a numeric or logical 1 (true) or 0
(false).
Data Types: logical
Programming method for the target device, specified as a character vector or string scalar.
Data Types: char | string
Reference design name, specified as a character vector or string scalar.
Data Types: char | string
Path to the reference design folder, specified as a character vector or string scalar.
Data Types: char | string
SSH password for connecting to the target device, specified as a character vector or string scalar.
Data Types: char | string
SSH username for connecting to the target device, specified as a character vector or string scalar.
Data Types: char | string
Target platform name for IP core generation, specified as a character vector or string scalar.
Data Types: char | string
Target Tool Selection
HLS synthesis tool name, specified as a character vector or string scalar.
Example: "AMD Vitis HLS"
"Cadence Stratus HLS"
Data Types: char | string
Synthesis target chip family name, specified as a character vector or string scalar.
Data Types: char | string
Synthesis target device name, specified as a character vector or string scalar.
Data Types: char | string
Synthesis target package name, specified as a character vector or string scalar.
Data Types: char | string
Synthesis target speed value, specified as a character vector or string scalar.
Data Types: char | string
Target clock frequency in MHz, specified as a nonnegative scalar. Specify the
target frequency of the clock for HLS synthesis. A value of 0
uses the default frequency of the synthesis tool.
Data Types: double
Code Style
Postfix string appended to signal names to form the imaginary part of complex signals, specified as a character vector or string scalar.
Data Types: char | string
Postfix string appended to signal names to form the real part of complex signals, specified as a character vector or string scalar.
Data Types: char | string
Option to include the date and time in the generated file header, specified as
a numeric or logical 1 (true) or 0
(false).
Data Types: logical
Option to generate HLS code regions in the generated code, specified as a
numeric or logical 1 (true) or 0
(false).
Data Types: logical
Option to initialize block RAM to 0 for simulation,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Prefix for generated module names, specified as a character vector or string scalar.
Data Types: char | string
Postfix appended to names that conflict with reserved words in the target language, specified as a character vector or string scalar.
Data Types: char | string
User-specified comment to include in the header of the generated files, specified as a character vector or string scalar.
Data Types: char | string
Optimizations
Option to map persistent arrays that exceed the RAM threshold to RAM in the
generated HLS code, specified as a numeric or logical 1 (true)
or 0 (false).
Data Types: logical
RAM mapping threshold in bits, specified as a character vector or string
scalar. Persistent arrays with a size greater than this threshold are mapped to
RAM when MapPersistentVarsToRAM is
true.
Data Types: char | string
Option to reuse common operations in the generated HLS code to reduce area,
specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Advanced Coding
Code replacement library name, specified as a character vector or string scalar. Use code replacement libraries to replace MATLAB functions and operators with custom C/C++ implementations in the generated HLS code.
Data Types: char | string
Custom Tcl file name containing additional Tcl commands to include in the generated synthesis scripts, specified as a character vector or string scalar. The custom Tcl commands are sourced near the end of the generated script, so your custom commands take precedence over other Tcl commands earlier in the script.
Data Types: char | string
Option to instantiate MATLAB functions as separate modules in the generated HLS code, specified
as a numeric or logical 1 (true) or 0
(false). When true, MATLAB package hierarchies are mapped to C++ namespaces in the generated
HLS code.
Data Types: logical
Option to generate HLS code that uses row-major array layout, specified as a
numeric or logical 1 (true) or 0 (false).
When false, the generated code uses column-major array layout.
Row-major layout can improve performance for algorithms that access arrays along
rows.
Data Types: logical
Option to saturate on integer overflow instead of wrapping, specified as a
numeric or logical 1 (true) or 0
(false).
Data Types: logical
TestBench
Floating-point tolerance strategy used during test bench verification to compare generated code outputs with MATLAB reference outputs, specified as a character vector or string scalar.
Example: "Absolute Error"
Data Types: char | string
Floating-point tolerance value used during test bench verification, specified
as a nonnegative scalar. The tolerance is applied using the strategy specified by
FPToleranceStrategy.
Data Types: double
Maximum number of simulation iterations for test bench verification, specified
as an integer. A value of -1 means no limit, and all test bench
iterations are simulated.
Data Types: double
Option to use fiaccel to accelerate fixed-point test bench
execution, specified as a numeric or logical 1 (true) or
0 (false).
Data Types: logical
Examples
Create an HLS configuration object with default settings.
cfg = coder.config("hls");Set the test bench name.
cfg.TestBenchName = "myDesign_tb";Generate HLS code for the design function myDesign.
codegen -config cfg myDesign -report
Create an HLS configuration object.
cfg = coder.config("hls");Configure the object to generate an HLS test bench and verify the generated code.
cfg.TestBenchName = "myFilter_tb";
cfg.GenerateHLSTestBench = true;
cfg.SimulateGeneratedCode = true;Generate and verify HLS code.
codegen -config cfg myFilter -report
Create an HLS configuration object and configure synthesis options.
cfg = coder.config("hls"); cfg.TestBenchName = "myDesign_tb"; cfg.SynthesisTool = "Xilinx Vitis HLS"; cfg.SynthesisToolChipFamily = "Virtex7"; cfg.SynthesisToolDeviceName = "xc7vx485t"; cfg.SynthesisToolPackageName = "ffg1761"; cfg.SynthesisToolSpeedValue = "-2"; cfg.TargetFrequency = 200;
Enable synthesis of the generated code.
cfg.SynthesizeGeneratedCode = true;
Generate and synthesize HLS code.
codegen -config cfg myDesign -report
If you have an existing coder.HdlConfig object configured for
the HLS workflow, convert it to coder.HlsConfig.
hdlCfg = coder.config("hdl"); hdlCfg.Workflow = "High Level Synthesis"; hlsCfg = convertToHlsConfig(hdlCfg);
Generate HLS code using the converted configuration object.
codegen -config hlsCfg myDesign -report
Alternatives
You can also generate HLS code from MATLAB code using the HDL Workflow Advisor. For more information, see Get Started with MATLAB to High-Level Synthesis Workflow Using HDL Coder App.
Version History
Introduced in R2026bIn releases before R2026b, HLS code generation was configured by using a
coder.HdlConfig object with the Workflow
property set to "High Level Synthesis". Starting in R2026b, use
coder.HlsConfig instead. In a future release, using
coder.HdlConfig for HLS code generation will cause an
error.
To convert an existing coder.HdlConfig object to
coder.HlsConfig, use the convertToHlsConfig
function.
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)