-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroundrobin.vhd
65 lines (48 loc) · 1.11 KB
/
roundrobin.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
library ieee;
use ieee.std_logic_1164.all;
entity roundrobin is
port (
din1 : in std_logic_vector(7 downto 0);
din2 : in std_logic_vector(7 downto 0);
din3 : in std_logic_vector(7 downto 0);
din4 : in std_logic_vector(7 downto 0);
dout : out std_logic_vector(7 downto 0);
Clock : in std_logic);
end roundrobin;
architecture arch of roundrobin is
type state is (s1,s2,s3,s4);
signal present_state,next_state : state;
begin
cs: process (Clock)
begin
if(rising_edge(Clock))THEN
present_state <=next_state;
end if;
end process cs ;
ns: process (present_state)
begin
case present_state is
when s1 =>
next_state <=s2;
when s2 =>
next_state <=s3;
when s3 =>
next_state <=s4;
when s4 =>
next_state <=s1;
end case;
end process ns ;
op: process (present_state)
begin
case present_state is
when s1 =>
dout <= din1;
when s2 =>
dout <= din2;
when s3 =>
dout <= din3;
when s4=>
dout <= din4;
end case;
end process op ;
end architecture arch;