快速傅里叶变换FFT的FPGA设计与实现--电科1704 郭衡

合集下载

fft傅里叶变换的qpsk基带信号频偏估计和补偿算法fpga实现

fft傅里叶变换的qpsk基带信号频偏估计和补偿算法fpga实现

fft傅里叶变换的qpsk基带信号频偏估计和补偿算法fpga实现FFT(快速傅里叶变换)是一种常用的信号处理算法,可以将时域信号转换为频域信号。

在通信系统中,频偏是指信号的实际频率与理论频率之间的差异。

频偏会导致接收到的信号与发送信号不匹配,从而影响系统的性能。

因此,频偏的估计和补偿是通信系统中的重要问题之一。

QPSK(四相移键控)是一种常用的调制方式,它将两个比特映射到一个符号上。

在QPSK调制中,每个符号代表两个比特,因此可以提高频谱效率。

然而,由于信号传输过程中的各种因素,如多径效应、多普勒效应等,会导致信号的频偏。

为了解决QPSK基带信号频偏的问题,可以使用FFT算法进行频偏估计和补偿。

首先,将接收到的信号进行FFT变换,得到信号的频谱。

然后,通过分析频谱的特征,可以估计信号的频偏。

最后,根据估计的频偏值,对接收到的信号进行补偿,使其恢复到理论频率。

在FPGA(现场可编程门阵列)实现FFT傅里叶变换的QPSK基带信号频偏估计和补偿算法时,需要设计相应的硬件电路。

首先,需要将接收到的信号进行采样,并存储到FPGA的存储器中。

然后,通过使用FFT算法,对存储的信号进行频谱分析。

接下来,根据频谱的特征,计算信号的频偏值。

最后,使用频偏值对信号进行补偿,并输出补偿后的信号。

在FPGA实现中,需要考虑硬件资源的限制和性能要求。

为了提高计算速度,可以使用并行计算的方法,将FFT算法分解为多个子模块,并行计算每个子模块的结果。

此外,还可以使用流水线技术,将计算过程划分为多个阶段,以提高计算效率。

总之,FFT傅里叶变换的QPSK基带信号频偏估计和补偿算法在通信系统中具有重要的应用价值。

通过使用FPGA实现,可以提高计算速度和性能,满足实时信号处理的需求。

未来,随着通信技术的不断发展,这种算法和实现方法将会得到更广泛的应用。

快速傅里叶变换(FFT)的ASIC实现及现场可编辑门阵列(FPGA)验证

快速傅里叶变换(FFT)的ASIC实现及现场可编辑门阵列(FPGA)验证

快速傅里叶变换(FFT)的ASIC实现及现场可编辑门阵列(FPGA)验证赵莹;李云;刘解华;马文勃【摘要】通过对FFT(fast fourier transformation),即快速傅里叶变换的一般算法的研究对比,确定合理可行的基2方法处理1024点FFT.在ASIC(application specific integrated circuit)专用集成电路上实现FFT硬件模块,并将该模块在FPGA(field programmable gate array)上进行原型验证.采用级联结构设计FFT 模块,在尽量减小资源消耗的同时,提高FFT的运算速度.设计采用两组四个深度为256的双口RAM,乒乓结构处理,完成整个运算仅用了1 320个周期.最后用Xilinx 公司的Vertex7-XC7VX690T芯片做FPGA原型验证,在时钟频率为50 MHz时,完成1 024点FFT仅用了26.2 μs.【期刊名称】《科学技术与工程》【年(卷),期】2015(015)004【总页数】5页(P243-246,257)【关键词】FFT;FPGA;ASIC;双口RAM;乒乓结构【作者】赵莹;李云;刘解华;马文勃【作者单位】重庆邮电大学信息产业部移动通信重点实验室,重庆400065;重庆邮电大学信息产业部移动通信重点实验室,重庆400065;北京华力创通科技股份有限公司,北京100094;北京华力创通科技股份有限公司,北京100094【正文语种】中文【中图分类】TN492随着高速数字处理芯片和集成电路的快速发展,FFT已深入到数字信号处理各个领域。

如今,FFT技术已经广泛应用到频谱分析,匹配滤波,数字通信等多种领域[1,2]。

FFT的算法研究迄今已有四十年历史,理论相对成熟,而硬件实现方面相对薄弱。

FFT的基本实现方法按照组合方式不同分为时域抽取法和频域抽取法,按照分裂基序列大小的不同分为基二、基四等方法[3]。

基于FPGA的短时傅里叶变换分析及实现设计

基于FPGA的短时傅里叶变换分析及实现设计

