HDL Coder Example - Problem
2 views (last 30 days)
Show older comments
Hi,
I am trying to follow the example below:
But it is not clear for me where should I write this script? I mean, the first two lines:
design_name = 'mlhdlc_sfir.m';
testbench_name = 'mlhdlc_sfir_tb.m';
I understood that I should create two new files with the above mentioned names. OK. What about this?
type(design_name);
Where should this be written? I did it in the command window (main window).
Now there is the code itself, which begins after:
$#codegen
I wrote this in a new m file.
But I get the following error:
??? Input argument "h_in1" is undefined.
Error in ==> test_hdl_coder at 16
m1 = h_in1 * a1; m2 = h_in2 * a2;
Any ideas?
0 Comments
Answers (2)
Tim McBrayer
on 21 Jun 2013
These scripts are part of the published examples that are shipped with HDL Coder. The demo is set up to have you copy the prewritten example files and run the example using them. The "type" command simply prints the file contents to the MATLAB console, so that you can examine the example code in the HTML example you linked to.
To start interactively executing the example, the best place to start is after the testbench file has been displayed; at this anchor link: http://www.mathworks.com/products/hdl-coder/examples.html?file=/products/demos/shipping/hdlcoder/mlhdlc_tutorial_sfir.html#5 This portion creates and copies the prewritten examples files to a temporary directory and then walks you through creating a MATLAB HDL Coder project.
Kiran Kintali
on 29 Aug 2013
The demo is trying to show that if you execute the following sequence of commands you will have a working directory with write permissions with an example copied there to begin exploring MATLAB to HDL workflow. Hope this is helpful.
design_name = 'mlhdlc_sfir.m';
testbench_name = 'mlhdlc_sfir_tb.m';mlhdlc_demo_dir = fullfile(matlabroot, 'toolbox', 'hdlcoder', 'hdlcoderdemos', 'matlabhdlcoderdemos');
mlhdlc_temp_dir = [tempdir 'mlhdlc_sfir'];
cd(tempdir);
[~, ~, ~] = rmdir(mlhdlc_temp_dir, 's');
mkdir(mlhdlc_temp_dir);
cd(mlhdlc_temp_dir);
copyfile(fullfile(mlhdlc_demo_dir, design_name), mlhdlc_temp_dir);
copyfile(fullfile(mlhdlc_demo_dir, testbench_name), mlhdlc_temp_dir);
0 Comments
See Also
Categories
Find more on HDL Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!