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 Zainab
If I understood you you want 16bits width and 4096 depth 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=4096;\n'); fprintf(fid,'ADDRESS_RADIX=UNS;\n'); fprintf(fid,'DATA_RADIX=DEC;\n'); fprintf(fid,'CONTENT BEGIN\n'); for k = 1:4096 fprintf(fid,'%i : %i;\n',k-1,data(k)); end fprintf(fid,'END;'); fclose(fid);