基于FPGA的短时傅里叶变换分析及实现设计陈军【期刊名称】《贵州大学学报(自然科学版)》【年(卷),期】2017(034)002【摘要】In order to design quick, reasonable-obtained and processed models of language spectrum speech of low frequency signal, the mathematical model was built and analyzed.Based on radix-4 algorithm, the short-time Fourier transform (STFT) processor was realized by using the FPGA chip.The processing module of the signal was designed to be divided into frames, window type to be optional, width adjustable, single-path delay feedback pipeline algorithm processing block innguage spectrum of speech of low frequency signal was obtained and processed according to the algorithm model.The simulation research shows that the signal processing module of analysis and the design is rational.%为了设计快速、合理的对语音等低频信号的语谱进行采集、处理模块.通过对基4算法分析,构建了其数学模型,然后运用现场可编程门阵列(Field Programmable Gate Array,FPGA)芯片实现了短时傅里叶变换(Short-time Fourier transform ,STFT)处理器.详细地设计了信号的可分帧、窗类型可选、宽度可调的处理模块及单路延时反馈流水线算法处理块.依据算法模型对语音等低频信号的语谱进行采集、处理.仿真研究表明,对信号处理模块的分析、设计是合理性.【总页数】6页(P64-69)【作者】陈军【作者单位】甘肃中医药大学定西校区,甘肃定西 743000【正文语种】中文【中图分类】TN47【相关文献】1.基于FPGA的消噪同步叠加平均算法仿真分析及实现 [J], 张怀;王广君;曾旭明;王立;陈颖2.一种基于FPGA实现的ARINC659总线分析仪设计与实现 [J], 王泉;孙海洋;邵志阳;马超3.提高ASIC验证的速度与可视性基于FPGA的ASIC/SoC原型设计及基于FPGA 的系统在实时硬件速度下可以实现100%的内部信号可视性 [J], Mario Larouche4.基于PN序列帧的同步分析及FPGA实现 [J], 李星沛5.基于MaxplusⅡ的短时傅里叶变换分析及仿真实现研究 [J], 陈军因版权原因,仅展示原文概要,查看原文内容请购买。

快速傅立叶变换(FFT)的FPGA实现的开题报告

快速傅立叶变换(FFT)的FPGA实现的开题报告

快速傅立叶变换(FFT)的FPGA实现的开题报告一、题目概述快速傅立叶变换(FFT)是一种高效的信号处理算法,广泛应用于通信、图像处理等领域。

本课题旨在利用FPGA实现FFT算法,实现高速数据处理,提高信号处理的效率和精度。

二、研究内容1. FFT算法原理及其优势2. FPGA架构选择及设计思路3. 手动实现FFT算法4. 利用Vivado HLS自动生成FFT算法代码5. FPGA实现FFT算法的性能评估和优化三、研究目标1. 实现基于FPGA的FFT算法原型机2. 改进现有FFT实现,提高其效率和精度3. 将FFT算法移植至嵌入式系统四、研究意义随着信号处理技术的不断发展,FFT算法在各个领域的应用也越来越广泛。

基于FPGA的FFT算法具有处理速度快、资源消耗少、能耗低等优势,尤其适合于要求高速和实时性的应用场景。

本课题通过FPGA实现FFT算法,可为实现高效信号处理提供技术支持。

五、研究难点1. FPGA架构选择和设计2. FFT算法实现与优化3. 实现算法的并行化处理六、研究过程和计划1. 确定FFT算法实现所需的FPGA型号和系统环境2. 研究FFT算法及其优化方案,在手动实现基础上完成代码调试和性能测试3. 利用Vivado HLS自动生成FFT算法代码,并对代码进行优化4. 实现FFT算法的并行化处理5. 对FFT算法实现进行性能评估和优化,提高其效率和精度6. 将FFT算法移植至嵌入式系统七、研究预期结果1. 实现基于FPGA的FFT算法原型机2. 提高FFT算法的处理效率和精度3. 实现FFT算法的嵌入式应用八、论文组织结构第一章绪论1.1 研究背景与意义1.2 国内外研究现状1.3 主要研究内容和难点1.4 研究方法及进度计划第二章 FFT算法原理及其优势2.1 FFT算法原理2.2 FFT算法优势第三章 FPGA架构选择及设计思路3.1 FPGA架构选择3.2 设计思路和流程第四章 FFT算法手动实现4.1 FFT算法手动实现4.2 代码调试与测试第五章 FFT算法自动生成代码5.1 Vivado HLS介绍5.2 FFT算法自动生成代码5.3 代码优化第六章 FFT算法并行化处理6.1 并行化思路6.2 并行化代码实现第七章 FFT算法性能评估和优化7.1 性能测试方法7.2 优化方案与实现7.3 实现结果和分析第八章 FFT算法移植至嵌入式系统8.1 嵌入式应用场景8.2 移植方案与实现第九章结论与展望9.1 研究成果总结9.2 存在问题及研究展望参考文献。

fpga做快速傅里叶变换

fpga做快速傅里叶变换

fpga做快速傅里叶变换FPGA(Field Programmable Gate Array,现场可编程门阵列)作为一种可编程逻辑器件,具有高度灵活性和并行处理能力,已广泛应用于信号处理领域。

在信号处理中,傅里叶变换(Fourier Transform,FFT)常用于将信号从时域转换为频域,以实现频谱分析、滤波、信号识别等功能。

因此,将FFT算法实现在FPGA 上,能够充分发挥FPGA的并行计算能力,提高傅里叶变换的计算速度。

实现FFT算法的关键在于将信号分解为不同频率的正弦和余弦波,然后对这些波进行频谱分析。

FFT算法利用了对称性和乘法约简等技术,将傅里叶变换的计算复杂度从O(N^2)降低到O(NlogN),大大提高了计算效率。

在FPGA上实现FFT算法,可以通过并行计算和高速存储器的配合,进一步加快计算速度。

具体实现FFT算法的FPGA系统,可以分为以下几个模块:1. 输入/输出模块:负责将待处理的信号输入到FPGA中,并将计算结果输出。

FPGA具有高速IO接口,可以方便地与外部系统进行数据交互。

2. 数据处理模块:对输入的信号进行预处理,例如加窗处理、零填充等。

然后,将处理后的信号分成不同频率的子信号,交给并行计算单元进行处理。

3. 并行计算单元:包括多个计算核心,每个核心负责计算一个频率分量的傅里叶变换。

这些计算核心之间可以通过数据流方式进行数据交换,提高计算效率。

4. 存储器模块:FPGA内部包含大量的高速存储器,用于存储FFT算法的中间结果和输入/输出数据。

通过充分利用存储器的带宽和并行访问能力,可以提高计算效率。

5. 控制模块:负责控制整个系统的运行流程,包括时钟、时序控制和状态机控制等。

控制模块可以根据输入数据的特点,动态调整计算资源的分配和工作频率,以获得更高的计算性能。

实现FFT算法的FPGA系统需要综合考虑计算精度、资源利用率和功耗等因素。

对于不同的应用场景,可以选择不同的FPGA 型号和算法优化策略,以达到最佳性能和成本的平衡。

用FPGA实现FFT的方法

用FPGA实现FFT的方法

用FPGA实现FFT的方法使用FPGA(Field-Programmable Gate Array)实现FFT(Fast Fourier Transform)可以提供高性能的信号处理能力。

FFT是一种将时域信号转换为频域信号的算法,广泛应用于数字信号处理、通信系统、图像处理等领域。

下面将介绍一种常见的方法来使用FPGA实现FFT。

首先,需要了解FFT算法的基本原理。

FFT将长度为N的离散时间信号x(n)转换为N个频谱分量X(k),其中k=0,1,...,N-1、FFT算法的核心是蝶形运算,通过将信号分解成不同的频率分量并逐步组合来实现。

下面是使用FPGA实现FFT的具体步骤:1.设计数据缓存器:在FPGA内部设计一个数据缓存器用于存储输入信号x(n)和输出信号X(k)。

缓存器的宽度和深度取决于输入信号的采样位数和FFT的长度。

2. 数据采集与预处理:使用FPGA的输入模块采集外部信号,并通过FIFO(First In First Out)缓冲区将数据传输到数据缓存器中。

为了提高计算速度,可以使用预处理方法如窗函数、数据重排等来优化输入信号的质量。

3.蝶形运算模块设计:FFT算法的核心是蝶形运算。

在FPGA中,设计一个蝶形运算模块用于计算FFT算法中的每一个蝶形运算,即通过求解两个复数的乘积,并进行加法运算得到结果。

该模块需要实现乘法器和加法器,并对数据进行并行计算。

4.快速蝶形运算网络构建:将蝶形运算模块按照FFT算法中的乘积因子进行连接,并根据FFT的长度设计合适的网络结构。

可以使用串行-并行方式或并行-串行方式来实现FFT算法。

需要注意的是,为了减少延迟,可以采用流水线技术来提高运算速度。

5.数据输出与后处理:设计一个输出模块将计算得到的频域信号X(k)输出到外部。

可以通过FPGA的输出模块将数据传输到外部存储器、显示器或其他设备进行后续处理。

6. 时钟和时序设计:在FPGA中需要设计合适的时钟频率和时序来保证FFT算法的准确性和稳定性。

基于FPGA的计算整数FFT算法的设计及实现

基于FPGA的计算整数FFT算法的设计及实现

基于FPGA的计算整数FFT算法的设计及实现近年来,FPGA技术得到了广泛的关注和应用,除了在数字电路设计和信号处理方面得到广泛的应用外,还可以使用FPGA实现计算整数FFT算法。

其中,FFT 算法是一种十分重要的数字信号处理方法,可以快速地计算离散傅里叶变换(DFT),常常被用于音频、图像和视频等领域。

在本文中,我将介绍基于FPGA的计算整数FFT算法的设计及实现,包括算法的原理、设计思路和实现过程等方面,旨在为对此感兴趣的读者提供一些参考和帮助。

一、FFT算法原理在介绍计算整数FFT算法的设计过程前,我们先来了解一下FFT算法的原理。

DFT是将一个有限长的序列映射到另一个有限长的序列的线性变换,它的表达式为:$$X(k)=\sum_{n=0}^{N-1}{x(n)e^{-j2\pi k n/N}}$$其中,$x(n)$为原始序列,$N$为序列长度,$k$为频率索引。

这个表达式说明了在时域上的一个序列可以通过傅里叶变换转换到频域上的一个序列。

但是,DFT的计算量很大,因此常常使用FFT算法来实现DFT计算。

FFT算法的核心思想是分治法,将DFT一次计算分解为多次小规模DFT,简化计算量,提高计算效率。

在此过程中,我们需要卷积(卷积是将两个函数进行叠加得到一个新的函数)和旋转因子的概念。

卷积可以通过以下公式来表示:$$(f * g)(n)=\sum_{k=0}^{N-1}{f(k)g(n-k)}$$其中,$*$表示卷积运算,$f(n)$和$g(n)$是两个序列。

这个公式表示的是,将$f(n)$和$g(n)$反转、平移后得到的两个函数的积的积分。

旋转因子是指:$$W_N=e^{-j2\pi/N}$$$$W_N^k=e^{-j2\pi k/N}$$这个公式是用来计算旋转角度的。

在FFT算法中,需要不断地计算角度,旋转因子起到了重要作用。

二、计算整数FFT算法设计思路在了解了FFT算法的原理后,我们可以开始设计计算整数FFT算法。

fpga 快速傅里叶变换实现卷积

fpga 快速傅里叶变换实现卷积

标题:FPGA实现快速傅里叶变换加速卷积的原理与应用在当今信息时代,数字信号处理和数据处理已经成为许多领域中不可或缺的部分。

而在处理这些信号和数据时,快速傅里叶变换(FFT)和卷积运算是常用的数学工具。

在很多实际应用中,由于其高复杂度,这两个运算往往需要花费大量的时间和资源。

然而,通过利用现代的FPGA技术,我们可以实现这些运算的高效加速,本文将探讨如何利用FPGA来加速实现快速傅里叶变换卷积。

1. 背景介绍快速傅里叶变换(FFT)是一种离散傅里叶变换(DFT)的快速算法。

它不仅可以用于频域分析和信号处理,还被广泛应用于图像处理、通信、雷达和生物医学领域等。

而卷积运算则是数字信号处理和图像处理中常见的运算之一,用于实现信号的滤波、特征提取和模式识别等。

然而,这两种运算都具有较高的计算复杂度,特别是在涉及大规模数据时,传统的处理方法往往效率低下。

2. FPGA加速计算的优势FPGA(Field-Programmable Gate Array)是一种灵活可编程的数字集成电路,它通过可编程的逻辑单元和可编程的连接网络,可以实现大规模的并行计算和高速数据处理。

这使得FPGA在加速计算领域具有独特的优势。

与传统的CPU和GPU相比,FPGA可以根据具体的应用需求进行快速定制和优化,提供更高的计算密度和更低的功耗。

利用FPGA来加速实现FFT和卷积运算,可以大幅提高运算速度和效率。

3. FPGA实现快速傅里叶变换在实现FFT时,FPGA可以充分利用其并行计算的特性,通过设计合适的硬件结构和算法,实现FFT运算的高效加速。

可以采用基于蝶形运算单元(Butterfly)的并行计算结构,利用FPGA的片上资源进行数据流控制和计算单元的并行化。

通过巧妙的数据流设计和数据重用策略,还可以有效地减少时序延迟和资源消耗,进一步提高FFT算法的运行速度。

在实际应用中,基于FPGA的FFT加速器已经被广泛应用于通信系统、无线电频谱监测和图像处理等领域。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

