基于FPGA的任意信号发生器毕业论文_第1页
基于FPGA的任意信号发生器毕业论文_第2页
基于FPGA的任意信号发生器毕业论文_第3页
基于FPGA的任意信号发生器毕业论文_第4页
基于FPGA的任意信号发生器毕业论文_第5页
已阅读5页,还剩56页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、基于fpga的任意信号发生器毕业论文 毕 业 设 计(论 文)设计 论文 题目: 基于fpga的任意信号发生器的设计 学生姓名: 郭定平 指导教师: 黄寒华 二级学院: 龙蟠学院 专业: 电子信息工程 班级: m07电子信息工程1班 学号: 0721113019 提交日期: 2011 年 05月15日 答辩日期:2011年 05月22日 目 录摘 要iiiabstractiv1 绪 论12 eda、vhdl简介22.1 eda技术22.2 硬件描述语言vhdl33 pld、quartus ii简介63.1可编程逻辑器件pld63.2 quartus ii基本使用方法64 数字系统设计84.1

2、数字系统的设计模型84.2 数字系统的设计方法85 任意信号发生器的简单设计过程105.1 系统需求分析105.2任意信号发生器的工作原理105.3 各组成模块及程序106 直接数字频率合成器206.1 直接数字合成器简介206.2系统设计需求206.3 系统设计方案206.4主要设计模块及程序216.5 正弦信号的vhdl程序实现307 系统仿真337.1 任意信号发生器的简单设计仿真337.2 直接数字频率合成器仿真378 基于fpga的硬件测试388.1 khf-1型fpga实验开发系统388.2 硬件测试39结束语40参考文献41致谢42基于fpga的任意信号发生器的设计摘 要关于信号

3、发生器,传统的设计方法多基于模拟电路或单片机或专用芯片,由于成本高或控制方式不灵活或波形种类少不能满足实际需求。本课题充分利用了现场可编程门阵列 fpga和vhdl语言的结合进行任意信号发生器的设计,从而易于修改和改进。用quartus ii对fpga芯片“下载”形成专用集成电路,由于不存在人工接线的问题,所以故障率低、可靠性好。系统按模块化方式进行设计,然后进行编译、时序仿真和硬件测试等。此设计采用了两种方法,一种是简单的设计方法,任意信号发生器由两大模块组成,即函数发生电路和函数选择电路。本论文还简单介绍基于dds技术的任意信号发生器的设计,它能高精度地产生多种基本波形,如正弦波等。关键词

4、: vhdl;fpga;quartus ii;eda;ddsfpga-based control system for any signal generator designabstractabout the signal generator, the traditional design method is based on the small and medium-scale integrated circuits,with a lot of circuit elements,complex wiring,high failure rate,and low reliability.this

5、 topic has used scene programmable gate array fpga and the vhdl language fully carried on the automobile taillight control systems design, making it easy to modify and improve.with quartus ii “downloading” fpga chip,it forms the specific integrated circuit.it does not have artificial connection,ther

6、efore the failure rate is low and the reliability is good. this design uses two methods, one is simple method, any signal generator is composed by two big modules . that is, a function generator and function select circuit. this paper alse introduces the design idea of function generator with multip

7、le signals based on dds technologyit can export four basic waveforms of higher precision such as sine wave and so on.keywords: vhdl; the fpga; quartus ii; eda;dds1绪 论波形发生器是各种测试和实验中不可或缺的工具,在通信、测量、雷达、控制、教学领域应用十分广泛。不论是在生产、科研还是教学上,波形发生器都是电子工程师进行信号仿真试验的最佳工具。随着我国经济和科技的发展,对相应的测试仪器和测试手段提出了更高的要求,而波形发生器已成为测试仪

