Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use matlab to generate sine Wave mif File

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use matlab to generate sine wave mif files, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Use matlab to generate sine wave mif file

.mif files or .hex files are often used in the rom process in FPGA with altera. For beginners, whether mif or hex is a very confusing thing, here is a simple explanation of the format and creation of the mif file.

Mif is the abbreviation of memory initialization file, which means memory initialization file in Chinese. To put it bluntly, it is the file that assigns values to rom. Here is an example of a simple .mif file:

Bit width horizontal width of width=14;% memory

Depth = 1024;% how much data is there in the depth of the memory?

Address_radix=uns;% sets the address base value (which is actually what number the address is represented in) can be set to BIN (binary), OCT (octal), DEC (decimal), HEX (hexadecimal)

Data_radix=dec;% ditto

Content begin% start data area

0PUX 0;% address: data

1:29

2:57

3:86

...

...

...

1023:16008

End; end

Matlab source code:

Clear all

Close all

Clc

T = [0VR 0.1R 360];% input range 0-90 degrees, step 0.1 degrees

X = pi*t/180

Sin_val = sin (x)

Fid=fopen ('E:\ matlab_project\ sin\ sine.mif','wt')

Fprintf (fid,'width=14;\ n')

Fprintf (fid,'depth = 1024;\ n')

Fprintf (fid,'address_radix=uns;\ n')

Fprintf (fid,'data_radix=dec;\ n')

Fprintf (fid,'content begin\ n')

For jacks 1mm 1024

I=j-1

K=round (sin_val (j) * 16384)

If (krypton16384)

Knight 16383

End

Fprintf (fid,'%d:%d;\ nPhonology iMagnek)

End

Fprintf (fid,'end;\ n')

Fclose (fid)

Plot (sin_val)

Results:

Thank you for reading this article carefully. I hope the article "how to use matlab to generate sine wave mif files" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report