Forum Discussion
Altera_Forum
Honored Contributor
15 years agotext to mif conversion
Hello, I am looking for something that would convert a text file (with fractional entries), with values to be stored in a LUT, into a mif file with hexadecimal entries. For example, let a fra...
Altera_Forum
Honored Contributor
15 years agoHi,
You better use a program to write the mif files as copy/paste is suitable for small size data. Here is an example Using Matlab to write 256 signed data to 16 bit mif: fid = fopen('filename.mif','w'); fprintf(fid,'--MIF data generated by MATLAB\n'); fprintf(fid,'--Date: %s \n\n', date); fprintf(fid,'WIDTH=16;\n'); fprintf(fid,'DEPTH=256;\n'); fprintf(fid,'ADDRESS_RADIX=UNS;\n'); fprintf(fid,'DATA_RADIX=DEC;\n'); fprintf(fid,'CONTENT BEGIN\n'); for k = 1:256 fprintf(fid,'%i : %i;\n',k-1,data(k)); end fprintf(fid,'END;'); fclose(fid); *****************