# eda 序列检测器 vhdl

eda 序列检测器 vhdl

实验内容

设计一个序列检测器,要求检测的序列长度为 8 位,实验中用拨挡 开关的 K1~K8 来作为外部二进制码流的输入,在 FPGA 内部则是逐个比较。同时用按 键模块的 S1 来作为一个启动检测信号,每按下 S1 一次,检测器检测一次,如果 K1~ K8 输入的序列与 VHDL 设计时期望的序列一致,则认为检测到一个正确的序列,否则 如果有一个不同,则认为没有检测到正确的序列。另外为了便于观察,序列检测结果用 一个 LED 显示,本实验中用 LED 模块的 LED1_8 来显示,如果检测到正确的序列,则 LED 亮起,否则 LED 熄灭;用 LED1_1~LED1_4 来指示错误码的个数。错误的个数以 二进制显示。另外就是序列检测时钟信号的输入,本实验选择时钟模块的 100Hz 信号

代码

下面展示一些 内联代码片

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--------------------------------------------------------------------
entity exp2 is
  port( Clk       :  in   std_logic;   --时钟输入
        K         :  in   std_logic_vector(7 downto 0);   --序列输入
        Start     :  in   std_logic;   --输入:启动检测
    
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
以下是一个简单的 01101011 序列检测器VHDL 代码: ```vhdl library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity sequence_detector is Port ( clk : in STD_LOGIC; input : in STD_LOGIC; output : out STD_LOGIC); end sequence_detector; architecture Behavioral of sequence_detector is type states is (s0, s1, s2, s3, s4, s5, s6, s7); signal current_state, next_state : states; begin process (clk) begin if rising_edge(clk) then current_state <= next_state; end if; end process; process (current_state, input) begin case current_state is when s0 => if input = '0' then next_state <= s0; else next_state <= s1; end if; when s1 => if input = '1' then next_state <= s2; else next_state <= s0; end if; when s2 => if input = '1' then next_state <= s3; else next_state <= s0; end if; when s3 => if input = '0' then next_state <= s4; else next_state <= s0; end if; when s4 => if input = '1' then next_state <= s5; else next_state <= s0; end if; when s5 => if input = '0' then next_state <= s6; else next_state <= s0; end if; when s6 => if input = '1' then next_state <= s7; else next_state <= s0; end if; when s7 => if input = '1' then output <= '1'; next_state <= s0; else next_state <= s0; end if; end case; end process; end Behavioral; ``` 该代码包含两个进程。第一个进程处理时钟信号,将当前状态更新为下一个状态。 第二个进程根据当前状态和输入信号进行状态转移,并将输出信号设置为 1 当检测到完整的 01101011 序列时。 注意:该代码未进行任何测试或验证,仅供参考。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

达松泽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值