⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gen.h

📁 用systemC制作的快速付立叶变换
💻 H
字号:
// gen.h// Pierre Bomel - LESTER/UBS - janvier 2005//    Formation chez France Telecom R&D#include <systemc.h>template <class T, int n, int nsin, int sp>// T = samples type// n = number  of samples// nsin = number of mixed sine waves in signal// sp = sampling period (ns)SC_MODULE(gen){	T reals[n];	// real parts of samples	T imags[n];	// imaginary parts of samples	sc_inout<T> real, imag;	void sample(){		for(int i = 0; i < n; i++){			wait(sp, SC_NS);			real.write(reals[i]);			imag.write(imags[i]);			//imag.write(0);		}		for(;;) {			wait();			real.write(0);			imag.write(0);		}	}	SC_CTOR(gen){		T acos, asin;		T angle = 0;		T delta = M_PI * 2.0 / (double) n;		for (int i = 0; i < n; i++){			acos = asin = 0;			for(int j = 0; j < nsin; j++){				acos += cos((j+1)*angle);				asin += sin((j+1)*angle);			}			acos /= nsin;			asin /= nsin;			reals[i] = acos;			imags[i] = asin;			angle += delta;		}		SC_THREAD(sample);	}};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -