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_shim.vhd
1
-- Shim
for
ipbus.
2
--
3
-- Splits back
to
back transactions apart (i.e. strobe will go low between transactions)
4
-- Waits
for
acknowledge
to
go low before starting anotherv transaction
5
--
6
-- Greg Iles, July
2012
7
8
library
IEEE
;
9
use
IEEE.STD_LOGIC_1164.
ALL
;
10
use
ieee.numeric_std.
all
;
11
use
work.
ipbus
.
all
;
12
13
entity
ipbus_shim
is
14
generic
(
15
ENABLE :
boolean
:= true
16
)
;
17
port
(
18
clk
:
in
std_logic
;
19
reset
:
in
std_logic
;
20
ipbus_in
:
in
ipb_wbus
;
21
ipbus_out
:
out
ipb_rbus
;
22
ipbus_shim_out
:
out
ipb_wbus
;
23
ipbus_shim_in
:
in
ipb_rbus
24
)
;
25
26
end
ipbus_shim
;
27
28
architecture
rtl
of
ipbus_shim
is
29
30
type
type_shim_state
is
(
idle
,
wait_for_ack_start
,
wait_for_ack_stop
)
;
31
signal
shim_state
:
type_shim_state
:=
idle
;
32
33
begin
34
35
-- Would timeout be wise? Good
for
robustness, but
not
debugging.
36
37
38
shim_en
:
if
(
ENABLE
=
true
)
generate
39
shim_sm:
process
(clk)
40
begin
41
if
rising_edge
(
clk
)
then
42
if
reset
=
'
1
'
then
43
shim_state
<=
idle
;
44
ipbus_shim_out
<=
(
ipb_addr
=
>
x
"00000000"
,
ipb_wdata
=
>
x
"00000000"
,
ipb_strobe
=
>
'
0
'
,
ipb_write
=
>
'
0
'
)
;
45
ipbus_out
<=
(
ipb_rdata
=
>
x
"00000000"
,
ipb_ack
=
>
'
0
'
,
ipb_err
=
>
'
0
'
)
;
46
else
47
case
shim_state
is
48
when
idle
=
>
49
if
ipbus_in
.
ipb_strobe
=
'
1
'
then
50
shim_state
<=
wait_for_ack_start
;
51
ipbus_shim_out
<=
ipbus_in
;
52
end
if
;
53
when
wait_for_ack_start
=
>
54
if
ipbus_shim_in
.
ipb_ack
=
'
1
'
then
55
-- Send data back
to
master
56
ipbus_out
.
ipb_ack
<=
'
1
'
;
57
ipbus_out
.
ipb_err
<=
ipbus_shim_in
.
ipb_err
;
58
ipbus_out
.
ipb_rdata
<=
ipbus_shim_in
.
ipb_rdata
;
59
-- Negate strobe
60
ipbus_shim_out
.
ipb_strobe
<=
'
0
'
;
61
shim_state
<=
wait_for_ack_stop
;
62
end
if
;
63
when
wait_for_ack_stop
=
>
64
ipbus_out
.
ipb_ack
<=
'
0
'
;
65
if
ipbus_shim_in
.
ipb_ack
=
'
0
'
then
66
shim_state
<=
idle
;
67
end
if
;
68
when
others
=
>
69
shim_state
<=
idle
;
70
end
case
;
71
end
if
;
72
end
if
;
73
end
process
;
74
end
generate
;
75
76
shim_dis
:
if
(
enable
=
false
)
generate
77
ipbus_shim_out
<=
ipbus_in
;
78
ipbus_out
<=
ipbus_shim_in
;
79
end
generate
;
80
81
end
rtl
;
Generated on Wed Apr 18 2018 10:55:28 for AMC13 by
1.8.1