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
trans_arb.vhd
1
-- trans_arb
2
--
3
-- Arbitrates
access
to
transactor by multiple packet buffers
4
--
5
-- Dave Newbold, February
2013
6
--
7
-- $Id$
8
9
library
ieee
;
10
use
ieee.std_logic_1164.
all
;
11
use
ieee.numeric_std.
all
;
12
13
use
work.
ipbus_trans_decl
.
all
;
14
15
entity
trans_arb
is
16
generic
(
NSRC
:
positive
)
;
17
port
(
18
clk
:
in
std_logic
;
19
rst
:
in
std_logic
;
20
buf_in
:
in
ipbus_trans_in_array
(
NSRC
-
1
downto
0
)
;
21
buf_out
:
out
ipbus_trans_out_array
(
NSRC
-
1
downto
0
)
;
22
trans_out
:
out
ipbus_trans_in
;
23
trans_in
:
in
ipbus_trans_out
24
)
;
25
26
end
trans_arb
;
27
28
architecture
rtl
of
trans_arb
is
29
30
signal
src
:
unsigned
(
1
downto
0
)
;
-- Up
to
four ports...
31
signal
sel
:
integer
:=
0
;
32
signal
busy
:
std_logic
;
33
34
begin
35
36
sel
<=
to_integer
(
src
)
;
37
38
process
(clk)
39
begin
40
if
rising_edge
(
clk
)
then
41
if
rst
=
'
1
'
then
42
busy
<=
'
0
'
;
43
src
<=
(
others
=
>
'
0
'
)
;
44
elsif
busy
=
'
0
'
then
45
if
buf_in
(
sel
)
.
pkt_rdy
/=
'
1
'
then
46
if
src
/=
(
NSRC
-
1
)
then
47
src
<=
src
+
1
;
48
else
49
src
<=
(
others
=
>
'
0
'
)
;
50
end
if
;
51
else
52
busy
<=
'
1
'
;
53
end
if
;
54
elsif
trans_in
.
pkt_done
=
'
1
'
then
55
busy
<=
'
0
'
;
56
end
if
;
57
end
if
;
58
end
process
;
59
60
trans_out
.
pkt_rdy
<=
buf_in
(
sel
)
.
pkt_rdy
;
61
trans_out
.
rdata
<=
buf_in
(
sel
)
.
rdata
;
62
trans_out
.
busy
<=
buf_in
(
sel
)
.
busy
;
63
64
busgen
:
for
i
in
NSRC
-
1
downto
0
generate
65
begin
66
buf_out
(
i
)
.
pkt_done
<=
trans_in
.
pkt_done
when
sel
=
i
else
'
0
'
;
67
buf_out
(
i
)
.
wdata
<=
trans_in
.
wdata
;
68
buf_out
(
i
)
.
waddr
<=
trans_in
.
waddr
;
69
buf_out
(
i
)
.
raddr
<=
trans_in
.
raddr
;
70
buf_out
(
i
)
.
we
<=
trans_in
.
we
when
sel
=
i
else
'
0
'
;
71
end
generate
;
72
73
end
rtl
;
Generated on Wed Apr 18 2018 10:55:28 for AMC13 by
1.8.1