8、器中至关重要的一类,因此开发波形发生器具有很大的意义。随着计算机与微电子技术的发展,电子设计自动化eda(electronic design automation)和可编程逻辑器件pld(programmable logic device)的发展都非常迅速,熟练地利用eda软件进行pld器件开发已成为电子工程师必须掌握的基本技能。先进的eda工具已经从传统的自下而上的设计方法改变为自顶向下的设计方法,以硬件描述语言hdl(hardware description language)来描述系统级设计,并支持系统仿真和高层综合。asic(application specific integrate

9、d circuit)的设计与制造,电子工程师在实验室就可以完成,这都得益于pld器件的出现及功能强大的eda软件的支持。现在应用最广泛的高密度pld器件主要是现场可编程门阵列fpga(field programmable gate array)和复杂可编程逻辑器件cpld(complex programmable logic device)。本次设计的目的就是通过实践深入理解pld,了解eda技术并掌握vhdl硬件描述语言的设计方法和思想。以计算机组成原理为指导,通过学习vhdl语言结合电子电路的设计知识理论联系实际,掌握所学的课程知识和基本单元电路的综合设计应用。通过对实用汽车尾灯控制器的设

10、计,巩固和综合运用所学知识,提高ic设计能力,提高分析、解决计算机技术实际问题的独立工作能力。设计作为数字电子技术课程的重要组成部分,一方面使我进一步理解课程内容,基本掌握数字系统设计和调试的方法,增加集成电路应用知识,培养我的实际动手能力以及分析、解决问题的能力另一方面也使我更好地巩固和加深对基础知识的理解,学会设计中小型数字系统的方法,独立完成调试过程,增强我理论联系实际的能力,提高电路分析和设计能力。通过实践引导我在理论指导下有所创新,为日后工程实践奠定基础。通过设计,一方面加深我的理论知识,另一方面也提高我考虑问题全面性,将理论知识上升到一个实践的阶段。?2 eda、vhdl简介2.1

11、 eda技术0. eda技术的概念及范畴 随着数字电子技术的飞速发展,信息化得到了有力的推动和促进,从与普通百姓生活息息相关的手机、计算机、数字电视,到关系到国家安定社会和谐的军用设备、航天技术,都采用了数字电子技术,它的应用已经渗透到人们生活的方方面面。现代电子设计技术的核心已逐步转向基于计算机的电子设计自动化技术,即eda(electronic design automation)。【1】所谓eda技术,就是以功能强大的计算机平台,以eda软件为工具,对用硬件描述语言hdl hardware description language 的系统逻辑设计文件,自动地完成逻辑编译、简化、分割、综合

12、、布局布线及逻辑优化和仿真测试的电子产品自动化设计过程。当然,随着eda技术的日渐成熟,也包括了如pspice、ewb、matlab等计算机辅助分析caa技术,如pretel、orcad等印刷制版计算机辅助设计,等等。?利用eda工具,电子设计师可以从概念、算法、协议等开始设计电子系统,大量工作可以通过计算机完成,并可以将电子产品从电路设计、性能分析到设计出ic版图或pcb版图的整个过程在计算机上自动处理完成。. eda技术的基本特征eda代表了当今电子设计技术的最新发展方向,它的基本特征是:设计人员按照“自顶向下”的设计方法,对整个系统进行方案设计和功能划分,系统的关键电路用一片或几片专用集

13、成电路(asic)实现,然后采用硬件描述语言(hdl)完成系统行为级设计,最后通过综合器和适配器生成最终的目标器件,这样的设计方法被称为高层次的电子设计方法。vhdl(very high speed integrated circuit hardware description language,超高速集成电路硬件描述语言)诞生于1982年,是由美国国防部开发的一种快速设计电路的工具,目前已经成为ieee(the institute of electrical and electronics engineers)的一种工业标准硬件描述语言。相比传统的电路系统的设计方法,vhdl具有多层次描述系

