使用D触发器设计一个11001序列检测器_第1页
使用D触发器设计一个11001序列检测器_第2页
使用D触发器设计一个11001序列检测器_第3页
使用D触发器设计一个11001序列检测器_第4页
使用D触发器设计一个11001序列检测器_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

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

文档简介

1、讨论使用D触发器设计一个11001序列检测器,讨论序列可交迭(Overlap)检测和不可交迭检测在设计上的区别,讨论分别采用Mealy机设计和采用Moore机设计的区别,讨论未用状态的处理问题。【要求】给出电路原理图或HDL代码,要求进行仿真,并给出仿真结果。1.原件介绍D触发器(74LS74)、“与”门(74LS08)、“或”门(74LS32)、“非”门(74LS04), 集成电路引脚2.设计思路根据要求,设计的序列检测器有一个外部输入x和一个外部输出Z。输入和输出的逻辑关系为:当外部输入x第一个为"1",外部输出Z为"0";当外部输入x第二个为&qu

2、ot;1",外部输出Z为"0";当外部输入第三个x为"0",外部输出Z为"0",当外部输入第四个x为“0”,外部输出Z为0,当外部输入第五个x为“1”,外部输出Z为“1”。假定有一个外部输入x序列以及外部输出Z为:输入X011100101输出Y000000100 要判别序列检测器是否连续接收了"11001",电路必须用不同的状态记载外部输入x的值。假设电路的初始状态为A,x 输入第一个"1",检测器状态由A装换到B,用状态B记载检测器接受了"11001"序

3、列的第一个"1",这时外部输出Z=0;x输入第二个"1",检测器状态由B装换到C,用状态C记载检测器接了“11001”序列的第二个"1",外部输出Z=0;x输入第三个"0",检测器状态由C装换到D,外部输出Z=0;x输入第四个为“0”,检测器状态由D装换到E,外部输出Z=0;x输入第五个为“1”,检测器状态由E装换到F,外部输出Z=1。然后再根据外部输入及其他情况时的状态转移,写出相应的输出。以上分析了序列检测器工作,由此可画出原始状态图。根据原始状态图可列出原始状态表。 00000011001010FEDCAB0

4、0001010状态转换表现态X01AA0B0BA0C0CD0B0DE0A0EA0F1ZAQ2Q1Q0000001010011100000000100001 Q2*AQ2Q1Q0000001011010110000010100000Q1*AQ2Q1Q0000001011010110000100101100Q0*AQ2Q1Q0000001011010110000100110010得到状态方程和输出方程Z=AQ2*=Q1*=Q0*=D2=Q2*D1=Q1*D0=Q0* 3.未用状态关于未用状态涉及到了D触发器自启动的检验:前一状态为 111时,Q3*=A; Q2*=0; Q1*=A,下一状态为有效状

5、态。前一状态为110时,Q3*=A; Q2*=1; Q1*=1,对A值分类讨论:A=0,下一状态为有效状态;A=1,下一状态为111,再下一个状态为有效状态。4.实际代码设计与仿真MOORE机有交迭的程序设计library ieee;use ieee.std_logic_1164.all;entity schk is   port(din,clk,rst:in std_logic;      sout:out std_logic);end

6、0;schk;architecture behave of schk is   type states is(s0,s1,s2,s3,s4,s5);   signal st,nst:states :=s0;begin com: process(st,din) begin  case st is     when s0=>&

7、#160;if din='1' then nst <=s1;else nst <= s0;end if;   when s1=> if din='1' then nst <=s2;else nst <= s0;end if;   when s2=> if din

8、='0' then nst <=s3;else nst <= s0;end if;   when s3=> if din='0' then nst <=s4;else nst <= s0;end if;   when s4=> if din='1'

9、0;then nst <=s5;else nst <= s0;end if;   when s5=> if din='1' then nst <=s2;else nst <= s0;end if;   when others => nst <=s0;end case;en

10、d process;reg:process (clk,rst)  begin-shixujincheng  if rst='1' then st <=s0;     elsif clk'event and clk='1'  then st <= nst; end if;  en

11、d process reg;sout <= '1' when st=s5 else '0'end behave;         仿真结果小的体现了交迭mealy有交迭的程序设计library ieee;use ieee.std_logic_1164.all;entity schk2 is port(din,clk,rst:in std_logic; sout:out std_l

12、ogic);end schk2;architecture behave of schk2 is type states is(s0,s1,s2,s3,s4,s5); signal st:states :=s0;begin process(clk,rst,st,din) begin if rst='1' then st <=s0; elsif clk'event and clk='1' then case st is when s0=> if din='1' then st <=s1; else st <= s0;e

13、nd if; when s1=> if din='1' then st <=s2; else st <= s0;end if; when s2=> if din='0' then st <=s3; else st <= s0;end if; when s3=> if din='0' then st <=s4; else st <= s0;end if; when s4=> if din='1' then st <=s5; else st <= s0;end i

14、f; when s5=> if din='1' then st <=s2; else st <= s0;end if; when others => st <=s0;end case; if(st=s5) then sout<='1' else sout <= '0'end if ; end if;end process;end behave;实现检测11001的图体现交迭的图 Mealy机无交叠的library  ieee;use ieee.std_logic_1164.a

15、ll;entity schk2 is   port(din,clk,rst:in std_logic;      sout:out std_logic);end schk2;architecture behave of schk2 is   type states is(s0,s1,s2,s3,s4,s5);   signal 

16、st:states :=s0;begin process(clk,rst,st,din)  begin if rst='1' then st <=s0; elsif clk'event and clk='1' thencase st is     when s0=> if din='1'&#

17、160;then st <=s1; else st <= s0;end if;   when s1=> if din='1' then st <=s2; else st <= s0;end if;   when s2=> if din='0' then

18、 st <=s3; else st <= s0;end if;   when s3=> if din='0' then st <=s4; else st <= s0;end if;   when s4=> if din='1' then st

19、 <=s5; else st <= s0;end if;   when s5=> if din='1' then st <=s0; else st <= s0;end if;   when others => st <=s0;end case; 

20、60; if(st=s5) then sout<='1' else sout <= '0'end if  end if;end process;end behave;   体现没有交迭的Moore没有交迭的图library  ieee;use ieee.std_logic_1164.all;entity schk is  &

21、#160;port(din,clk,rst:in std_logic;      sout:out std_logic);end schk;architecture behave of schk is   type states is(s0,s1,s2,s3,s4,s5);   signal st,nst:states :=s0;begin com:

22、0;process(st,din) begin  case st is     when s0=> if din='1' then nst <=s1;else nst <= s0;end if;   when s1=> if din='1' then nst

23、60;<=s2;else nst <= s0;end if;   when s2=> if din='0' then nst <=s3;else nst <= s0;end if;   when s3=> if din='0' then nst <=s4;else nst <= s0;end if;   when s4=> if din='1' then nst <=s5;else nst <= s0;end if;   when 

温馨提示

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

评论

0/150

提交评论