完整版试验四:序列发生器与检测器的设计_第1页
已阅读1页,还剩9页未读 继续免费阅读

付费下载

下载本文档

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

文档简介

1、®南昌大学实验报告学生姓名:学号:专业班级:实验类型:验证口综合设计创新实验日期:11.16实验成绩:实验四序列信号发生器与检测器设计一、实验目的1、了解序列检测器的工作原理。2、掌握时序电路设计中状态机的应用。3、进一步掌握用VHDL语言实现复杂时序电路的设计过程。二、实验内容要求用状态机设计实现串行序列检测器的设计,先设计(可用原理图输入法)序列信号发生器,产生序列:0111010011011010再设计检测器,若检测到串行序列1101QM输出为“1;否则输出为“0;并对其进行仿真和硬件测试。1、序列检测器用于检测一组或多组有二进制码组成的脉冲序列信号。这种检测要求检测器必须记住

2、前一次的正确码及正确序列,直到在连续的检测中所收到的每一位都与预置数的对应码相同。在检测过程中,任何一位不相等都将回到相应状态,重新开始检测。序列发生器和检测器分别用上升沿和下降沿比较好,否则会在开始多一位或少一位。2、信号发生器和检测器工程文件要保存在同一文件夹中才能调用;仿真时尽量避开发生信号和检测信号同时跳变,避免毛刺出现。2、在实验箱上验证时,设计的输入可用脉冲键+琴键组合输入任意序列,并用LED灯串行移位显示出来,随后将检测到的11010数目用静态数码管显示出来。三、实验原理序列检测器的作用就是从一系列的码流中找出用户希望出现的序列,该电路的核心部分就是状态机转换检模块,通过VHDL

3、语言的CASE-WHEN顺序语句判断输入条件来选择某一状态的执行,达到以此判断执行的效果。其中,本实验所设计状态机的状态转换图如下4-3所示。SourceStateDestinationStateCondition1eO就(Ixlout)2eO式(xlout)3sisO(ixlout)4si支(xlout5s2式(xlout)6s3(ixlout)7s3sO(islout)e3(xlout9(xlout)1054s511工5sO(ixlout)12工5si(xlout)图4-3序列信号检测器状态转换图由图可以看出,初始状态为SO,当检测到输入的序列为1时,状态跳转至S1;检测到0时,原地等待;

4、在S1状态下,当检测到0时跳转至SO,检测到1时跳转至S2;在S2状态下,当检测到0时跳转至S3,检测到1时跳转至S2;在S3状态下,当检测到1时跳转至S4,检测到0时仍跳转至SO;在S4状态下,当检测到0时跳转至S5,检测到1时跳转至S2;在S5状态下,当检测到0时跳转至S0,检测到1时跳转至S1;即实现了对序列11010的检测。四、实验步骤1、打开QUARTUSII软件,新建一个工程。取名为wanexp20;2、在该工程目录下,建立六个VHD文件,编辑六个功能模块程序,分别实现六种不同功能,其实验程序如下所示-实验名称:序列信号发生器与检测器设计- -参考自课本- -共分为6个进程- -实

5、验日期:2012-11-16- -进程pl;- -实验共能是分频;- -clk为输入10khz时钟信号,clklhz为分频输出1hz信号;libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityp1isport(clk:instd_logic;clk1hz:outstd_logic);endp1;architecturebehaveofp1issignalClk_Count1:std_logic_vector(13downto0);beginprocess(clk)beginif(Clk'e

6、ventandClk='1')thenif(Clk_Count1<10000)thenClk_Count1<=Clk_Count1+1;elseClk_Count1<="00000000000001”;endif;endif;endprocess;Clk1Hz<=Clk_Count1(13);endbehave;- -进程p2- -实现功能为序列信号发生器- -clk1hz为输入1hz分频信号,xlout为输出信号位libraryieee;useieee.std_logic_1164.all;entityp2isport(clk1hz:inst

7、d_logic;xlout:outstd_logic);endentity;architecturebhvofp2issignalbs:std_logic_vector(15downto0):="0111010011011010”;beginxlout<=bs(15);-将bs的最高位复值给xloutprocess(clklhz)beginif(clk1hz'eventandclk1hz='1')thenbs<=bs(14downto0)&bs(15);-通过&,实现序列的循环位移。endif;endprocess;endbhv;-

8、 -进程p3- -实现功能为采用状态机实现序列检测- -clr为输入初始设置信号,功能是初始时将状态设置为s0,并使dclk=0;libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityp3isport(clr:instd_logic;clk1hz:instd_logic;-输入1hz信号频率xlout:instd_logic;-输入序列result:outstd_logic-输出结果,若检测到目标序列,则输出高电平。endentity;architecturebhvofp3istypestate_

9、valueis(s0,s1,s2,s3,s4,s5);-定义state_value数据类型,其为五个状态组成signalstate:state_value;signaldclk:std_logic;beginresult<=dclk;process(clr,clk1hz)beginif(clr='0')thenstate<=s0;dclk<='0'-检测输入序歹U"11010”由左开始elsif(clk1hz'eventandclk1hz='0')thencasestateiswhens0=>ifxlou

10、t='1'thenstate<=s1;elsestate<=s0;endif;whens1=>ifxlout='1'thenstate<=s2;elsestate<=s0;endif;whens2=>ifxlout='0'thenstate<=s3;elsestate<=s2;endif;whens3=>ifxlout='1'thenstate<=s4;elsestate<=s0;endif;whens4=>ifxlout='0'thensta

11、te<=s5;dclk<='1'elsestate<=s2;endif;whens5=>ifxlout='0'thenstate<=s0;elsestate<=s1;endif;dclk<='0'whenothers=>state<=s0;endcase;endif;endprocess;endbhv;- -进程p4- -实现功能为xlout的串行移位输出,由led灯的亮灭来显示,便于观察最近xlout的五个值- -其中xlout作为输入信号,其为信号发生器的输出libraryieee;use

12、ieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityp4isport(clk1hz:instd_logic;xlout:instd_logic;ledag:bufferstd_logic_vector(4downto0);endp4;architecturebehaveofp4isbeginprocess(clk1hz)beginif(clk1hz'eventandclk1hz='1')thenledag(4)<=ledag(3);-实现串行移位;ledag(3)<=ledag(2);le

13、dag(2)<=ledag(1);ledag<=ledag(0);ledag(0)<=xlout;endif;endprocess;endbehave;- -进程p5- -实现功能为序列计数器,即计算检测到的目标序列个数libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityp5isport(Result:instd_logic;d6,d7:outstd_logic_vector(3downto0);endentity;architecturebehaveofp5issignalc

14、nt0,cnt1:std_logic_vector(3downto0):="0000"beginprocess(result)beginif(result'eventandresult='0')thenif(cnt0="1001"andcnt1="1001")thencnt0<="0000"cnt1<="0000"elsif(cnt0="1001")thencnt0<="0000"cnt1<=cnt1+1;e

15、lsecnt0<=cnt0+1;endif;endif;endprocess;d6<=cnt1;d7<=cnt0;endbehave;- -进程p6- -实现功能为数码管的动态扫描显示- -clk为10khz输入时钟信号libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityp6isport(clk:instd_logic;sel0,sel1:bufferstd_logic;sg:outstd_logic_vector(6downto0);sel:outstd_logic_vect

16、or(7downto0);-数码管位选通信号d6,d7:instd_logic_vector(3downto0)-d6为计数个位,d7为计数十位);endp6;architecturebehaveofp6issignalcnt:std_logic_vector(1downto0);signalA:std_logic_vector(3downto0);beginprocess(clk)beginifclk'eventandclk='1'thenifcnt<"01"thencnt<=cnt+1;elsecnt<=(others=>

17、'0');endif;endif;sel(0)<=sel0;sel(1)<=sel1;casecntis-两位数码管的动态扫描,本实验需要两个数码管when"00"=>sel1<='0'sel0<='1'A<=d7;when"01"=>sel1<='0'sel0<='0'A<=d6;whenothers=>null;endcase;endprocess;process(A)-数码管七段显示begincaseAi

18、swhen"0000"=>sg<="0111111"when"0001"=>sg<="0000110"when"0010"=>sg<="1011011"when"0011"=>sg<="1001111"when"0100"=>sg<="1100110"when"0101"=>sg<="110110

19、1"when"0110"=>sg<="1111101"when"0111"=>sg<="0000111"when"1000"=>sg<="1111111"when"1001"=>sg<="1101111"whenothers=>null;endcase;endprocess;endbehave;3、对上述程序分别进行编译保存,通过后在通过File->create/update->createsymbolfilesforcurrentfile,将上述六个功能模块分别生成原理图形式,结果如下所示:f诲1至伊刈-0exp20后按下图所示进行连线。4、新建立一个bdf文件,保存在该工程目录下,命名为五、功能仿真1、验证序列产生器p2输出xlout波形,从图中可观察得到,xlout为反复循环输出“0111010011011010"5实验程序所设定的值相同。O

温馨提示

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

最新文档

评论

0/150

提交评论