codegen - Generate HDL or High-Level Synthesis (HLS) code from MATLAB code - MATLAB (original) (raw)
Main Content
Generate HDL or High-Level Synthesis (HLS) code from MATLAB code
Syntax
Description
codegen -config [hdlcfg](#btqy2qf-hdlcfg) [matlab_design_name](#btqy2qf-matlab%5Fdesign%5Fname)
generates HDL or HLS code from MATLABĀ® code.
codegen -config [hdlcfg](#btqy2qf-hdlcfg) -float2fixed [fixptcfg](#btqy2qf-fixptcfg) [matlab_design_name](#btqy2qf-matlab%5Fdesign%5Fname)
converts floating-point MATLAB code to fixed-point code, then generates HDL or HLS code.
Examples
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 ismlhdlc_dti
.
codegen -float2fixed fixptcfg -config hdlcfg mlhdlc_dti
Input Arguments
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