快速傅里叶变换FFT的FPGA设计与实现学生姓名郭衡班级电科1704学号17419002064指导教师谭会生成绩2020年5 月20 日快速傅里叶变换FFT 的设计与实现一、研究项目概述非周期性连续时间信号x(t)的傅里叶变换可以表示为:=)(ϖX dt tj et x ⎰∞∞--1)(ϖ,式中计算出来的是信号x(t)的连续频谱。

但是,在实际的控制系统中能够式中计算出来的是信号x(t)的连续频谱。

但是,在实际的控制系统中能够算信号x(t)的频谱。

有限长离散信号x(n),n=0,1,…,N-1的DFT 定义为:∑-=-=-==102,1.....10)()(N n Nj N knNeW N k W n x K X π、、。

可以看出,DFT 需要计算大约N2次乘法和N2次加法。

当N 较大时,这个计算量是很大的。

利用WN 的对称性和周期性,将N 点DFT 分解为两个N /2点的DFT ,这样两个N /2点DFT 总的计算量只是原来的一半,即(N /2)2+(N /2)2=N2/2,这样可以继续分解下去,将N /2再分解为N /4点DFT 等。

对于N=2m 点的DFT 都可以分解为2点的DFT ,这样其计算量可以减少为(N /2)log2N 次乘法和Nlog2N 次加法。

图1为FFT 与DFT-所需运算量与计算点数的关系曲线。

由图可以明显看出FFT 算法的优越性。

图1 FFT 与DFT 所需乘法次数比较X[1]将x(n)分解为偶数与奇数的两个序列之和,即x(n)=x1(n)+x2(n)。

x1(n)和x2(n)的长度都是N /2,x1(n)是偶数序列,x2(n)是奇数序列,则∑∑=--=-=+2)12(1202)1.....,0()(2)(1)(N n kn N N n km N N k W n x W n x K X所以)1...,0()(2)(1)(1222120-=+=∑∑-=-=N k W n x W W n x K X N n km N k N km N Nn由于kmN N jkm Njkm NW eeW2/2/2222===--ππ,则)1.....,0)((2)(1)(2)(1)(122/1202/-=+=+=∑∑-=-=N k k X W k X W n x W W n x K X kN N n km N k N Nn kn N其中X1(k)和X2(k)分别为x1(n)和x2(n)的N /2点DFT 。

由于X1(k)和X2(k)均以N /2为周期,且WNk+N/2=-WNk ,所以X(k)又可表示为:)12/....,1,0)((2)(1)(-=+=N k k X W k X K X k N)12/....,1,0)((2)(1)2/(-=-=+N k k X W k X N K X k NFFT算法的原理是通过许多小的更加容易进行的变换去实现大规模的变换,降低了运算要求,提高了与运算速度。

FFT不是DFT的近似运算,它们完全是等效的。

二、研究项目设计方案比较FFT处理器的理论基础,比较了各种算法实现的运算量及复杂度,结合硬件实现结构与可配置单元。

选择了改良后的基4蝶形算法实现处理器的设计。

设计采用四路并行数据传输,在蝶形单元内部采用四级流水,提高了系统处理速度,根据基带项目数据流的特点,输入输出均采用了兵乓RAM的处理,有效地实现了对连续数据流的处理;通过对系统要求的三种不同点数64点、256点、1024点的运算规律分析,设计了可变点的配置方案,该方案通过控制选择各级蝶形运算及复用蝶形单元,大大地缩减了硬件开销。

三、研究项目系统结构设计ram、旋转ram输四、系统主要VHDL源程序设计fft顶层文件的VHDL源程序:library ieee ;use ieee.std_logic_1164.all ;use ieee.std_logic_arith.all ;use ieee.std_logic_unsigned.all ;entity fft_top isport(clock_main:in std_logic;init:in std_logic;ip , op ,fft_en ,enbw , enbor ,rom_en,romgen_en:out std_logic;butterfly_data: out std_logic_vector(10 downto 0);y1,y2:out std_logic;c1_c1,c2_c2,c3_c3,c0_c1,c0_c2,c1_c3,c2_c3: out std_logic);end fft_top;architecture rtl of fft_top issignal incr,staged:std_logic;signal clear:std_logic;signal butterfly_iod:std_logic_vector(10 downto 0);signal stage :std_logic_vector(3 downto 0);signal iod ,iod0,io_mode,fftd:std_logic;signal preset,disable,c0_en,reset_count: std_logic ;signal clk_count : std_logic_vector(2 downto 0) ;signal waves: std_logic_vector(3 downto 0);signal rom_add : std_logic_vector(9 downto 0) ;signal data_rom: std_logic_vector(11 downto 0) ;signal out_data: std_logic_vector(11 downto 0) := (others => '0') ; type state_values is (st0 , st1 , st2 , st3) ;signal pres_state1 , next_state1 : state_values ;signal c0_c0: std_logic;component butterflyport(clk: in std_logic;c0,c1,c2,c3,c01,c02,c13,c23: in std_logic;clear: in std_logic;X,rom_data: in std_logic_vector(11 downto 0);Y:out std_logic_vector(11 downto 0));end component;component cont_genport (con_staged , con_iod , con_fftd , con_init : in std_logic ;con_ip , con_op , con_iomode , con_fft : out std_logic ;con_enbw , con_enbor , c0_enable , con_preset : out std_logic ; con_clear , disable : out std_logic ;c0 , clock_main : in std_logic ;en_rom , en_romgen , reset_counter : out std_logic ; con_clkcount : in std_logic_vector(2 downto 0) ) ; end component;component romadd_gen isport (io_rom,c0,c1,c2,c3 : in std_logic ;stage_rom : in std_logic_vector(3 downto 0) ;butterfly_rom : in std_logic_vector(10 downto 0) ;romadd : out std_logic_vector(9 downto 0) ;romgen_en : in std_logic );end component ;component rommPORT(address : IN STD_LOGIC_VECTOR (9 DOWNTO 0);clken : IN STD_LOGIC ;clock : IN STD_LOGIC ;q : OUT STD_LOGIC_VECTOR (11 DOWNTO 0) );end component;component reg_dpramport (data_fft , data_io : in std_logic_vector (11 downto 0); q_out : out std_logic_vector (11 downto 0);clock_main , io_mode : in std_logic;wr_en,re_en: in std_logic;waddress: in std_logic_vector(10 downto 0);raddress: in std_logic_vector(10 downto 0));end component ;component but_genport (add_incr , add_clear , stagedone : in std_logic ;but_butterfly : out std_logic_vector(10 downto 0) ) ; end component ;component stage_genport (add_staged , add_clear : in std_logic ;st_stage : out std_logic_vector(3 downto 0) ) ;end component ;component iod_stagedport(but_fly : in std_logic_vector(10 downto 0) ;stage_no : in std_logic_vector(3 downto 0) ;add_incr , io_mode : in std_logic ;add_iod , add_staged , add_fftd : out std_logic ;butterfly_iod : out std_logic_vector(10 downto 0) ) ; end component ;component baseindexport(ind_butterfly: in std_logic_vector(10 downto 0);ind_stage: in std_logic_vector(3 downto 0);add_fft: in std_logic;fftadd_rd: out std_logic_vector(10 downto 0);c0,c1,c2,c3: in std_logic);end component ;component ioadd_genport (io_butterfly : in std_logic_vector(10 downto 0) ;add_iomode , add_ip , add_op : in std_logic ;base_ioadd : out std_logic_vector(10 downto 0) ) ; end component ;component mux_addport (a ,b : in std_logic_vector(10 downto 0) ;sel : in std_logic ;q : out std_logic_vector(10 downto 0) ) ;end component ;component ram_shiftport (data_in : in std_logic_vector(10 downto 0) ;clock_main : in std_logic ;data_out : out std_logic_vector(10 downto 0) ) ;end component ;component cyclesport (clock_main , preset , c0_en , cycles_clear : in std_logic ; waves : out std_logic_vector(3 downto 0) ) ;end component;component and_gatesport (waves_and : in std_logic_vector(3 downto 0) ;preset,clock_main , c0_en : in std_logic ;c0,c1,c2,c3,c0_c1,c2_c3,c0_c2,c1_c3 : out std_logic );end component ;component counterport (c : out std_logic_vector(2 downto 0) ;disable , clock_main , reset : in std_logic) ;end component ;component mult_clockport (clock_main , mult1_c0 , mult1_iomode , mult_clear : in std_logic ; mult1_addincr : out std_logic ) ;end component ;component level0port (data_edge : in std_logic;trigger_edge : in std_logic;edge_out : out std_logic);end component;beginfft_but : but_gen port map (incr , clear , staged ,butterfly_iod(10 downto 0));fft_stage : stage_gen port map (staged , clear , stage(3 downto 0)) ; iod_stgd : iod_staged port map(butterfly_iod(10 downto 0),stage(3 downto 0),incr,io_mode,iod,staged,fftd,butterfly_data(10 downto 0)) ;y1<=iod;y2<= clear;control : cont_gen port map (staged , iod , fftd , init , ip , op , io_mode ,fft_en ,enbw , enbor , c0_en , preset , clear , disable , c0_c0 ,clock_main ,rom_en,romgen_en,reset_count,clk_count);cyc: cycles port map(clock_main,preset,c0_en,clear,waves(3 downto 0)); wave: and_gates port map(waves(3 downto 0),preset,clock_main,c0_en,c0_c0,c1_c1,c2_c2,c3_c3,c0_c1,c2_c3,c0_c2,c1_c3);cnt : counter port map (clk_count , disable , clock_main , reset_count) ; mux_clock : mult_clock port map (clock_main , c0_c0 , io_mode , clear , incr) ;end rtl;乘法器的VHDL源程序:library ieee ;use ieee.std_logic_1164.all ;use ieee.std_logic_arith.all ;use ieee.std_logic_unsigned.all ;entity multiply isport(num_mux , num_rom : in std_logic_vector(31 downto 0) ;clock : in std_logic ;mult_out : out std_logic_vector(31 downto 0) ) ;end multiply ;architecture rtl of multiply isbeginprocess(num_mux , num_rom , clock)variable sign_mult , t : std_logic := '0' ;variable temp1 , temp2 : std_logic_vector(22 downto 0) ;variable exp_mux , exp_rom : std_logic_vector(7 downto 0) ;variable mant_temp : std_logic_vector(45 downto 0) ;variable exp_mult , mux_temp , rom_temp : std_logic_vector(8 downto 0) ; variable res_temp : std_logic_vector(31 downto 0) ;begintemp1 := '1' & num_mux(22 downto 1) ;temp2 := '1' & num_rom(22 downto 1) ;if (num_mux(31) = '1' and num_rom(31) = '1' and clock = '1') then sign_mult := '0' ;elsif (num_mux(31) = '0' and num_rom(31) = '0' and clock = '1') then sign_mult := '0' ;elsif(clock = '1') thensign_mult := '1' ;end if ;if (num_mux = 0 and clock = '1') thent := '1' ;elsif (num_rom = 0 and clock = '1') thent := '1' ;elsif (clock = '1') thent := '0' ;if (t = '0' and clock = '1') thenexp_mux := num_mux (30 downto 23) ;exp_rom := num_rom (30 downto 23) ;mux_temp := '0' & exp_mux(7 downto 0) ;rom_temp := '0' & exp_rom(7 downto 0) ;exp_mult := mux_temp + rom_temp ;exp_mult := exp_mult - 127 ;mant_temp := temp1 * temp2 ;if(mant_temp(45) = '1') thenexp_mult := exp_mult + 1 ;res_temp := sign_mult & exp_mult(7 downto 0) & mant_temp(44 downto 22) ; mult_out <= res_temp(31 downto 0) ;elsif(mant_temp(45) = '0') thenres_temp := sign_mult & exp_mult(7 downto 0) & mant_temp(43 downto 21) ; mult_out <= res_temp(31 downto 0) ;end if ;elsif (t = '1' and clock = '1') thenmult_out <= "00000000000000000000000000000000" ;t := '0' ;end if ;end process ;蝶形变换的VHDL源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity butterfly isport( clk :in std_logic;in1_r: in STD_LOGIC_VECTOR (3 downto 0); in1_i: in STD_LOGIC_VECTOR (3 downto 0); in2_r: in STD_LOGIC_VECTOR (3 downto 0); in2_i: in STD_LOGIC_VECTOR (3 downto 0); out1_r: out STD_LOGIC_VECTOR (7 downto 0); out1_i: out STD_LOGIC_VECTOR (7 downto 0); out2_r: out STD_LOGIC_VECTOR (7 downto 0); out2_i: out STD_LOGIC_VECTOR (7 downto 0); w_r:in STD_LOGIC_VECTOR (3 downto 0);w_i:in STD_LOGIC_VECTOR (3 downto 0));end butterfly;architecture butter of butterfly issignal a1 : STD_LOGIC_VECTOR (3 downto 0);signal b1 : STD_LOGIC_VECTOR (3 downto 0); signal a : STD_LOGIC_VECTOR (7 downto 0); signal b : STD_LOGIC_VECTOR (7 downto 0); signal c : STD_LOGIC_VECTOR (3 downto 0); signal ax : STD_LOGIC_VECTOR (7 downto 0); signal bx : STD_LOGIC_VECTOR (7 downto 0); signal cx : STD_LOGIC_VECTOR (7 downto 0); signal dx : STD_LOGIC_VECTOR (7 downto 0); beginprocess(clk)beginif(clk'event and clk='1')thena1<=in1_r;b1<=in1_i;a<=c&a1;b<=c&b1;ax<=w_r*in2_r;bx<=w_i*in2_i;cx<=w_r*in2_i;dx<=w_i*in2_r;out1_r<=a+ax-bx;out1_i<=b+cx+dx;out2_r<=a-ax+bx;out2_i<=b-cx-dx;end if;end process;end butter;交换器的VHDL源程序:library ieee ;use ieee.std_logic_1164.all ;use ieee.std_logic_arith.all ;use ieee.std_logic_unsigned.all ;entity swap isport (a : in std_logic_vector (31 downto 0) ;b : in std_logic_vector (31 downto 0) ;clock : in std_logic ;rst_swap , en_swap : in std_logic ;finish_swap : out std_logic ;d : out std_logic_vector (31 downto 0) ;large_exp : out std_logic_vector (7 downto 0) ;c : out std_logic_vector (32 downto 0 ) ) ; end swap ;architecture rtl of swap isbeginprocess (a , b , clock , rst_swap , en_swap) variable x , y : std_logic_vector (7 downto 0) ; variable p , q : std_logic_vector (22 downto 0) ; beginif(rst_swap = '1' ) thenc <= '0' & a(22 downto 0) & "000000000" ;finish_swap <= '0' ;elsif(rst_swap = '0') thenif(en_swap = '1') thenx := a (30 downto 23) ;y := b (30 downto 23) ;p := a (22 downto 0) ;q := b (22 downto 0) ;if (clock = '1') thenif (x < y) thenc <= '1' & a (22 downto 0) & "000000000" ;d <= '1' & b (22 downto 0) & "00000000" ;large_exp <= b (30 downto 23) ;finish_swap <= '1' ;elsif (y < x) thenc <= '1' & b (22 downto 0) & "000000000" ;d <= '1' & a (22 downto 0) & "00000000" ; large_exp <= a (30 downto 23) ;finish_swap <= '1' ;elsif ( (x=y) and (p < q)) thenc <= '1' & a (22 downto 0) & "000000000" ;d <= '1' & b (22 downto 0) & "00000000" ; large_exp <= b (30 downto 23) ;finish_swap <= '1' ;elsec <= '1' & b (22 downto 0) & "000000000" ;d <= '1' & a (22 downto 0) & "00000000" ; large_exp <= a (30 downto 23) ;finish_swap <= '1' ;end if ;end if ;end if ;end if ;end process;end rtl;输入输出的VHDL源程序:library ieee ;use ieee.std_logic_1164.all ;use ieee.std_logic_arith.all ;use ieee.std_logic_unsigned.all ;entity divide isport (data_in : in std_logic_vector(31 downto 0) ;data_out : out std_logic_vector(31 downto 0) ) ; end divide ;architecture rtl of divide isbeginprocess(data_in)variable divide_exp : std_logic_vector(7 downto 0) ; variable divide_mant : std_logic_vector(31 downto 0) ; beginif (data_in = "00000000000000000000000000000000") then data_out <= "00000000000000000000000000000000" ;elsif (data_in = "10000000000000000000000000000000") then data_out <= "00000000000000000000000000000000" ;elsedivide_exp := data_in(30 downto 23) ;divide_mant := data_in (31 downto 0) ;divide_exp := divide_exp - "00000001" ;data_out <= data_in(31 downto 0) ;end if ;end process ;end rtl ;调节器的VHDL源程序:library ieee ;use ieee.std_logic_1164.all ;use ieee.std_logic_arith.all ;use ieee.std_logic_unsigned.all ;entity cont_gen isport (con_staged , con_iod , con_fftd , con_init : in std_logic ;con_ip , con_op , con_iomode , con_fft : out std_logic ;con_enbw , con_enbor , c0_enable , con_preset : out std_logic ; con_clear , disable : out std_logic ;c0 , clock_main : in std_logic ;en_rom , en_romgen , reset_counter : out std_logic ;con_clkcount : in std_logic_vector(2 downto 0) ) ;end cont_gen ;architecture rtl of cont_gen istype state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;signal current_state , next_state : state ;shared variable counter , temp2 : std_logic_vector(1 downto 0) := "00" ;beginprocess (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0)begincase current_state iswhen rst1 =>con_iomode <= '1' ;con_ip <= '1' ;con_clear <= '1' ;con_enbw <= '1' ;con_enbor <= '0' ;c0_enable <= '0' ;disable <= '1' ;next_state <= rst2 ;when rst2 =>con_clear <= '0' ;next_state <=rst3 ;when rst3 =>if(con_iod = '1') thencon_preset <= '1' ;reset_counter <= '1' ;c0_enable <= '1' ;con_iomode <= '0' ;con_fft <= '1' ;en_rom <= '1' ;en_romgen <= '1' ;con_clear <= '1' ;con_enbw <= '0' ;con_enbor <= '1' ;disable <= '0' ;next_state <= rst4 ;elsenext_state <= rst3 ;end if ;when rst4 =>con_preset <= '0' ;reset_counter <= '0' ;con_clear <= '0' ;if (con_clkcount = 5) then con_enbw <= '1' ;disable <= '1' ;reset_counter <= '1' ;next_state <= rst5 ;elsenext_state <= rst4 ;end if ;when rst5 =>if (con_fftd = '1') then disable <= '0' ;reset_counter <= '0' ;con_clear <= '1' ;con_fft <= '0' ;if (con_clkcount = 4) then disable <= '1';con_enbw <= '0' ;con_iomode <= '1' ;con_op <= '1' ;con_ip <= '0' ;next_state <= rst6 ;elsenext_state <= rst5 ;end if ;elsenext_state <= rst5 ;end if ;when rst6 =>con_clear <= '0' ;next_state <= rst7 ;when rst7 =>if(con_iod = '1') thencon_clear <= '1' ;con_preset <= '1' ;con_enbor <= '0';elsenext_state <= rst7 ;end if ;when others =>next_state <= rst1 ;end case ;end process ;process(clock_main , con_init)beginif(con_init = '1') thencurrent_state <= rst1 ;elsif (clock_main'event and clock_main = '0') then current_state <= next_state ;end if ;end process ;end rtl ;只读存储器的VHDL源程序:library ieee ;use ieee.std_logic_1164.all ;use ieee.std_logic_arith.all ;use ieee.std_logic_unsigned.all ;entity rom isport (clock , en_rom : in std_logic ;romadd : in std_logic_vector(2 downto 0) ;rom_data : out std_logic_vector(31 downto 0) ) ; end rom ;architecture rtl of rom isbeginprocess(clock,en_rom)beginif(en_rom = '1') thenif(clock = '1') thencase romadd iswhen "000" =>rom_data <= "00111111100000000000000000000000" ;when "001" =>rom_data <= "00000000000000000000000000000000" ;when "010" =>rom_data <= "00111111001101010000010010000001" ; when "011" =>rom_data <= "00111111001101010000010010000001" ; when "100" =>rom_data <= "00000000000000000000000000000000" ; when "101" =>rom_data <= "00111111100000000000000000000000" ; when "110" =>rom_data <= "10111111001101010000010010000001" ; when "111" =>rom_data <= "00111111001101010000010010000001" ; when others =>rom_data <= "01000000000000000000000000000000" ; end case ;end if ;end if ;end process ;end rtl ;随机存储器的VHDL源程序:library ieee;use ieee.std_logic_1164.all;use IEEE.std_logic_arith.all;use IEEE.std_logic_unsigned.all;entity reg_dpram isport (data_fft , data_io : in std_logic_vector (31 downto 0); q : out std_logic_vector (31 downto 0);clock , io_mode : in std_logic;we , re : in std_logic;waddress: in std_logic_vector (3 downto 0);raddress: in std_logic_vector (3 downto 0));end reg_dpram;architecture behav of reg_dpram istype MEM is array (0 to 15) of std_logic_vector(31 downto 0); signal ramTmp : MEM;beginprocess (clock,waddress,we)beginif (clock='0') thenif (we = '1') thenif (io_mode = '0') thenramTmp (conv_integer (waddress)) <= data_fft ;elsif (io_mode = '1') thenramTmp (conv_integer (waddress)) <= data_io ; end if ;end if ;end if ;end process ;process (clock,raddress,re)beginif (clock='1') thenif (re = '1') thenq <= ramTmp(conv_integer (raddress)) ;end if;end if;end process;end behav;五、主要VHDL源程序仿真结果FFT总体结构的RTL视图fft总体结构的仿真乘法器的RTL视图乘法器的仿真蝶形运算的RTL视图蝶形运算的仿真交换器的RTL视图交换器的仿真输入输出的RTL视图输入输出的仿真调节器的RTL视图调节器的仿真只读存储器的RTL视图只读存储器的仿真随机存储器的RTL视图随机存储器的仿真六、硬件验证方案及验证结果本次实验由于是在家进行的,不能去实验室用实验箱进行实验,所以我估计芯片EP3C55F484C7的硬件结果应该是正确的。

相关文档
最新文档