SURF
1.0
Gtx7TxManualPhaseAligner.vhd
Go to the documentation of this file.
1
-------------------------------------------------------------------------------
2
-- File : Gtx7TxManualPhaseAligner.vhd
3
-- Company : SLAC National Accelerator Laboratory
4
-- Created : 2013-05-23
5
-- Last update: 2013-06-13
6
-------------------------------------------------------------------------------
7
-- Description: GTX7 TX manual phase aligner
8
-------------------------------------------------------------------------------
9
-- This file is part of 'SLAC Firmware Standard Library'.
10
-- It is subject to the license terms in the LICENSE.txt file found in the
11
-- top-level directory of this distribution and at:
12
-- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
13
-- No part of 'SLAC Firmware Standard Library', including this file,
14
-- may be copied, modified, propagated, or distributed except according to
15
-- the terms contained in the LICENSE.txt file.
16
-------------------------------------------------------------------------------
17
18
19
library
IEEE
;
20
use
IEEE.STD_LOGIC_1164.
all
;
21
use
work.
StdRtlPkg
.
all
;
22
23
--! @see entity
24
--! @ingroup xilinx_7Series_gtx7
25
entity
Gtx7TxManualPhaseAligner
is
26
generic
(
27
TPD_G
:
time
:=
1
ns
)
;
28
port
(
29
stableClk
:
in
sl
;
30
31
-- TX RST IO
32
resetPhAlignment
:
in
sl
;
33
runPhAlignment
:
in
sl
;
34
phaseAlignmentDone
:
out
sl
;
35
36
-- GT IO - Inputs are asynchronous
37
gtTxDlySReset
:
out
sl
;
38
gtTxDlySResetDone
:
in
sl
;
39
gtTxPhInit
:
out
sl
;
40
gtTxPhInitDone
:
in
sl
;
41
gtTxPhAlign
:
out
sl
;
42
gtTxPhAlignDone
:
in
sl
;
43
gtTxDlyEn
:
out
sl
)
;
44
end
Gtx7TxManualPhaseAligner
;
45
46
architecture
rtl
of
Gtx7TxManualPhaseAligner
is
47
48
type
StateType
is
(
49
INIT_S
,
50
WAIT_DLY_SRESET_DONE_S
,
51
WAIT_PH_INIT_DONE_S
,
52
WAIT_PH_ALIGN_DONE_S
,
53
WAIT_PH_ALIGN_DONE_2_S
,
54
DONE_S
)
;
55
56
type
RegType
is
record
57
state
:
StateType
;
58
-- Outputs
59
phaseAlignmentDone
:
sl
;
60
gtTxDlySReset
:
sl
;
61
gtTxPhInit
:
sl
;
62
gtTxPhAlign
:
sl
;
63
gtTxDlyEn
:
sl
;
64
end
record
RegType
;
65
66
constant
REG_RESET_C
:
RegType
:=
(
67
state
=
>
INIT_S
,
68
phaseAlignmentDone
=
>
'
0
'
,
69
gtTxDlySReset
=
>
'
0
'
,
70
gtTxPhInit
=
>
'
0
'
,
71
gtTxPhAlign
=
>
'
0
'
,
72
gtTxDlyEn
=
>
'
0
'
)
;
73
74
signal
r
,
rin
:
RegType
:=
REG_RESET_C
;
75
76
signal
gtTxDlySResetDoneSync
:
sl
;
77
signal
gtTxPhInitDoneSync
:
sl
;
78
signal
gtTxPhAlignDoneSync
:
sl
;
79
signal
gtTxPhAlignDoneEdge
:
sl
;
80
81
attribute
KEEP_HIERARCHY
:
string
;
82
attribute
KEEP_HIERARCHY
of
83
TX_DLY_S_RESET_DONE_SYNC
,
84
TX_PH_INIT_DONE_SYNC
,
85
TX_PH_ALIGN_DONE_SYNC
:
label
is
"TRUE"
;
86
87
begin
88
89
TX_DLY_S_RESET_DONE_SYNC :
entity
work.
Synchronizer
90
generic
map
(
91
TPD_G
=>
TPD_G
)
92
port
map
(
93
clk
=>
stableClk
,
94
dataIn
=>
gtTxDlySResetDone
,
95
dataOut
=> gtTxDlySResetDoneSync
)
;
96
97
TX_PH_INIT_DONE_SYNC :
entity
work.
Synchronizer
98
generic
map
(
99
TPD_G
=>
TPD_G
)
100
port
map
(
101
clk
=>
stableClk
,
102
dataIn
=>
gtTxPhInitDone
,
103
dataOut
=> gtTxPhInitDoneSync
)
;
104
105
TX_PH_ALIGN_DONE_SYNC :
entity
work.
SynchronizerEdge
106
generic
map
(
107
TPD_G
=>
TPD_G
)
108
port
map
(
109
clk
=>
stableClk
,
110
dataIn
=>
gtTxPhAlignDone
,
111
dataOut
=> gtTxPhAlignDoneSync,
112
risingEdge
=> gtTxPhAlignDoneEdge,
113
fallingEdge
=>
open
)
;
114
115
comb :
process
(r, gtTxDlySResetDoneSync, gtTxPhInitDoneSync, gtTxPhAlignDoneSync, gtTxPhAlignDoneEdge,
116
resetPhAlignment
,
runPhAlignment
)
is
117
variable
v
:
RegType
;
118
begin
119
v
:=
r
;
120
121
case
(
r
.
state
)
is
122
when
INIT_S
=
>
123
if
(
runPhAlignment
=
'
1
'
)
then
124
v
.
gtTxDlySReset
:=
'
1
'
;
125
v
.
state
:=
WAIT_DLY_SRESET_DONE_S
;
126
end
if
;
127
128
when
WAIT_DLY_SRESET_DONE_S
=
>
129
-- When resetDone arrives, lower reset and raise phInit
130
if
(
gtTxDlySResetDoneSync
=
'
1
'
)
then
131
v
.
gtTxDlySReset
:=
'
0
'
;
132
v
.
gtTxPhInit
:=
'
1
'
;
133
v
.
state
:=
WAIT_PH_INIT_DONE_S
;
134
end
if
;
135
136
when
WAIT_PH_INIT_DONE_S
=
>
137
if
(
gtTxPhInitDoneSync
=
'
1
'
)
then
138
v
.
gtTxPhInit
:=
'
0
'
;
139
v
.
gtTxPhAlign
:=
'
1
'
;
140
v
.
state
:=
WAIT_PH_ALIGN_DONE_S
;
141
end
if
;
142
143
when
WAIT_PH_ALIGN_DONE_S
=
>
144
if
(
gtTxPhAlignDoneEdge
=
'
1
'
)
then
145
v
.
gtTxPhAlign
:=
'
0
'
;
146
v
.
gtTxDlyEn
:=
'
1
'
;
147
-- v.state := WAIT_PH_ALIGN_DONE_2_S;
148
v
.
state
:=
DONE_S
;
149
end
if
;
150
151
when
WAIT_PH_ALIGN_DONE_2_S
=
>
152
if
(
gtTxPhAlignDoneEdge
=
'
1
'
)
then
153
v
.
gtTxDlyEn
:=
'
0
'
;
154
v
.
state
:=
DONE_S
;
155
end
if
;
156
157
when
DONE_S
=
>
158
v
.
phaseAlignmentDone
:=
'
1
'
;
159
160
when
others
=
>
null
;
161
end
case
;
162
163
if
(
resetPhAlignment
=
'
1
'
)
then
164
v
:=
REG_RESET_C
;
165
end
if
;
166
167
rin
<=
v
;
168
169
phaseAlignmentDone
<=
r
.
phaseAlignmentDone
;
170
gtTxDlySReset
<=
r
.
gtTxDlySReset
;
171
gtTxPhInit
<=
r
.
gtTxPhInit
;
172
gtTxPhAlign
<=
r
.
gtTxPhAlign
;
173
gtTxDlyEn
<=
r
.
gtTxDlyEn
;
174
175
end
process
comb
;
176
177
seq :
process
(
stableClk
)
is
178
begin
179
if
rising_edge
(
stableClk
)
then
180
r
<=
rin
after
TPD_G
;
181
end
if
;
182
end
process
seq
;
183
end
architecture
rtl
;
SynchronizerEdge.dataOut
out dataOutsl
Definition:
SynchronizerEdge.vhd:38
SynchronizerEdge
Definition:
SynchronizerEdge.vhd:25
Gtx7TxManualPhaseAligner.phaseAlignmentDone
out phaseAlignmentDonesl
Definition:
Gtx7TxManualPhaseAligner.vhd:34
StdRtlPkg.sl
std_logic sl
Definition:
StdRtlPkg.vhd:28
SynchronizerEdge.fallingEdge
out fallingEdgesl
Definition:
SynchronizerEdge.vhd:40
Gtx7TxManualPhaseAligner.gtTxPhInit
out gtTxPhInitsl
Definition:
Gtx7TxManualPhaseAligner.vhd:39
Gtx7TxManualPhaseAligner.TPD_G
TPD_Gtime := 1 ns
Definition:
Gtx7TxManualPhaseAligner.vhd:27
Synchronizer.dataOut
out dataOutsl
Definition:
Synchronizer.vhd:39
SynchronizerEdge.risingEdge
out risingEdgesl
Definition:
SynchronizerEdge.vhd:39
Gtx7TxManualPhaseAligner.resetPhAlignment
in resetPhAlignmentsl
Definition:
Gtx7TxManualPhaseAligner.vhd:32
Gtx7TxManualPhaseAligner.gtTxDlyEn
out gtTxDlyEnsl
Definition:
Gtx7TxManualPhaseAligner.vhd:43
Gtx7TxManualPhaseAligner
Definition:
Gtx7TxManualPhaseAligner.vhd:25
Gtx7TxManualPhaseAligner.gtTxDlySResetDone
in gtTxDlySResetDonesl
Definition:
Gtx7TxManualPhaseAligner.vhd:38
SynchronizerEdge.TPD_G
TPD_Gtime := 1 ns
Definition:
SynchronizerEdge.vhd:27
Synchronizer.TPD_G
TPD_Gtime := 1 ns
Definition:
Synchronizer.vhd:28
Synchronizer.clk
in clksl
Definition:
Synchronizer.vhd:36
Gtx7TxManualPhaseAligner.gtTxDlySReset
out gtTxDlySResetsl
Definition:
Gtx7TxManualPhaseAligner.vhd:37
SynchronizerEdge.clk
in clksl
Definition:
SynchronizerEdge.vhd:35
Gtx7TxManualPhaseAligner.runPhAlignment
in runPhAlignmentsl
Definition:
Gtx7TxManualPhaseAligner.vhd:33
Gtx7TxManualPhaseAligner.gtTxPhAlignDone
in gtTxPhAlignDonesl
Definition:
Gtx7TxManualPhaseAligner.vhd:42
Gtx7TxManualPhaseAligner.gtTxPhAlign
out gtTxPhAlignsl
Definition:
Gtx7TxManualPhaseAligner.vhd:41
StdRtlPkg
Definition:
StdRtlPkg.vhd:23
Gtx7TxManualPhaseAligner.stableClk
in stableClksl
Definition:
Gtx7TxManualPhaseAligner.vhd:29
Synchronizer
Definition:
Synchronizer.vhd:26
Gtx7TxManualPhaseAligner.gtTxPhInitDone
in gtTxPhInitDonesl
Definition:
Gtx7TxManualPhaseAligner.vhd:40
SynchronizerEdge.dataIn
in dataInsl
Definition:
SynchronizerEdge.vhd:37
Synchronizer.dataIn
in dataInsl
Definition:
Synchronizer.vhd:38
xilinx
7Series
gtx7
rtl
Gtx7TxManualPhaseAligner.vhd
Generated by
1.8.13