14、统硬件功能的能力,支持自顶向下(top to down)和基于库(librarybased)的设计的特点,因此设计者可以不必了解硬件结构。从系统设计入手,在顶层进行系统方框图的划分和结构设计,在方框图一级用vhdl对电路的行为进行描述,并进行仿真和纠错,然后在系统一级进行验证,最后再用逻辑综合优化工具生成具体的门级逻辑电路的网表,下载到具体的cpld器件中去,从而实现可编程的专用集成电路(asic)的设计。vhdl是一种面向设计的多领域、多层次的ieee标准硬件描述语言,是目前十分流行的硬件描述工具,并且被大多数eda工具支持。vhdl是一种全方位的硬件描述语言,包括系统行为级。寄存器传输级和

15、逻辑门级多个设计层次,支持结构、数据流和行为三种描述形式的混合描述,因此vhdl几乎覆盖了以往各种硬件俄语言的功能,整个自顶向下或由底向上的电路设计过程都可以用vhdl来完成。1)设计技术齐全,方法灵活,支持广泛,如支持自顶向下 top down 和基于库 library-based 的设计方法等,早在1987年就已作为ieee的标准;(2)系统硬件描述能力强,具有多层次描述系统硬件的能力,可以从系统的数学模型直到门级电路,并且高层次的行为描述可以与低层次的rtl描述、门级描述混合使用。强大的行为描述能力避开了具体的器件结构,是在逻辑行为上描述和设计大规模电子系统的重要保证。vhdl的宽范围描

16、述能力使它成为高层次设计的核心,从而决定了它成为系统设计领域最佳的硬件描述语言,并可进行系统的早期仿真以保证设计的正确性vhdl丰富的仿真语句和库函数,使得在任何大系统的设计早期就能查验设计系统功能的可行性,随时可对设计进行仿真模拟。 vhdl对设计的描述具有相对独立性,设计者可以不懂硬件的结构,也不必管理最终设计实现的目标器件是什么,而进行独立的设计。vhdl语言标准规范,易于移植、共享和重用。. 用vhdl设计电路主要的工作过程和设计流程(1)编辑。用文本编辑器输入设计的源文件(为了提高输入效率,可用某些专用编辑器)。通常vhdl文件保存为.vhd文件2)编译。用编译工具将文本文件编译成代

17、码文件,并检查语法错误。3)功能仿真(前仿真)。在编译前进行逻辑功能验证,此时的仿真没有延时,对于初步的功能检测非常方便。将文件调入hdl仿真软件进行功能仿真,检查逻辑功能是否正确4)逻辑综合。将设计的源文件用自动综合工具由语言转换为实际的电路图(门电路级网表),但此时还没有在芯片中形成真正的电路,就好像是把设计者脑海中的电路画成了原理图。将源文件调入逻辑综合软件进行综合,即把语言综合成最简的布尔表达式。逻辑综合软. 的eda工业标准文件。5)布局、布线。用已生成的网表文件,再根据cpld(或fpga)器件的容量和结构,用自动布局布线工具进行电路设计。首先根据网表文件内容和器件结构确定逻辑门的

18、位置,然后再根据网表提供的门连接关系,把各个门的输入输出连接起来,类似于设计pcb(印刷电路板)时的布局布线工作。最后生成一个供器件编程(或配置)的文件,同时还会在设计项目中增加一些时序信息,以便于后仿真。6)后仿真(时序仿真)。这是与实际器件工作情况基本相同的仿真,用来确定设计在经过布局、布线之后,是否仍能满足设计要求。如果设计的电路时延满足要求,则可以进行器件编程(或配置)。目前使用最广泛的可编程逻辑器件有两类:现场可编程门阵列(field programmable gate array,fpga)和复杂可编程逻辑器件(complex programmable logic device,c

19、pld)。的设计开发流程()设计输入()设计综合()仿真验证()设计实现()时序分析()下载验证数字系统设计的方法有很多,如模块设计法、自顶向下设计法和自底向上设计法等。10年前,电子设计的基本思路还是选择标准的集成电路“自底向上”地构造出一个新的系统。这种设计方法首先确定可用的元器件,然后根据这些器件进行逻辑设计,完成各模块后进行连接,最后形成系统。自底向上的设计方法如同一砖一瓦建造楼房,不仅效率低、成本高而且容易出错。而基于eda技术的设计方法这是自顶向下进行设计的。所谓自顶向下设计,就是将数字系统的整体逐步分解为各个子系统和模块,若子系统规模较大,则还需将子系统进一步分解为更小的子系统和

