-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_path.vhd.bak
80 lines (71 loc) · 1.82 KB
/
control_path.vhd.bak
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
library ieee;
use ieee.numeric_std.all;
use ieee.std_logic_1164.all;
entity control_path is
port(
reset, clock: in std_logic;
op_code: in std_logic_vector(3 downto 0);
CZ: in std_logic_vector(1 downto 0);
C: out std_logic_vector(26 downto 0);
state_out: out std_logic_vector(4 downto 0);
CY, Z, invalid_next: in std_logic);
end entity;
architecture fsm of control_path is
type fsm_state is (S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, S12, S13, S14, S15, S16,s17,s18);
signal Q, nQ: fsm_state := S0;
begin
clockcycle:
process(clock, nQ)
begin
if (clock'event and clock = '1') then
Q <= nQ;
end if;
end process;
control_pin:
process(op_code,Q)
begin
C<= (others => '0');
case Q is
when S0 =>
C <= (others => '0');
state_out <= "00000";
when S1 =>
end if;
end process;
stae_next:
process(op_code, CY,CZ, Z, invalid_next, reset, Q)
begin
nQ <= Q;
if (reset = '1') then
nQ <= S0;
else
case Q is
when S0 => nQ <= S1;
when S1 =>
case op_code is
when others => nQ<=S2;
end case;
when S2 =>
case op_code is
when "0001" | "0010"=>
case CZ is
when "00" => nQ <= S3;
when "10" =>
if (CY = '1') then nQ <= S3;
else nQ <= S5;
end if;
when "01" =>
if (Z = '1') then nQ <= S3;
else nQ <= S5;
end if;
when "11" =>nQ <= S3;
when others => nQ <= S5;
end case;
when others => nQ <= S5;
end case;
when S3 => nQ <= S4;
when S4 => nQ <= S5;
end case;
end if;
end process;
end architecture;