AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
Main Page
Design Unit List
Files
File List
All
Classes
Variables
src
common
IPBUS
ipbus_core
hdl
ipbus_arb.vhd
1
-- ipbus_arb
2
--
3
-- Arbitrator
for
multiple ipbus masters
4
--
5
-- Dave Newbold, April
2013
6
7
library
ieee
;
8
use
ieee.std_logic_1164.
all
;
9
use
ieee.numeric_std.
all
;
10
use
work.
ipbus
.
all
;
11
12
entity
ipbus_arb
is
13
generic
(
14
N_BUS
:
positive
:=
2
15
)
;
16
port
(
17
clk
:
in
std_logic
;
18
rst
:
in
std_logic
;
19
ipb_m_out
:
in
ipb_wbus_array
(
N_BUS
-
1
downto
0
)
;
20
ipb_m_in
:
out
ipb_rbus_array
(
N_BUS
-
1
downto
0
)
;
21
ipb_req
:
in
std_logic_vector
(
N_BUS
-
1
downto
0
)
;
22
ipb_grant
:
out
std_logic_vector
(
N_BUS
-
1
downto
0
)
;
23
ipb_out
:
out
ipb_wbus
;
24
ipb_in
:
in
ipb_rbus
25
)
;
26
27
end
ipbus_arb
;
28
29
architecture
rtl
of
ipbus_arb
is
30
31
signal
src
:
unsigned
(
1
downto
0
)
;
-- Up
to
four ports...
32
signal
sel
:
integer
;
33
signal
busy
:
std_logic
;
34
35
begin
36
37
sel
<=
to_integer
(
src
)
;
38
39
process
(clk)
40
begin
41
if
rising_edge
(
clk
)
then
42
if
rst
=
'
1
'
then
43
busy
<=
'
0
'
;
44
src
<=
(
others
=
>
'
0
'
)
;
45
elsif
busy
=
'
0
'
then
46
if
ipb_req
(
sel
)
=
'
0
'
then
47
if
src
/=
(
N_BUS
-
1
)
then
48
src
<=
src
+
1
;
49
else
50
src
<=
(
others
=
>
'
0
'
)
;
51
end
if
;
52
else
53
busy
<=
'
1
'
;
54
end
if
;
55
elsif
ipb_req
(
sel
)
=
'
0
'
then
56
busy
<=
'
0
'
;
57
end
if
;
58
end
if
;
59
end
process
;
60
61
busgen
:
for
i
in
N_BUS
-
1
downto
0
generate
62
begin
63
ipb_grant
(
i
)
<=
'
1
'
when
sel
=
i
and
busy
=
'
1
'
else
'
0
'
;
64
ipb_m_in
(
i
)
<=
ipb_in
;
65
end
generate
;
66
67
ipb_out
<=
ipb_m_out
(
sel
)
;
68
69
end
rtl
;
70
Generated on Wed Apr 18 2018 10:55:28 for AMC13 by
1.8.1