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