100% found this document useful (1 vote)
12K views2 pages

Design A Mealy FSM To Detect A Non Overlapping Sequence 1011 and Describe Using VHDL

This document presents a state machine implementation in VHDL for detecting the non-overlapping sequence "1011" in a serial bit stream. The state machine diagram and VHDL code are provided. The state machine uses four states - A, B, C, and D - to track the current position in the sequence. The det_vld output is asserted when the machine reaches state D, indicating a full "1011" pattern has been detected.

Uploaded by

dineshvhaval
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
12K views2 pages

Design A Mealy FSM To Detect A Non Overlapping Sequence 1011 and Describe Using VHDL

This document presents a state machine implementation in VHDL for detecting the non-overlapping sequence "1011" in a serial bit stream. The state machine diagram and VHDL code are provided. The state machine uses four states - A, B, C, and D - to track the current position in the sequence. The det_vld output is asserted when the machine reaches state D, indicating a full "1011" pattern has been detected.

Uploaded by

dineshvhaval
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Sequence detector using state machine in VHDL

Some readers were asking for more examples related with state machine and some where asking for codes related with sequence detector.This article will be helpful for state machine designers and for people who try to implement sequence detector circuit in VHDL. I have created a state machine for non-overlapping detection of a pattern "1011" in a sequence of bits. The state machine diagram is given below for your reference.

The VHDL code for the same is given below. I have added comments for your easy understanding.

library IEEE; use IEEE.STD_LOGIC_1164.ALL; --Sequence detector for detecting the sequence "1011". --Non overlapping type. entity seq_det is port( clk : in std_logic; --clock signal reset : in std_logic; --reset signal seq : in std_logic; --serial bit sequence det_vld : out std_logic --A '1' indicates the pattern "1011" is detected in the sequence. ); end seq_det; architecture Behavioral of seq_det is type state_type is (A,B,C,D); --Defines the type for states in the state machine signal state : state_type := A; --Declare the signal with the corresponding state type. begin process(clk) begin if( reset = '1' ) then --resets state and output signal when reset is asserted. det_vld <= '0'; state <= A; elsif ( rising_edge(clk) ) then --calculates the next state based on current state and input bit.

case state is when A => --when the current state is A. det_vld <= '0'; if ( seq = '0' ) then state <= A; else state <= B; end if; when B => --when the current state is B. if ( seq = '0' ) then state <= C; else state <= B; end if; when C => --when the current state is C. if ( seq = '0' ) then state <= A; else state <= D; end if; when D => --when the current state is D. if ( seq = '0' ) then state <= C; else state <= A; det_vld <= '1'; --Output is asserted when the pattern "1011" is found in the sequence. end if; when others => NULL; end case; end if; end process; end Behavioral;

You might also like