20、模块,层层分解,直到整个系统中各子系统关系合理,并便于逻辑级的设计和实现为止。这种方法从系统入手,在顶层进行功能方框图的划分和结构设计,在方框图一级进行仿真、纠错,并用硬件描述语言对高层的系统进行描述,在系统一级进行验证,然后用综合优先工具生成具体的门电路网表,其对应的物理实现级可以是印刷电路板或专用集成电路。由于设计的主要仿真和调试过程是在高层次上完成的,这既有利于早期发现结构设计上的错误,避免设计工时的浪费,同时也减少了逻辑功能仿真的工作量,提高了设计的一次成功率。自顶向下设计方法的优点可以归纳为以下几点:作为一种模块化设计方法,自顶向下的设计方法对设计的描述从上到下、从粗略到详细,符合常

21、规的逻辑思维习惯。对数字系统的设计采用硬件描述语言,使得设计可以在各种集成电路工艺或可编程器件之间移植。自顶向下设计方法使得高层设计完全独立于目标器件的结构,在设计的初级阶段,设计人员可以摆脱芯片结构的束缚,将精力集中在可以规避传统方法中的再设计风险的环节,缩短了产品的开发周期。自顶向下的设计方法便于对设计任务进行合理分配,通过科学的系统工程管理方法,由多个设计师同时进行设计,通过分工协作完成任务。 当然,针对具体的设计要求,数字系统的设计方法会有所不同。无论采用何种方法,都要始终坚持逐层分解功能和分层次进行设计这两条不变的原则。5 任意信号发生器的简单设计过程5.1 系统需求分析的工作原理图

22、2 信号发生器总框图5.3 各组成模块及程序个模块组成,分别为:.生电路模块函数发生电路要产生六种不同的波形,因此要针对每种波形函数设计对应的电路模块,每个模块的输入输出设置相同,但不同函数发生模块对输入信号的处理方式是不同的,仅以递增斜波函数发生电路为例,其模块如所示0输出波形函数。程序代码:1、递增斜波函数发生模块的vhdl源程序如下:library ieee;加载库文件use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity increase is 定义实体port clk,clr:in std_logic;q:

23、 out std_logic_vector 7 downto 0 ;end increase;architecture rtl of increase isbeginprocess clk,clr 启动进程variable tmp: std_logic_vector 7 downto 0 ;beginif clr 1 then信号清零tmp: 00000000;elsif clkevent and clk 1 thenif tmp 11111111 then 加法计数器满时,重新计数tmp: 00000000;else tmp: tmp+1; 否则加1,实现递增end if;end if;q

24、tmp;end process;end rtl;递减斜波函数发生模块的vhdl语言:library ieee; 加载库文件use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity decrease isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end decrease;architecture rtl of decrease isbeginprocess clk,clr 启动进程variable tmp: std_logic_vector

25、 7 downto 0 ;beginif clr 1 then 复位清零tmp: 11111111;elsif clkevent and clk 1 thenif tmp 00000000 then 减法计数器满时,重新计数tmp: 11111111;else tmp: tmp-1; 否则减1,实现递增end if;end if;q tmp;end process;end rtl;三角波函数发生模块的 vhdl源程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity delta i

26、s port clk ,clr:in std_logic; q:out std_logic_vector 7 downto 0 ;end delta;architecture rtl of delta isbegin process clk,clr -启动进程variable tmp:std_logic_vector 7 downto 0 ;variable tag:std_logic;begin if clr 1then -复位清零 tmp: 00000000; elsif clkevent and clk 1then if tag 0then 加法计数if tmp 11111110then

