At the MATLAB® command line, enter:
hdlcoder
Enter a project name in the project dialog box and click OK.
HDL Coder™ creates the project in the local working folder, and, by default, opens the project in the right side of the MATLAB workspace.
Alternatively, you can create a new HDL Coder project from the apps gallery:
On the Apps tab, on the far right of the
Apps section, click the arrow
.
Under Code Generation, click HDL Coder.
Enter a project name in the project dialog box and click OK.
At the MATLAB command line, enter:
open project_name
project_name
specifies
the full path to the project file.Alternatively, navigate to the folder that contains your project
and double-click the .prj
file.
First, you must add the MATLAB file from which you want to generate code to the project. Add only the top-level function that you call from MATLAB (the Design Under Test). Do not add files that are called by this file. Do not add files that have spaces in their names. The path must not contain spaces, as spaces can lead to code generation failures in certain operating system configurations.
To add a file, do one of the following:
In the project pane, under MATLAB Function , click the Add MATLAB function link and browse to the file.
Drag a file from the current folder and drop it in the project pane under MATLAB Function.
If the functions that you added have inputs, and you do not specify a test bench, you must define these inputs. See Specify Properties of Entry-Point Function Inputs.
You must add a MATLAB test bench unless your design does not need fixed-point conversion and you do not want to generate an RTL test bench. If you do not add a test bench, you must define the inputs to your top-level MATLAB function. For more information, see Specify Properties of Entry-Point Function Inputs.
To add a test bench, do one of the following:
In the project panel, under MATLAB Test Bench, click the Add MATLAB test bench link and browse to the file.
Drag a file from the current folder and drop it in the project pane under MATLAB Test Bench.