This page shows you how to generate HDL code from the design in the Design a Hardware-Targeted Image Filter in MATLAB example.
To generate HDL code, you must have an HDL Coder™ license.
Copy the relevant files to a temporary folder.
functionName = 'HDLTargetedDesign'; tbName = 'VisionHDLMATLABTutorialExample'; vhtExampleDir = fullfile(matlabroot,'examples','visionhdl'); workDir = [tempdir 'vht_matlabhdl_ex']; cd(tempdir) [~, ~, ~] = rmdir(workDir, 's'); mkdir(workDir) cd(workDir) copyfile(fullfile(vhtExampleDir, [functionName,'.m*']), workDir) copyfile(fullfile(vhtExampleDir, [tbName,'.m*']), workDir)
Open the HDL Coder app and create a new project.
coder -hdlcoder -new vht_matlabhdl_ex
In the HDL Code Generation pane, add the function file
HDLTargetedDesign.m and the test bench file
VisionHDLMATLABTutorialExample.m to the project.
Click next to the signal names under MATLAB Function to define
the data types for the input and output signals of the function. The control signals are
logical scalars. The pixel data type is
The pixel input is a scalar.
Click Workflow Advisor to open the advisor.
Click HDL Code Generation to view the HDL code generation options.
On the Target tab, set Language
Also on the Target tab, select Generate HDL and Generate HDL test bench.
On the Coding Style tab, select Include MATLAB source code as comments and Generate report to generate a code generation report with comments and traceability links.
Click Run to generate the HDL design and the test bench with reports.
Examine the log window and click the links to view the generated code and the reports.