How to use matlab to generate sine wave coe file
Editor to share with you how to use matlab to generate sine wave coe files, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Use matlab to generate sine wave coe file
When we use ROM in xilinx ISE, we often use .coe file, and coe file is the initialization file of xilinx ROM.
Examples of Coe files:
MEMORY_INITIALIZATION_RADIX=10; stands for base 10, 2 for base 2, 8 for base 8, and 16 for base 16.
MEMORY_INITIALIZATION_VECTOR=
2500
2663
2826
2987
...
...
...
2012
2173
2336
Matlab source code:
Clear all
Close all
Clc
Width = 16
Fog1000
Fs=96000;%96KHZ sampling frequency
Nasty 96
T = (0:N-1) / fs
Digits (5)
Sin0=sin (2*pi*f*t) * 3.25-3.25
Fid = fopen ('E:\ ise_project\ audio\ coe\ sim_rom0.coe','w');% file storage path
Fprintf (fid,'MEMORY_INITIALIZATION_RADIX=%d;\ nJournal width)
Fprintf (fid,'MEMORY_INITIALIZATION_VECTOR=\ n')
For (k=1:N-1)
Fprintf (fid,'%d,\ nPhonology sin0 (k))
End
Fprintf (fid,'%d;\ nseparate Chinese 0 (N));% each data is separated by a comma or space or newline character, and the last data is followed by a semicolon
Plot (trecoery sin0 and Zhonghua')
Results:
Use da output oscilloscope to display the results on FPGA:
The above is all the contents of the article "how to use matlab to generate sine wave coe files". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!