FPGA ROM initialization mif file generation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.