You are on page 1of 2

Wed Oct 12 19:36:55 2016

seq_detector_mealy.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

----------------------------------------------------------------------------------- Company:
-- Engineer:
--- Create Date:
00:27:56 10/05/2015
-- Design Name:
-- Module Name:
seq_detector_mealy - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--- Dependencies:
--- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
----------------------------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
---------------------------

Page 1

Wed Oct 12 19:36:55 2016

seq_detector_mealy.vhd
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

entity seq_detector_mealy is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
seq_in : in STD_LOGIC;
detect_out : out STD_LOGIC);
end seq_detector_mealy;
architecture Behavioral of seq_detector_mealy is
type state_type is (A,B,C,D,E);
signal state : state_type := A;
begin
process(clk)
begin
if( reset = '1' ) then
detect_out <= '0';
state <= A;
elsif ( rising_edge(clk) ) then
case state is
when A =>
if ( seq_in = '0' ) then
detect_out <= '0';
state <= B;
else
detect_out <= '0';
state <= C;
end if;
when B =>
if ( seq_in = '0' ) then
detect_out <= '0';
state <= B;
else
detect_out <= '0';
state <= D;
end if;
when C =>
if ( seq_in = '0' ) then
detect_out <= '0';
state <= E;
else
detect_out <= '0';
state <= C;
end if;
when others =>
NULL;
end case;
end if;
end process;
end Behavioral;

Page 2

You might also like