使用D触发器设计一个11001序列检测器.docx

上传人:b****8 文档编号:11949646 上传时间:2023-06-03 格式:DOCX 页数:11 大小:257KB
下载 相关 举报
使用D触发器设计一个11001序列检测器.docx_第1页
第1页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第2页
第2页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第3页
第3页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第4页
第4页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第5页
第5页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第6页
第6页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第7页
第7页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第8页
第8页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第9页
第9页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第10页
第10页 / 共11页
使用D触发器设计一个11001序列检测器.docx_第11页
第11页 / 共11页
亲,该文档总共11页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

使用D触发器设计一个11001序列检测器.docx

《使用D触发器设计一个11001序列检测器.docx》由会员分享,可在线阅读,更多相关《使用D触发器设计一个11001序列检测器.docx(11页珍藏版)》请在冰点文库上搜索。

使用D触发器设计一个11001序列检测器.docx

使用D触发器设计一个11001序列检测器

使用D触发器设计一个11001序列检测器

讨论使用D触发器设计一个11001序列检测器,讨论序列可交迭(Overlap)检测和不可交迭检测在设计上的区别,讨论分别采用Mealy机设计和采用Moore机设计的区别,讨论未用状态的处理问题。

【要求】给出电路原理图或HDL代码,要求进行仿真,并给出仿真结果。

1.原件介绍

D触发器(74LS74)、“与”门(74LS08)、“或”门(74LS32)、“非”门(74LS04),

集成电路引脚

2.设计思路

根据要求,设计的序列检测器有一个外部输入x和一个外部输出Z。

输入和输出的逻辑关系为:

当外部输入x第一个为"1",外部输出Z为"0";当外部输入x第二个为"1",外部输出Z为"0";当外部输入第三个x为"0",外部输出Z为"0",当外部输入第四个x为“0”,外部输出Z为0,当外部输入第五个x为“1”,外部输出Z为“1”。

假定有一个外部输入x序列以及外部输出Z为:

输入X

0

1

1

1

0

0

1

0

1

输出Y

0

0

0

0

0

0

1

0

0

要判别序列检测器是否连续接收了"11001",电路必须用不同的状态记载外部输入x的值。

假设电路的初始状态为A,x 输入第一个"1",检测器状态由A装换到B,用状态B记载检测器接受了"11001"序列的第一个"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。

然后再根据外部输入及其他情况时的状态转移,写出相应的输出。

以上分析了序列检测器工作,由此可画出原始状态图。

根据原始状态图可列出原始状态表。

0\0

0\0

0\0

1\1

0\0

1\0

1\0

 

0\0

0\0

1\0

1\0

 

状态转换表

现态

X

0

1

A

A\0

B\0

B

A\0

C\0

C

D\0

B\0

D

E\0

A\0

E

A\0

F\1

Z

A

Q2Q1Q0

000

001

010

011

100

0

0

0

0

0

0

1

0

0

0

0

1

Q2*

A

Q2Q1Q0

000

001

011

010

110

0

0

0

0

1

0

end if;

   when s4=> if din='1' 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;

end process;

reg:

process (clk,rst)  begin--shixujincheng

  if rst='1' then st <=s0;

     elsif clk'event and clk='1'  then st <= nst; 

end if;

  end process reg;

sout <= '1' when st=s5 else '0';

end behave;   

   

   

仿真结果

小的体现了交迭

mealy有交迭的程序设计

libraryieee;

useieee.std_logic_1164.all;

entityschk2is

port(din,clk,rst:

instd_logic;

sout:

outstd_logic);

endschk2;

architecturebehaveofschk2is

typestatesis(s0,s1,s2,s3,s4,s5);

signalst:

states:

=s0;

begin

process(clk,rst,st,din)begin

ifrst='1'thenst<=s0;elsifclk'eventandclk='1'then

casestis

whens0=>ifdin='1'thenst<=s1;elsest<=s0;endif;

whens1=>ifdin='1'thenst<=s2;elsest<=s0;endif;

whens2=>ifdin='0'thenst<=s3;elsest<=s0;endif;

whens3=>ifdin='0'thenst<=s4;elsest<=s0;endif;

whens4=>ifdin='1'thenst<=s5;elsest<=s0;endif;

whens5=>ifdin='1'thenst<=s2;elsest<=s0;endif;

whenothers=>st<=s0;

endcase;

if(st=s5)thensout<='1';elsesout<='0';endif;endif;

endprocess;

endbehave;

 

实现检测11001的图

体现交迭的图

Mealy机无交叠的

library  ieee;

use ieee.std_logic_1164.all;

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 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;

end 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 if;

   when s5=> if din='1' then st <=s0; 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;   

体现没有交迭的

Moore没有交迭的图

library  ieee;

use ieee.std_logic_1164.all;

entity schk is   

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:

 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 <=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 s5=> if din='1' then nst <=s0;else nst <= s0;

end if;

   when others => nst <=s0;

end case;

end process;

reg:

process (clk,rst)  begin--shixujincheng

  if rst='1' then st <=s0;

     elsif clk'event and clk='1'  then st <= nst; end if;

  end process reg;

sout <= '1' when st=s5 else '0';

end behave;   

5.关于二者设计上的不同

Mealy状态机与Moore有限状态机不同,Mealy有限状态机的输出不但与当前状态有关,而且与输入信号的当前值有关,所以在st的赋值上二者会有不同,Moore赋给nst(下一状态的),mealy给st。

而且相比于Moore机mealy有一个时钟的延时,不过这样可以起到滤波的作用。

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

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2