@@ -78,20 +78,17 @@ def __init__(self, pads, gtx, revision, clk_freq):
78
78
# After configuration, GTX's resets have to stay low for at least 500ns
79
79
# See AR43482
80
80
startup_cycles = math .ceil (500 * clk_freq / 1000000000 )
81
- startup_wait = Timeout (startup_cycles )
82
- self .submodules += startup_wait
83
- self .comb += [
84
- startup_wait .reset .eq (self .tx_reset | self .rx_reset ),
85
- startup_wait .ce .eq (1 )
86
- ]
81
+ startup_timer = WaitTimer (startup_cycles )
82
+ self .submodules += startup_timer
83
+ self .comb += startup_timer .wait .eq (~ (self .tx_reset | self .rx_reset ))
87
84
88
85
# TX Startup FSM
89
86
self .tx_ready = Signal ()
90
87
tx_startup_fsm = InsertReset (FSM (reset_state = "IDLE" ))
91
88
self .submodules += tx_startup_fsm
92
89
# Wait 500ns of AR43482
93
90
tx_startup_fsm .act ("IDLE" ,
94
- If (startup_wait . reached ,
91
+ If (startup_timer . done ,
95
92
NextState ("RESET_ALL" ),
96
93
)
97
94
)
@@ -144,12 +141,11 @@ def __init__(self, pads, gtx, revision, clk_freq):
144
141
self .tx_ready .eq (1 )
145
142
)
146
143
147
- tx_ready_timeout = Timeout (1 * clk_freq // 1000 )
148
- self .submodules += tx_ready_timeout
144
+ tx_ready_timer = WaitTimer (1 * clk_freq // 1000 )
145
+ self .submodules += tx_ready_timer
149
146
self .comb += [
150
- tx_ready_timeout .reset .eq (self .tx_reset | self .tx_ready ),
151
- tx_ready_timeout .ce .eq (~ self .tx_ready ),
152
- tx_startup_fsm .reset .eq (self .tx_reset | tx_ready_timeout .reached ),
147
+ tx_ready_timer .wait .eq (~ self .tx_ready ),
148
+ tx_startup_fsm .reset .eq (self .tx_reset | tx_ready_timer .done ),
153
149
]
154
150
155
151
@@ -158,14 +154,12 @@ def __init__(self, pads, gtx, revision, clk_freq):
158
154
rx_startup_fsm = InsertReset (FSM (reset_state = "IDLE" ))
159
155
self .submodules += rx_startup_fsm
160
156
161
- cdr_stable = Timeout (2048 )
162
- self .submodules += cdr_stable
163
- self .comb += cdr_stable .ce .eq (1 ),
157
+ cdr_stable_timer = WaitTimer (2048 )
158
+ self .submodules += cdr_stable_timer
164
159
165
160
# Wait 500ns of AR43482
166
161
rx_startup_fsm .act ("IDLE" ,
167
- cdr_stable .reset .eq (1 ),
168
- If (startup_wait .reached ,
162
+ If (startup_timer .done ,
169
163
NextState ("RESET_GTX" ),
170
164
)
171
165
)
@@ -178,16 +172,16 @@ def __init__(self, pads, gtx, revision, clk_freq):
178
172
rx_startup_fsm .act ("WAIT_CPLL" ,
179
173
gtx .gtrxreset .eq (1 ),
180
174
If (gtx .cplllock ,
181
- NextState ("RELEASE_GTX" ),
182
- cdr_stable .reset .eq (1 )
175
+ NextState ("RELEASE_GTX" )
183
176
)
184
177
)
185
178
# Release GTX reset and wait for GTX resetdone
186
179
# (from UG476, GTX is reseted on falling edge
187
180
# of gttxreset)
188
181
rx_startup_fsm .act ("RELEASE_GTX" ,
189
182
gtx .rxuserrdy .eq (1 ),
190
- If (gtx .rxresetdone & cdr_stable .reached ,
183
+ cdr_stable_timer .wait .eq (1 ),
184
+ If (gtx .rxresetdone & cdr_stable_timer .done ,
191
185
NextState ("ALIGN" )
192
186
)
193
187
)
@@ -209,12 +203,11 @@ def __init__(self, pads, gtx, revision, clk_freq):
209
203
self .rx_ready .eq (1 )
210
204
)
211
205
212
- rx_ready_timeout = Timeout (1 * clk_freq // 1000 )
213
- self .submodules += rx_ready_timeout
206
+ rx_ready_timer = WaitTimer (1 * clk_freq // 1000 )
207
+ self .submodules += rx_ready_timer
214
208
self .comb += [
215
- rx_ready_timeout .reset .eq (self .rx_reset | self .rx_ready ),
216
- rx_ready_timeout .ce .eq (~ self .rx_ready ),
217
- rx_startup_fsm .reset .eq (self .rx_reset | rx_ready_timeout .reached ),
209
+ rx_ready_timer .wait .eq (~ self .rx_ready ),
210
+ rx_startup_fsm .reset .eq (self .rx_reset | rx_ready_timer .done ),
218
211
]
219
212
220
213
# Ready
0 commit comments