27、 加法计数器满 tmp: 11111111; tag: 1; 下一个时钟周期开始减法计数else tmp: tmp+1;加1操作end if;else if tmp 00000001then 减法计数器满 tmp: 00000000;tag: 0;下一时钟周期开始加法计数elsetmp: tmp-1;减1操作end if; end if;end if;q tmp;end process;end rtl;梯形波函数发生模块的vhdl语言:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity

28、ladder isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end ladder;architecture rtl of ladder isbeginprocess clk,clr 启动进程variable tmp: std_logic_vector 7 downto 0 ;variable tag: std_logic;beginif clr 1 then 复位清零tmp: 00000000;elsif clkevent and clk 1 thenif tag 0 thenif tmp 11111111 th

29、entmp: 00000000;tag: 1;elsetmp: tmp+16; 实现梯行波tag: 1;end if;elsetag: 0;end if;end if;q tmp;end process;end rtl;正弦波函数发生模块的vhdl语言:library ieee;加载库文件use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity sin is 定义实体 port clk,clr:in std_logic; q:out std_logic_vect

30、or 7 downto 0 ;end sin;architecture rtl of sin isbegin process clk,clr 启动进程variable tmp:integer range 0 to 63;定义整数型变量begin if clr 1 then 复位清零 q 00000000;elsif clkevent and clk 1then if tmp 63 then tmp: 0;else tmp: tmp+1;整数计数end if;将正弦函数对应的映射为二进制数case tmp is when 0 q conv_std_logic_vector 255,8 ; whe

31、n 1 q conv_std_logic_vector 254,8 ; when 2 q conv_std_logic_vector 252,8 ; when 3 q conv_std_logic_vector 249,8 ; when 4 q conv_std_logic_vector 245,8 ; when 5 q conv_std_logic_vector 239,8 ; when 6 q conv_std_logic_vector 233,8 ; when 7 q conv_std_logic_vector 225,8 ; when 8 q conv_std_logic_vector

32、 217,8 ; when 9 q conv_std_logic_vector 207,8 ; when 10 q conv_std_logic_vector 197,8 ; when 11 q conv_std_logic_vector 186,8 ; when 12 q conv_std_logic_vector 174,8 ; when 13 q conv_std_logic_vector 162,8 ; when 14 q conv_std_logic_vector 150,8 ; when 15 q conv_std_logic_vector 137,8 ; when 16 q co

33、nv_std_logic_vector 124,8 ; when 17 q conv_std_logic_vector 112,8 ; when 18 q conv_std_logic_vector 99,8 ; when 19 q conv_std_logic_vector 87,8 ; when 20 q conv_std_logic_vector 75,8 ; when 21 q conv_std_logic_vector 64,8 ; when 22 q conv_std_logic_vector 53,8 ; when 23 q conv_std_logic_vector 43,8

34、; when 24 q conv_std_logic_vector 34,8 ; when 25 q conv_std_logic_vector 26,8 ; when 26 q conv_std_logic_vector 19,8 ; when 27 q conv_std_logic_vector 13,8 ; when 28 q conv_std_logic_vector 8,8 ; when 29 q conv_std_logic_vector 4,8 ; when 30 q conv_std_logic_vector 1,8 ; when 31 q conv_std_logic_vec

35、tor 0,8 ; when 32 q conv_std_logic_vector 0,8 ; when 33 q conv_std_logic_vector 1,8 ; when 34 q conv_std_logic_vector 4,8 ; when 35 q conv_std_logic_vector 8,8 ; when 36 q conv_std_logic_vector 13,8 ; when 37 q conv_std_logic_vector 19,8 ; when 38 q conv_std_logic_vector 26,8 ; when 39 q conv_std_lo

