基于FPGA的函数信号发生器的设计报告Word下载.docx

上传人:b****8 文档编号:22284835 上传时间:2023-02-03 格式:DOCX 页数:23 大小:169.54KB
下载 相关 举报
基于FPGA的函数信号发生器的设计报告Word下载.docx_第1页
第1页 / 共23页
基于FPGA的函数信号发生器的设计报告Word下载.docx_第2页
第2页 / 共23页
基于FPGA的函数信号发生器的设计报告Word下载.docx_第3页
第3页 / 共23页
基于FPGA的函数信号发生器的设计报告Word下载.docx_第4页
第4页 / 共23页
基于FPGA的函数信号发生器的设计报告Word下载.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

基于FPGA的函数信号发生器的设计报告Word下载.docx

《基于FPGA的函数信号发生器的设计报告Word下载.docx》由会员分享,可在线阅读,更多相关《基于FPGA的函数信号发生器的设计报告Word下载.docx(23页珍藏版)》请在冰豆网上搜索。

基于FPGA的函数信号发生器的设计报告Word下载.docx

第二层次是RTL方式描述。

这一层次称为寄存器传输描述(又称数据流描述)。

如前所述,用行为方式描述的系统结构的程序,其抽象程度高,是很难直接映射到具体逻辑元件结构的。

要想得到硬件的具体实现,必须将行为方式描述的VHDL语言程序改写为RTL方式描述的VHDL语言程序。

也就是说,系统采用RTL方式描述,才能导出系统的逻辑表达式,才能进行逻辑综合。

第三层次是逻辑综合。

即利用逻辑综合工具,将RTL方式描述的程序转换成用基本逻辑元件表示的文件(门级网络表)。

此时,如果需要,可将逻辑综合的结果以逻辑原理图的方式输出。

此后可对综合的结果在门电路级上进行仿真,并检查其时序关系。

应用逻辑综合工具产生的门网络表,将其转换成PLD的编程码,即可利用PLD实现硬件电路的设计。

由自上而下的设计过程可知,从总体行为设计开始到最终的逻辑综合,每一步都要进行仿真检查,这样有利于尽早发现设计中存在的问题,从而可以大大缩短系统的设计周期。

2、功能要求

(1)可以显示正弦波、方波、三角波。

(2)可以调幅。

(3)可以调频。

3、本人的工作

我主要负责软件的设计,不过一些子程序我是参考资料的,并不是都是我自己设计的。

二、设计方案

1、以下为软件内部结构简图:

用256进制计数器将50MHz的晶振进行分频通过8选1数据选择器进行频率选择从而实现频率调节。

通过波形产生模块产生各个波形,再通过8选1数据选择器选择输出的波形。

 

2、函数信号发生器的整个结构框图及工作原理

通过选择信号,选择要输出的波形输出,再经过D/A转换器将数字信号转换成模拟信号,再用运算放大器将电流信号转换成电压信号输出。

三、单元电路设计仿真结果与分析

1、内部框图

2、频率选择模块

256进制计数器

(1)程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycout256is

port(clk:

instd_logic;

q7,q6,q5,q4,q3,q2,q1,q0:

outstd_logic);

endcout256;

architectureoneofcout256is

signalqi:

std_logic_vector(7downto0);

begin

process(clk)

ifclk'

eventandclk='

1'

then

if(qi=255)then

qi<

="

00000000"

;

elseqi<

=qi+1;

endif;

endprocess;

q7<

=qi(7);

q6<

=qi(6);

q5<

=qi(5);

q4<

=qi(4);

q3<

=qi(3);

q2<

=qi

(2);

q1<

=qi

(1);

q0<

=qi(0);

endone;

(2)波形

(3)分析

若reset为‘1’,表示复位有效,对波形复位,否则判断脉冲信号输入是否为上升沿。

如果为上升沿脉冲,进行加计数,实现256进制计数。

频率选择

(1)程序

entitymux81is

