MATLAB CODE TO HDL

1 view (last 30 days)
OKG
OKG on 28 Feb 2019
Answered: Kiran Kintali on 28 Feb 2019
Hello everyone,
I am trying to convert my matlab code to vhdl file to implement my fpga design. Everytime when I try to convert, I get same error related name of function name.
Error: .....
Function with duplicate name "s_windowed_hann" cannot be defined.
When I rechange function name different from function name, I get this error from hdl coder;
Function name "s_windowed_hann" must match file name "w_sinc_func"
My project file name is w_sinc_func
Function name is s_windowed_hann
Code;
bla bla bla..
..
w_sinc = s_windowed_hann(32,2);
function w_sinc = s_windowed_hann(TAP,M)
...bla bla bla
..
..
w_sinc = bla bla bla..
end

Answers (1)

Kiran Kintali
Kiran Kintali on 28 Feb 2019
The file structure should be as follows
1) design under test file dut.m
2) test bench file dut_tb.m
The file 'dut.m' should have a top level function name 'dut' and can have sub functions and functions on the path. the testbench file dut_tb must at least call the design function 'dut' once.
The dut file MATLAB code in 'dut.m' should follow rules documented in HDLCoder and use subset of MATLAB allowed by HDLCoder for hardware synthesis.
The testbench file can use all of MATLAB syntax for providing stimulus and checking response from the design file.
please check shipping demos using multiple functions for additional insights. feel free to create a technical support case if you are not able to follow the instructions or run into unexpected behavior.
thanks

Community Treasure Hunt

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

Start Hunting!