zoukankan      html  css  js  c++  java
  • VHDL设计Mealy状态机的模板,识别序列1100100

    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;

    ENTITY detector IS 
     PORT(clk,x: IN STD_LOGIC;
      mk: OUT STD_LOGIC);
    END detector;

    ARCHITECTURE xdetector OF detector IS 
     TYPE states IS(s0,s1,s2,s3,s4,s5,s6,s7);
     SIGNAL state: states;
     BEGIN
      PROCESS(x,state)
      BEGIN
       IF rising_edge(clk) THEN
        CASE state IS
         WHEN s0 => mk<='0';
          IF(x='1') THEN
           state<=s1;
          ELSE
           state<=s0;
          END IF;
         WHEN s1 => mk<='0';
          IF(x='1') THEN
           state<=s2;
          ELSE
           state<=s0;
          END IF;
         WHEN s2 => mk<='0';
          IF(x='1') THEN
           state<=s2;
          ELSE
           state<=s3;
          END IF; 
         WHEN s3 => mk<='0';
          IF(x='1') THEN
           state<=s1;
          ELSE
           state<=s4;
          END IF;
         WHEN s4 => mk<='0';
          IF(x='1') THEN
           state<=s5;
          ELSE
           state<=s0;
          END IF;
         WHEN s5 => mk<='0';
          IF(x='1') THEN
           state<=s2;
          ELSE
           state<=s6;
          END IF; 
         WHEN s6 => mk<='0';
          IF(x='1') THEN
           state<=s1;
          ELSE
           state<=s7;
          END IF; 
         WHEN s7 => mk<='1';
          IF(x='1') THEN
           state<=s1;
          ELSE
           state<=s0;
          END IF;
        END CASE;
       END IF;                            
      END PROCESS;
    END xdetector;

  • 相关阅读:
    dubbo官方文档笔记
    maven权威指南读书笔记
    ArrayList实现
    通过json把int[]转成Integer[]
    二分查找,希尔排序,欧几里得,斐波那契
    js快捷键设置
    java字符串和时间转换
    希尔排序动画
    vue render
    前端性能优化,算法
  • 原文地址:https://www.cnblogs.com/oyjj/p/2132971.html
Copyright © 2011-2022 走看看