36、gic_vector 34,8 ; when 40 q conv_std_logic_vector 43,8 ; when 41 q conv_std_logic_vector 53,8 ; when 42 q conv_std_logic_vector 64,8 ; when 43 q conv_std_logic_vector 75,8 ; when 44 q conv_std_logic_vector 87,8 ; when 45 q conv_std_logic_vector 99,8 ; when 46 q conv_std_logic_vector 112,8 ; when 47

37、q conv_std_logic_vector 124,8 ; when 48 q conv_std_logic_vector 137,8 ; when 49 q conv_std_logic_vector 150,8 ; when 50 q conv_std_logic_vector 162,8 ; when 51 q conv_std_logic_vector 174,8 ; when 52 q conv_std_logic_vector 186,8 ; when 53 q conv_std_logic_vector 197,8 ; when 54 q conv_std_logic_vec

38、tor 207,8 ; when 55 q conv_std_logic_vector 217,8 ; when 56 q conv_std_logic_vector 225,8 ; when 57 q conv_std_logic_vector 233,8 ; when 58 q conv_std_logic_vector 239,8 ; when 59 q conv_std_logic_vector 245,8 ; when 60 q conv_std_logic_vector 249,8 ; when 61 q conv_std_logic_vector 252,8 ; when 62

39、q conv_std_logic_vector 254,8 ; when 63 q conv_std_logic_vector 255,8 ;when others null;end case ;end if;end process;end rtl;方波函数发生模块的vhdl源程序如下:library ieee;加载库文件use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity square is port clk,clr:in std_logic; q:out std_logic_vector 7 downto 0

40、;end square;architecture rtl of square issignal tag:std_logic;begin process clk,clr 启动进程 variable cnt:integer range 0 downto 63;begin if clr 1then tag 0;elsif clkevent and clk 1then if cnt 63 then 时钟计数 cnt: cnt+1;else 时钟计数满,输出翻转cnt: 0;tag not tag;end if;end if;end process;给输出信号赋值process clk,tag begi

41、n if clkevent and clk 1then if tag 1then q 11111111; else q 00000000;end if;end if;end process;end rtl;.择模块 函数选择电路的本质是一个简单的译码器模块。其电路框图如图(2)所示。其中sel20为输出函数选择信号,根据该信号的取值,电路将选择输入信号d070d570中的某一组数据,作为输出信号在输出端q70输出。library ieee;use ieee.std_logic_1164.all;entity selecter is port sel:in std_logic_vector 2

42、downto 0 ;定义选择信号d0,d1,d3,d4,d5:in std_logic_vector 7 downto 0 ; q:out std_logic_vector 7 downto 0 ;end selecter;architecture rtl of selecter isbegin process sel 启动进程begin 选择译码 case sel is when 000 q d0; when 001 q d1; when 010 q d2; when 011 q d3; when 100 q d4; when 101 q d5; when others null; end

43、case ;end process;end rtl;5.4任意信号发生器的vhdl程序实现0为输出选择信号,该信号的不同取值对应递增斜波、递减斜波、三角波、梯形波、正弦波和方波六种不同波形输出;q70为输出信号,根据输出函数选择信号 sel2.0的取值输出相应的波形。顶层模块的vhdl源程序如下:library ieee;use ieee.std_logic_1164.all; 图 5entity top isport clk,clr:in std_logic;sel:in std_logic_vector 2 downto 0 ;q: out std_logic_vector 7 downt

44、o 0 ;end top;architecture rtl of top is定义元件:增、减、三角、正弦、梯形、方波六种函数发生电路和函数选择电路component increase isport clk,clr:in std_logic; q: out std_logic_vector 7 downto 0 ;end component increase;component decrease isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end component decrease;component del

45、ta isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end component delta;component ladder isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end component ladder;component sin isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end component sin;component squar

