Format of MIF file
Width=
Depth=
address_radix=
data_radix=
Content
Begin
00:;
01:;
02:;
....
End
So you just need to use MATLAB to generate the number of the middle part, and then add the tail format, of course, the file suffix must be. MIF
MATLAB example
Clc
Clear All
N=[1:1000];
Ratio=0.125;%ratio means fo/fs;
Sintemp=sin (2*pi*ratio*n);
Sinround=round (sintemp* (2^7-1));
For i=1:1000
if (Sinround (i) <0)
Sinround (i) =2^8+sinround (i);
End
End
Sindata=sinround;
Mixdata=[n;sindata];
Fid=fopen (' data.txt ', ' a ');
fprintf (FID, '%x:%x; \ n ', mixdata);
Fclose (FID);
It should be noted that the fprintf function%x words can not be negative, negative to be converted to complement, fprintf the elements of the printing matrix is to press from top to bottom, and then from left to right in the order of each print.
FPGA ROM initialization mif file generation