forked from sela847/305-Miniproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testung.vhd
83 lines (77 loc) · 2.01 KB
/
testung.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
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
library IEEE;
use IEEE.std_logic_1164.all;
entity testung is
port (
X : in std_logic;
A, B,C : out std_logic
);
end entity;
architecture rtl of testung is
signal A1,B1,C1 : std_logic;
begin
-- process
-- begin
-- A1 <= '0', '1' after 2 ns, '0' after 4 ns, '1' after 6 ns;
-- B1 <= '1', '0' after 2 ns, '1' after 6 ns, '0' after 8 ns;
-- wait for 10 ns;
-- end process;
-- A <= A1;
-- B<= B1;
-- C <= A1 or B1 when X = '1' else '0';
process(current_state, input)
variable next_state : std_logic;
begin
case (current_state) is
when S0 =>
if (input = '1') then
next_state := S1;
else
next_state := S0;
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 := S2;
else
next_state := S3;
end if;
when S3 =>
if (input = '1') then
next_state := S1;
else
next_state := S4;
end if;
when S4 =>
if (input = '1') then
next_state := S1;
else
next_state := S5;
end if;
when S5 =>
if (input = '1') then
next_state := S6;
else
next_state := S0;
end if;
when S6 =>
if (input = '1') then
next_state := S2;
else
next_state := S7;
end if;
when S7 =>
output <= '1';
if (input = '1') then
next_state := S1;
else
next_state := S0;
end if;
when (others => next_state := S0) ;
end case;
end process;
end architecture;