函数信号发生器设计EDA大作业.docx
- 文档编号:10182439
- 上传时间:2023-02-09
- 格式:DOCX
- 页数:11
- 大小:116KB
函数信号发生器设计EDA大作业.docx
《函数信号发生器设计EDA大作业.docx》由会员分享,可在线阅读,更多相关《函数信号发生器设计EDA大作业.docx(11页珍藏版)》请在冰豆网上搜索。
函数信号发生器设计EDA大作业
EDA课程设计大作业
设计题目:
函数信号发生器设计
学生姓名:
学号:
专业班级:
20012年05月28日
函数信号发生器
1.设计背景和设计方案
1.1设计背景
在电子工程、通信工程、自动控制、遥测控制、测量仪器、仪表和计算机等技术领域,经常需要用到各种各样的信号波形发生器。
随着集成电路的迅速发展,用集成电路可很方便地构成各种信号波形发生器。
用集成电路实现的信号波形发生器与其它信号波形发生器相比,其波形质量、幅度和频率稳定性等性能指标,都有了很大的提高。
函数信号发生器是一种在科研和生产中经常用到的基本波形发生器,随着大规模集成电路的迅速发展,多功能信号发生器已被制作成专用集成电路,例如ICL8038单片函数波形发生器,可以产生精度较高的正弦波、方波、矩形波、锯齿波等多种信号。
1.2设计方案及实现
函数信号发生器由递增斜波(zeng),递减斜波产生模块(jian),方波产生模块(square),三角波产生模块(san),正弦波产生模块(sin)和输出波形选择模块(choice)组成。
总体设计框图如图所示,图中输出q需要接到外部D/A转换的数据输入端,将数字信号转换为模拟信号,在D/A转换器的输出端即可得到各种不同的函数信号波形。
如果输出脉冲波形边沿跳变不理想,可加低通滤波器来加以完善。
将各个模块分开来设计,先设计各个模块的程序,让后将程序生成对应的元件,然后再将这些元件链接到一起组成完整的硬件电路
1.3各模块程序及生成模块
1.3.1递减斜波产生模块
模块程序如下:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityjianis
port(clk,reset:
instd_logic;//定义输入输出端口
q:
outstd_logic_vector(7downto0));//定义波形输出端口
endjian;
architecturejian_arcofjianis
begin
process(clk,reset)//模块进程
variabletmp:
std_logic_vector(7downto0);//定义7位逻辑位变量
begin
ifreset='0'then//复位有效
tmp:
="11111111";//为变量赋值全1
elsifclk'eventandclk='1'then//时钟有效时
iftmp="00000000"then//当前变量值为全0时
tmp:
="11111111";//为变量赋值为全1
else
tmp:
=tmp-1;//不为全0时,当前变量值减1
endif;
endif;
q<=tmp;//变量值赋给q
endprocess;
endjian_arc;
生成的元件图:
1.3.2递增斜波产生模块
模块程序如下:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityzengis
port(clk,reset:
instd_logic;//定义时钟,复位端口
q:
outstd_logic_vector(7downto0));//定义波形输出端口
endzeng;
architecturezeng_arcofzengis
begin
process(clk,reset)//模块进程
variabletmp:
std_logic_vector(7downto0);//定义7位逻辑位变量
begin
ifreset='0'then//复位有效
tmp:
="00000000";//为变量赋值为全0
elsifclk'eventandclk='1'then//时钟有效
iftmp="11111111"then//当前为全1时
tmp:
="00000000";//为变量赋值为全0
else
tmp:
=tmp+1;//若不为全1,变量加1
endif;
endif;
q<=tmp;//将变量值付给q
endprocess;endzeng_arc
生成的元件图:
1.3.3三角波产生模块
模块程序如下:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysanis
port(clk,reset:
instd_logic;//定义时钟,复位端口
q:
outstd_logic_vector(7downto0));//定义七位波形输出端口
endsan;
architecturesan_arcofsanis
begin
process(clk,reset)//模块进程
variabletmp:
std_logic_vector(7downto0);//定义7位逻辑位变量
variablea:
std_logic;//定义1位逻辑位变量
begin
ifreset='0'then//复位有效
tmp:
="00000000";//当前变量赋值为全0
elsifclk'eventandclk='1'then//时钟有效
ifa='0'then//当a为0时
iftmp="11111110"then//判断当前变量值是否为指定值
tmp:
="11111111";//若为指定值变量赋值为全1
a:
='1';//a赋值为1
else
tmp:
=tmp-1;//若不为指定值变量值减1
endif;
else
iftmp="00000001"then//判断当前变量值是否为指定值
tmp:
="00000000";//若为指定值变量赋值为全0
a:
='0';//a赋值为0
else
tmp:
=tmp-1;//若不为变量值变量值减1
endif;endif;endif;
q<=tmp;//将变量值付给q
endprocess;endsan_arc;
生成的元件图:
1.3.4方波产生模块
模块程序如下:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysquareis
port(clk,clr:
instd_logic;//定义时钟,清除端口
q:
outintegerrange0to255);//定义整型输出端口,范围为0-255
endsquare;
architecturesquare_arcofsquareis
signala:
bit;//定义信号位a
begin
process(clk,clr)//模块进程
variablecnt:
integerrange0to63;//定义整型变量cnt,范围为0-63
begin
ifclr='0'then//判断清除端是否为0
a<='0';//若为0,a赋值为0
elsifclk'eventandclk='1'then//时钟有效
ifcnt<63then//判断cnt是否小于63
cnt:
=cnt+1;//若小于63,则变量加1
else
cnt:
=0;//否则变量赋值为0
a<=nota;//a取反再赋给a
endif;endif;endprocess;
Process(clk,a)
begin
ifclk'eventandclk='1'then//时钟有效
ifa='1'then//判断a是否为1
q<=255;//若为1,q赋值为255
else
q<=0;//不为1,q赋值为0
endif;endif;endprocess;endsquare_arc;
生成的元件图:
1.3.5正弦波产生模块
模块程序如下:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysinis
port(clk,clr:
instd_logic;//定义时钟,清除端口
d:
outintegerrange0to255);//定义整型输出端口,范围为0-255
endsin;
architecturesin_arcofsinis
begin
process(clk,clr)//模块进程
variabletmp:
integerrange0to63;//定义整型变量,范围为0-63
begin
ifclr='0'then//清除端有效
d<=0;//输出赋值为0
elsifclk'eventandclk='1'then//时钟有效
iftmp=63then//判断变量值是否为63
tmp:
=0;//若为63,变量赋值为0
else
tmp:
=tmp+1;//若不为63,变量值加1
endif;
casetmpis//变量tmp的各种情况
when00=>d<=255;when01=>d<=254;when02=>d<=252;
when03=>d<=249;when04=>d<=245;when05=>d<=239;
when06=>d<=233;when07=>d<=225;when08=>d<=217;
when09=>d<=207;when10=>d<=197;when11=>d<=186;
when12=>d<=174;when13=>d<=162;when14=>d<=150;
when15=>d<=137;when16=>d<=124;when17=>d<=112;
when18=>d<=99;when19=>d<=87;when20=>d<=75;
when21=>d<=64;when22=>d<=53;when23=>d<=43;
when24=>d<=34;when25=>d<=26;when26=>d<=19;
when27=>d<=13;when28=>d<=8;when29=>d<=4;
when30=>d<=1;when31=>d<=0;when32=>d<=0;
when33=>d<=1;when34=>d<=4;when35=>d<=8;
when36=>d<=13;when37=>d<=19;when38=>d<=26;
when39=>d<=34;when40=>d<=43;when41=>d<=53;
when42=>d<=64;when43=>d<=75;when44=>d<=87;
when45=>d<=99;when46=>d<=112;when47=>d<=124;
when48=>d<=137;when49=>d<=150;when50=>d<=162;
when51=>d<=174;when52=>d<=186;when53=>d<=197;
when54=>d<=207;when55=>d<=217;when56=>d<=225;
when57=>d<=233;when58=>d<=239;when59=>d<=245;
when60=>d<=249;when61=>d<=252;when62=>d<=254;
when63=>d<=255;whenothers=>null;
endcase;endif;endprocess;endsin_arc;
生成的元件图:
1.3.6波形选择模块
模块程序如下:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitychoiceis
port(sel:
instd_logic_vector(2downto0);//定义三位选择码
d0,d1,d2,d3,d4:
instd_logic_vector(7downto0);//定义波形输入端口
q:
outstd_logic_vector(7downto0));//定义波形输出端口
endchoice;
architecturechoice_arcofchoiceis
begin
process(sel)//定义选择进程
begin
caseselis
when"000"=>q<=d0;//选择递减斜波模块
when"001"=>q<=d1;//选择递增斜波模块
when"010"=>q<=d2;//选择三角波模块
when"011"=>q<=d3;//选择方波模块
when"100"=>q<=d4;//选择正弦波模块
whenothers=>null;
endcase;
endprocess;
endchoice_arc;
生成的元件图:
2.方案实施
reset为复位信号,clk为时钟信号,sel波形选择信号输入口。
具体的实现效果为当信号reset为低电平时,既复位端无效。
当sel信号为‘000’时选择递减斜波产生模块,波形由选择模块choice上的q[7..0]输出,数字信号波形如图1所示。
图1递减斜波
当sel信号为‘001’时选择递增斜波产生模块,波形由选择模块choice上的q[7..0]输出,数字信号波形如图2所示。
图2递增斜波
当sel信号为‘010’时选择三角波信号产生模块,波形由选择模块choice上的q[7..0]输出,数字信号波形如图3所示。
图3三角波
当sel信号为‘011’时选择方波信号产生模块,波形由选择模块choice上的q[7..0]输出,数字信号波形如图4所示。
图4方波
当sel信号为‘100’时选择正弦波信号产生模块,波形由选择模块choice上的q[7..0]输出,数字信号波形如图2.5所示。
图5正弦波
3.结果与结论
仿真结果,经过多次调试达到预期效果。
本次设计采用了模块化的设计方法,将各个模块分开来设计,设计并仿真好一个模块的电路后再设计另外一个模块,这样便于检查错误和定位修改错误,为最后模块之间的组成提供方便。
程序设计值归结于软件的仿真结果,系统的搭建和实物的构造可以借鉴,不能完全照搬!
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 函数 信号发生器 设计 EDA 作业