Filter löschen
Filter löschen

HDL Coder Example - Problem

1 Ansicht (letzte 30 Tage)
Ali Alsaqqa
Ali Alsaqqa am 21 Jun. 2013
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?

Antworten (2)

Tim McBrayer
Tim McBrayer am 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.
  1 Kommentar
Ali Alsaqqa
Ali Alsaqqa am 21 Jun. 2013
OK, I created two files, one for the design, other for the TestBench, executed the script, but it gives me the following error:
??? Error using ==> copyfile
No matching files were found

Melden Sie sich an, um zu kommentieren.


Kiran Kintali
Kiran Kintali am 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);

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by