46、e isport clk,clr:in std_logic;q: out std_logic_vector 7 downto 0 ;end component square;component selecter isport sel: in std_logic_vector 2 downto 0 ;d0,d1,d2,d3,d4,d5:in std_logic_vector 7 downto 0 ;q: out std_logic_vector 7 downto 0 ;end component selecter;定义信号,signal d0: std_logic_vector 7 downto

47、 0 ;signal d1: std_logic_vector 7 downto 0 ;signal d2: std_logic_vector 7 downto 0 ;signal d3: std_logic_vector 7 downto 0 ;signal d4: std_logic_vector 7 downto 0 ;signal d5: std_logic_vector 7 downto 0 ;begin元件例化u1: increase port map clk,clr,d0 ;u2: decrease port map clk,clr,d1 ;u3: delta port map

48、clk,clr,d2 ;u4: ladder port map clk,clr,d3 ;u5: sin port map clk,clr,d4 ;u6: square port map clk,clr,d5 ;u7: selecter port map sel,d0,d1,d2,d3,d4,d5,q ;end rtl;任意信号发生器完整的电路原理图如图5所示 图 66 直接数字频率合成器6.1 直接数字合成器简介目前各大芯片制造厂商相继都推出采用先进cmos工艺生产的高性能和多功能的频率合成芯片(其中应用较为广泛的是ad公司的ad985系列),微电路设计者提供了多种选择。然而在某些场合,专用的

49、数字频率合成芯片在控制方式、置频速率等方面与系统的要求差距很大,这时如果用高性能的fpga器件设计符合自己需要的数字频率合成器电路就是一个很好的解决方法。直接数字频率合成器,一般简称dds(direct digital frequency synthesis,ddfs),是从相位概念出发直接合成所需要波形的一种新的频率合成技术。 dds的工作原理是以数控振荡器的方式产生频率、相位可控制的正弦波。dds电路包括基准时钟、频率累加器、相位累加器、幅度/相位转换电路、d/a转换器。频率累加器对输入信号进行累加运算,产生频率控制数据(frequency data 或相位步进量)。相位累加器由n位累加寄

50、存器级联而成,对代表频率的2进制码进行累加运算,是典型的反馈电路,产生累加结果。幅度/相位转换电路实质上是一个波形寄存器,以供查表使用。读出的数据送入d/a转换器和低通滤波器。6.2系统设计需求 设计一个正弦信号波形发生器。要求该系统的设计采用rom查找表法,要求该系统可以根据需要对频率控制字和相位控制字进行相位的设置,从而产生不同起始相位和频率的正弦波信号。6.3 系统设计方案 dds是数字式的频率合成器,数字式频率合成器要产生一个sinwt的正 弦信号的方法是:在每次系统时钟的触发沿到来时,输出相应相位的幅度值,每次相位的增值为wt t为系统时钟周期 。要得到每次相应相位的幅度值,一种简单

51、的方法是查表,即将02的正弦函数值分成n份,将各点的幅度值存到rom中,再用一个相位累加器每次累加相位值 wt,得到当前的相位值,通过查找rom得到当前的幅度值。 dds工作过程为:每次系统时钟的上升沿到来时,相位累加器(24位)中的值累加上频率寄存器(12位)中的值,再用累加器作为地址进行rom查表,查到的值送到da进行转换。这个过程需要几个时钟周期,但用vhdl设计,每个时钟周期每部分都在工作,实现了一个流水线的操作,实际计算一个正弦幅度值只用一个时钟周期,但是会有几个周期的延时。6.4主要设计模块及程序.加器相位累加器是dds最基本的组成部分,用于实现相位的累加并存储其累加结果。若当前相位累加器的值为n,经过一个周期后变为n+1,则满足: n+1 n+kn是等差数列,不难得出: n n*k+0其中,0为相位累加器的初始相位值。相位累加器的模块框图如右图所示,当时钟上升沿到来时,执行相位累加运算,并输出控制字。 相位累加器的模块框图 其程序代码如下:li

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论