exp4序列检测器.doc_第1页
exp4序列检测器.doc_第2页
exp4序列检测器.doc_第3页
exp4序列检测器.doc_第4页
exp4序列检测器.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

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

文档简介

序列检测器XXX实验目的:用状态机实现序列检测器的设计,了解一般状态机的设计与应用。(1) 试验原理:序列检测器的工作原理已在习题8-3中作作了说明。a) 序列检测起可用于检测一组或多组二进制码组成的脉冲序列信号,当序列检测器连续接收到一组穿行二进制码后,如果这组码与检测器中预先设置的码相同,则输出1,否则输出0。由于这种检测的关键在于正确码的收到必须是连续的,这就要求检测器必须记住前一次的正确码及正确的序列,直到连续的检测中所收到的每一位码都与预置数的对应码相同。在检测过程中,任何一位不相等将回到初始状态重新开始检测。例8-11描述的电路完成对序列数11100101的检测,当这一序列数高位在前(左移)穿行进入检测器后,若此数与预置数相同,则输出A,否则输出B。(2) 试验内容1:仔细完成习题8-3的全部内容,利用Quartus II对例8-11的文本编辑输入、仿真并给仿真波形,了解控制信号时序,最后进行引脚锁定并完成硬件测试实验。Moore型状态机,输出值与时钟上升沿同步。a) VHDL程序library ieee;use ieee.std_logic_1164.all;entity SCHK isport(din,clk,clr : in std_logic;-串行输入数据位/工作时钟/复位信号 ab: out std_logic_vector(3 downto 0);-检测结果输出end SCHK;architecture behav of SCHK issignal q : integer range 0 to 8;signal d : std_logic_vector(7 downto 0);-8位待检测数beginD=11100101;-预置带检测数的输入process (clk, clr) -检测进程beginif clr=1 then q if din=d(7) then q=1;else q if din=d(6) then q=2;else q if din=d(5) then q=3;else q if din=d(4) then q=4;else q if din=d(3) then q=5;else q if din=d(2) then q=6;else q if din=d(1) then q=7;else q if din=d(0) then q=8;else q q=0;end case; end if; end process;process(q) -检测结果输出beginif q=8 then ab=1010; -序列数检测正确,输出Aelse ab=1011;-序列数检测错误,输出Bend if;end process;end behav;b) 时序仿真c) RTL仿真d) 硬件测试使用SignalTap采集得到的波形设置输入序列:111001011)数据串入前2)数据串入后 (3) 试验内容2:根据习题8-3中的要求3提出设计方案,重复以上实验内容(将8位检测预制数由键4/键3作为外部输入,从而可随时改变检测密码)a) VHDL程序library ieee;use ieee.std_logic_1164.all;entity SCHK1 isport(din,clk,clr : in std_logic; pre_load : in std_logic_vector(7 downto 0); ab: out std_logic_vector(3 downto 0);end SCHK1;architecture behav of SCHK1 issignal q : integer range 0 to 8;signal d : std_logic_vector(7 downto 0);beginD=pre_load;-置入待检测序列process (clk, clr)beginif clr=1 then q if din=d(7) then q=1;else q if din=d(6) then q=2;else q if din=d(5) then q=3;else q if din=d(4) then q=4;else q if din=d(3) then q=5;else q if din=d(2) then q=6;else q if din=d(1) then q=7;else q if din=d(0) then q=8;else q q=0;end case; end if; end process;process(q)beginif q=8 then ab=1010;else ab=1011;end if;end process;end behav;b) 时序仿真c) RTL仿真d) 硬件测试使用SignalTap采得的数据:数据输入前:全部数据窜入后:(4) 实验思考题:如果待检测预置数必须以右移方式进入序列检测器,写出该检测器的VHDL代码(两进程符号化有限状态机),并提出测试该序列检测器的实验方案。a) VHDL程序library ieee;use ieee.std_logic_1164.all;entity SCHK1 isport(din,clk,clr : in std_logic; pre_load : in std_logic_vector(7 downto 0); ab: out std_logic_vector(3 downto 0);end SCHK1;architecture behav of SCHK1 istype states is (s0,s1,s2,s3,s4,s5,s6,s7,s8);signal current_state,next_state : states;signal d : std_logic_vector(7 downto 0);beginD=pre_load;-置入待检测序列reg:process (clk,clr) -时序进程beginif clr=1 then current_state = s0;elsif clkevent and clk=1 then current_state if din=d(7) then next_state=s1;else next_state if din=d(6) then next_state=s2;else next_state if din=d(5) then next_state=s3;else next_state if din=d(4) then next_state=s4;else next_state if din=d(3) then next_state=s5;else next_state if din=d(2) then next_state=s6;else next_state if din=d(1) then next_state=s7;else next_state if din=d(0) then next_state=s8;else next_state next_state=s0;end case;if next_state= s8 then ab=1010;else a

温馨提示

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

评论

0/150

提交评论