cpp1.cpp
来自「在quartus软件下用VHDL语言实现DDS」· C++ 代码 · 共 26 行
CPP
26 行
#include<iostream.h>
#include<fstream.h>
#include<math.h>
void main()
{ double pi=3.1415926;
double step=pi*2/4096;
ofstream outfile;
outfile.open("cos.mif");
outfile<<"--cos.mif--"<<endl;
outfile<<"depth=4096;"<<endl;
outfile<<"width=10;"<<endl;
outfile<<"address_radix=dec;"<<endl;
outfile<<"data_radix=hex;"<<endl;
outfile<<"content begin"<<endl;
for(int i=0;i<4096;i++)
{outfile<<dec<<i<<" : "<<hex<<int((cos(i*step)+1)/2*1023)<<";"<<endl;
}
outfile<<"end;";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?