port(sel:

instd_logic_vector(2downto0);

d0,d1,d2,d3,d4,d5,d6,d7:

q:

endmux81;

architecturetwoofmux81is

begin

q<

=d0whensel="

000"

else

d1whensel="

001"

d2whensel="

010"

d3whensel="

011"

d4whensel="

100"

d5whensel="

101"

d6whensel="

110"

d7whensel="

111"

null;

endtwo;

若reset为‘1’,表示复位有效,对波形复位,否则判断脉冲信号输入是否为上升沿。

如果为上升沿脉冲,当sel=“000”时,输出q=d0;

当sel=“001”时,输出q=d1;

当sel=“010”时,输出q=d2;

当sel=“011”时,输出q=d3;

当sel=“100”时,输出q=d4;

当sel=“101”时,输出q=d5;

当sel=“110”时,输出q=d6;

当sel=“111”时,输出q=d7;

3、递增锯齿波模块

useieee.std_logic_arith.all;

entityjuchizengis

port(clk:

reset:

dout:

outstd_logic_vector(7downto0));

endjuchizeng;

architecturethreeofjuchizengis

signalq:

process(clk,reset,q)

ifreset='

else

ifclk='

andclk'

eventthen

ifq<

255thenq<

=q+1;

elseq<

endif;

endprocess;

dout<

=q;

endthree;

当计数值为255时,清零,再加1计数

如果为上升沿脉冲,将进行计数。

在进行计数时,先判断当前计数值是否为“11111111”;

若是则将计数值清零,否则进行加1计数。

4、正弦波模块

entitysineis

port(clk:

reset:

endsine;

architecturefourofsineis

signalcnt_val:

integer;

u1:

process(clk,reset)

variablecnt:

integerrange0to63;

cnt:

=0;

elsifclk'

ifcnt=63then

=cnt+1;

cnt_val<

=cnt;

endprocessu1;

u2:

process(cnt_val)

casecnt_valis

when0=>

11111111"

when1=>

11111110"

when2=>

11111100"

when3=>

11111001"

when4=>

11110101"

when5=>

11101111"

when6=>

11101001"

when7=>

11100001"

when8=>

11011001"

when9=>

11001111"

when10=>

11000101"

when11=>

10111010"

when12=>

10101110"

when13=>

10100010"

when14=>

10010110"

when15=>

10001001"

when16=>

01111100"

when17=>

01110000"

when18=>

01100011"

when19=>

01010111"

when20=>

01001011"

when21=>

01000000"

when22=>

00110101"

when23=>

00101011"

when24=>

00100010"

when25=>

00011010"

when26=>

00010011"

when27=>

00001101"

when28=>

00001000"

when29=>

00000100"

when30=>

00000001"

when31=>

when32=>

when33=>

when34=>

when35=>

when36=>

when37=>

when38=>

when39=>

when40=>

when41=>

when42=>

when43=>

when44=>

when45=>

when46=>

when47=>

when48=>

when49=>

when50=>

when51=>

when52=>

when53=>

when54=>

when55=>

when56=>

when57=>

when58=>

when59=>

when60=>

when61=>

when62=>

when63=>

whenothers=>

null;

endcase;

endprocessu2;

endfour;

若reset为‘1’时,表示复位有效,对波形抚慰,否则判断脉冲信号输入是否为上升沿,如果为上升沿脉冲,将进行采样次数的计数。

在进行计数时,先判断当前计数值是否为63,若否(即采样了64次),将计数值置为‘0’;

否则进行加1计数。

5、方波模块

entitysquareis

port(clk,clr:

outintegerrange0to255);

endsquare;

architecturefiveofsquareis

signala:

bit;

process(clk,clr)

if(clr='

)then

a<

='

0'

elsif(clk'

)then

ifcnt<

63then

else

=nota;

process(clk,a)

if(clk'

if(a='

=255;

endfive;

若reset为‘1’时,表示复位有效,对波形复位;

否则判断脉冲信号输入是否为上升沿。

在进行计数时,先判断当前计数值是否为“11111111”,若是则将计数值置为“00000000”;

再判断当前计数值是否为小于或等于“01000000”,若是,则将sign置为‘1‘,否则sign置为’0‘。

占空比为1:

1.

6、三角波模块

entitytriais

port(CLK:

dout:

endtria;

architecturesixoftriais

process(CLK,reset)

variableQ:

variablesign:

std_logic;

Q:

sign:

elsifCLK'

eventandCLK='

ifsign='

ifQ="

then

Q:

sign:

=Q+'

=Q-'

=Q;

endsix;

加计数

减计数

若reset为‘1’时,表示复位有效,对波形复位,并将计数方向清零,否则判断脉冲信号输入是否为上升沿。

在进行计数时,先判断计数方向是否为‘0’,若为‘0’则进行加计数,否则进行减计数,sign为‘0’时先判断当前计数值是否为“11111110”,如果是,则将计数值置为“11111111”,并将sign置为‘1’,为减计数做好准备;

否则进行加‘1’计数。

Sign为‘1’时,先判断当前计数值是否为“00000001”,如果是,则将计数值置为“00000000”,并将sign置为‘0‘,为加计数做好准备;

否则加1计数。

7、递减锯齿波

entityjuchijianis

port(clk:

endjuchijian;

architecturesevenofjuchijianis

then

q<

elseq<

=q-'

endseven;

当计数值为0时,则将计数值置为255

在进行计数时,先判断当前计数值是否为“00000000”;

若是则将计数值置为“11111111”,否则进行减1计数。

8、阶梯波

entityjietiis

port(clk:

instd_logic;

outstd_logic_vector(7downto0));

endjieti;

architectureeightofjietiis

process(clk,reset)

variableQ:

ifreset='

elsifclk'

ifq="

else

=q+16;

dout<

endeight;

若reset为‘1’,表示复位有效,对波形复位;

在进行计数时,先判断当前计数值是否为“11111111”,如果是,则将计数值置为“00000000”;

否则进行加16计数。

四、顶层电路的设计仿真结果与分析

entityxinhaois

port(clk1:

reset1:

sel0,sel:

q1

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工作范文 > 制度规范

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1