Hello,
>
>i want to test my fft and filter component that i created for FGPA. to do this
i want to create a test input data (with size of say 1000 points). and process
the data both with matlab and xilinx ise simulation to see if the match each
other. to create this input data, i would use matlab.
>
>now my problem is that i can't feed this data to vhdl testbench. it is a
tediuos job to manually convert all values to vhdl format and put that in vhdl
testbench. is there any way to convert this matrix to hdl code?
>
>Also i need to do the vice versa. that is when i did the simulation i
>would store the output in an array signal. Then I need to read this array
signal and somehow bring the values to matlab as a matrix.
>does anybody has any idea?
>With thanks in advance
>kian zarrin
>
What I normally do is create a text file of binary data from my Matlab variables
and read it into my testbench with the textio functions.
To create the text file from Matlab you can use a for loop on the data with
dec2bin like so:
% write file for hardware testbench
fid = fopen('tb_data_in.txt','w');
for k = 1:length(X)
fprintf(fid, '%s\n', dec2bin((X(k)),12)); % for 12 bits per
sample
end
fclose(fid);
You need to write some extra code to handle signed data though.
To read the file into you testbench use the textio functions described here:
http://vdlande.com/VHDL/filedec.html
Similarly you can write the testbench outputs to a file and import it into
Matlab, or export the outputs from your simulator.
-joe