- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, this is my first post so I hope it is in the right section. I want to populate a .mif file with samples corresponding to one complete cycle of a sine wave. I generate the samples in matlab. At the moment I have 256 samples and I initially just wrote them into the .mif manually. Clearly this is rather tedious and will become more so since I want to include many more samples. Does anyone know of a more efficient means of achieving this?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use Matlab to wite 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); ***************** you can also copy a column and paste to MIF in Quartus- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is fantastic kaz, I just tried it and it worked perfectly. Thank you so much for your help. :D
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page