帮忙设计个“1101”单线序列检测器,,,eda,,VHDL语言

2022-08-13 教育 146阅读
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY CHK IS
PORT(DIN,CLK,RST:IN STD_LOGIC;
Y:OUT STD_LOGIC);
END CHK;
ARCHITECTURE one OF CHK IS
TYPE STATES IS (S0,S1,S2,S3,S4);
SIGNAL ST,NST: STATES :=S0;
BEGIN
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='1' THEN NST<=S4; ELSE NST<=S0;END IF;
WHEN OTHERS=>NST<=S0;
END CASE;
END PROCESS;
PROCESS(CLK,RST)
BEGIN
IF RST='0' THEN ST<=S0;
ELSIF CLK'EVENT AND CLK='1' THEN ST<=NST;
END IF;
END PROCESS;
Y<='1' WHEN ST=S4 ELSE '0';
END ARCHITECTURE one;
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com