1 |
2 |
acastong |
//link_fram_rx_l3_tb.cpp
|
2 |
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
3 |
|
|
* Version: MPL 1.1
|
4 |
|
|
*
|
5 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
6 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
7 |
|
|
* the License. You may obtain a copy of the License at
|
8 |
|
|
* http://www.mozilla.org/MPL/
|
9 |
|
|
*
|
10 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
11 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
12 |
|
|
* for the specific language governing rights and limitations under the
|
13 |
|
|
* License.
|
14 |
|
|
*
|
15 |
|
|
* The Original Code is HyperTransport Tunnel IP Core.
|
16 |
|
|
*
|
17 |
|
|
* The Initial Developer of the Original Code is
|
18 |
|
|
* Ecole Polytechnique de Montreal.
|
19 |
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
20 |
|
|
* the Initial Developer. All Rights Reserved.
|
21 |
|
|
*
|
22 |
|
|
* Contributor(s):
|
23 |
|
|
* Ami Castonguay <acastong@grm.polymtl.ca>
|
24 |
|
|
*
|
25 |
|
|
* Alternatively, the contents of this file may be used under the terms
|
26 |
|
|
* of the Polytechnique HyperTransport Tunnel IP Core Source Code License
|
27 |
|
|
* (the "PHTICSCL License", see the file PHTICSCL.txt), in which case the
|
28 |
|
|
* provisions of PHTICSCL License are applicable instead of those
|
29 |
|
|
* above. If you wish to allow use of your version of this file only
|
30 |
|
|
* under the terms of the PHTICSCL License and not to allow others to use
|
31 |
|
|
* your version of this file under the MPL, indicate your decision by
|
32 |
|
|
* deleting the provisions above and replace them with the notice and
|
33 |
|
|
* other provisions required by the PHTICSCL License. If you do not delete
|
34 |
|
|
* the provisions above, a recipient may use your version of this file
|
35 |
|
|
* under either the MPL or the PHTICSCL License."
|
36 |
|
|
*
|
37 |
|
|
* ***** END LICENSE BLOCK ***** */
|
38 |
|
|
|
39 |
|
|
#include "link_frame_rx_l3_tb.h"
|
40 |
|
|
#include "../../core/require.h"
|
41 |
|
|
#include "link_rx_transmitter.h"
|
42 |
|
|
|
43 |
|
|
#include <sstream>
|
44 |
|
|
#include <string>
|
45 |
|
|
|
46 |
|
|
using namespace std;
|
47 |
|
|
|
48 |
|
|
link_frame_rx_l3_tb::link_frame_rx_l3_tb(sc_module_name name): sc_module(name){
|
49 |
|
|
SC_THREAD(stimulate_inputs);
|
50 |
|
|
sensitive_pos << clk;
|
51 |
|
|
SC_THREAD(validate_outputs);
|
52 |
|
|
sensitive_pos << clk;
|
53 |
|
|
|
54 |
|
|
///Create and link transmitter submodule
|
55 |
|
|
transmitter = new link_rx_transmitter("link_rx_transmitter");
|
56 |
|
|
transmitter->clk(clk);
|
57 |
|
|
transmitter->phy_ctl_lk(phy_ctl_lk);
|
58 |
|
|
for(int n = 0; n < CAD_IN_WIDTH; n++){
|
59 |
|
|
transmitter->phy_cad_lk[n](phy_cad_lk[n]);
|
60 |
|
|
}
|
61 |
|
|
transmitter->phy_available_lk(phy_available_lk);
|
62 |
|
|
transmitter->lk_deser_stall_phy(lk_deser_stall_phy);
|
63 |
|
|
transmitter->lk_deser_stall_cycles_phy(lk_deser_stall_cycles_phy);
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
link_frame_rx_l3_tb::~link_frame_rx_l3_tb(){ delete transmitter;}
|
68 |
|
|
|
69 |
|
|
void link_frame_rx_l3_tb::init(){
|
70 |
|
|
|
71 |
|
|
/**
|
72 |
|
|
Not much to understand here, just init misc variables
|
73 |
|
|
to an initial state to start new. You'll notice that
|
74 |
|
|
reset is asserted and pwrok is de-asserted, meaning
|
75 |
|
|
that this is a cold reset and re-initializes the RX
|
76 |
|
|
part of the link.
|
77 |
|
|
*/
|
78 |
|
|
|
79 |
|
|
phy_ctl_lk = sc_uint<CAD_IN_DEPTH>(0);
|
80 |
|
|
for(int n = 0; n < CAD_IN_WIDTH; n++){
|
81 |
|
|
phy_cad_lk[n] = sc_uint<CAD_IN_DEPTH>(0);
|
82 |
|
|
}
|
83 |
|
|
phy_available_lk = true;
|
84 |
|
|
|
85 |
|
|
resetx = false;
|
86 |
|
|
pwrok = false;
|
87 |
|
|
ldtstopx = false;
|
88 |
|
|
|
89 |
|
|
/**
|
90 |
|
|
Link widths
|
91 |
|
|
|
92 |
|
|
000 8 bits
|
93 |
|
|
100 2 bits
|
94 |
|
|
101 4 bits
|
95 |
|
|
111 Link physically not connected
|
96 |
|
|
@{
|
97 |
|
|
*/
|
98 |
|
|
csr_rx_link_width_lk = "000";
|
99 |
|
|
|
100 |
|
|
csr_end_of_chain = false;
|
101 |
|
|
csr_sync = false;
|
102 |
|
|
csr_extended_ctl_timeout_lk = false;
|
103 |
|
|
|
104 |
|
|
#ifdef RETRY_MODE_ENABLED
|
105 |
|
|
///If we are in retry mode
|
106 |
|
|
csr_retry = false;
|
107 |
|
|
///Command decoder commands a retry disconnect
|
108 |
|
|
cd_initiate_retry_disconnect = false;
|
109 |
|
|
#endif
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
expect_connected = 0;
|
113 |
|
|
expect_disable_receivers_phy = 0;
|
114 |
|
|
|
115 |
|
|
expect_link_width_update = 0;
|
116 |
|
|
expected_link_width = "000";
|
117 |
|
|
|
118 |
|
|
expect_link_failure = 0;
|
119 |
|
|
|
120 |
|
|
check_dword_reception = true;
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
void link_frame_rx_l3_tb::stimulate_inputs(){
|
126 |
|
|
/////////////////////////////////////////////
|
127 |
|
|
// Test link failure
|
128 |
|
|
/////////////////////////////////////////////
|
129 |
|
|
|
130 |
|
|
phy_ctl_lk = sc_uint<CAD_IN_DEPTH>(0);
|
131 |
|
|
for(int n = 0; n < CAD_IN_WIDTH; n++){
|
132 |
|
|
phy_cad_lk[n] = sc_uint<CAD_IN_DEPTH>(0);
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
phy_available_lk = true;
|
136 |
|
|
resetx = false;
|
137 |
|
|
pwrok = false;
|
138 |
|
|
expect_connected = -4;
|
139 |
|
|
|
140 |
|
|
for(int n = 0; n < 5; n++)
|
141 |
|
|
wait();
|
142 |
|
|
|
143 |
|
|
resetx = true;
|
144 |
|
|
pwrok = true;
|
145 |
|
|
expect_link_failure = 5;
|
146 |
|
|
expect_link_width_update = 0;
|
147 |
|
|
|
148 |
|
|
for(int n = 0; n < 5; n++)
|
149 |
|
|
wait();
|
150 |
|
|
|
151 |
|
|
///////////////////////////////////////
|
152 |
|
|
// Do a normal valid cold reset
|
153 |
|
|
///////////////////////////////////////
|
154 |
|
|
|
155 |
|
|
cout << "Entered stimulate_inputs" << endl;
|
156 |
|
|
init();
|
157 |
|
|
expect_link_failure = 0;
|
158 |
|
|
cout << "Init done" << endl;
|
159 |
|
|
|
160 |
|
|
cout << "Cold reset" << endl;
|
161 |
|
|
//Keep the cold reset
|
162 |
|
|
for(int n = 0; n < 2; n++){
|
163 |
|
|
wait();
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
//Clock from other node starts running
|
167 |
|
|
phy_available_lk = true;
|
168 |
|
|
|
169 |
|
|
//Keep the cold reset
|
170 |
|
|
for(int n = 0; n < 4; n++){
|
171 |
|
|
wait();
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
//Power is stable
|
175 |
|
|
pwrok = true;
|
176 |
|
|
//Not in ldtstop sequence
|
177 |
|
|
ldtstopx = true;
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
transmitter->send_initial_value(4);
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
/////////////////////////////////////////////
|
184 |
|
|
// Test normal 8 bit behavious, offset 1/3
|
185 |
|
|
/////////////////////////////////////////////
|
186 |
|
|
|
187 |
|
|
//End cold reset
|
188 |
|
|
expect_link_width_update = 4;
|
189 |
|
|
expected_link_width = "000";
|
190 |
|
|
resetx = true;
|
191 |
|
|
|
192 |
|
|
cout << "Init sequence" << endl;
|
193 |
|
|
transmitter->send_init_sequence(1,3);
|
194 |
|
|
expect_connected = 16;
|
195 |
|
|
|
196 |
|
|
cout << "Data transmission" << endl;
|
197 |
|
|
|
198 |
|
|
LinkTransmission transmit;
|
199 |
|
|
transmit.dword = "0xA417F05B";
|
200 |
|
|
transmit.lctl = true;
|
201 |
|
|
transmit.hctl = true;
|
202 |
|
|
|
203 |
|
|
expected_transmission.push(transmit);
|
204 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
205 |
|
|
|
206 |
|
|
transmit.dword = "0x11112222";
|
207 |
|
|
transmit.lctl = true;
|
208 |
|
|
transmit.hctl = false;
|
209 |
|
|
|
210 |
|
|
expected_transmission.push(transmit);
|
211 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
212 |
|
|
|
213 |
|
|
transmit.dword = "0xFFBB3388";
|
214 |
|
|
transmit.lctl = false;
|
215 |
|
|
transmit.hctl = true;
|
216 |
|
|
|
217 |
|
|
expected_transmission.push(transmit);
|
218 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
219 |
|
|
|
220 |
|
|
transmit.dword = "0x00000000";
|
221 |
|
|
transmit.lctl = false;
|
222 |
|
|
transmit.hctl = false;
|
223 |
|
|
|
224 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
225 |
|
|
|
226 |
|
|
for(int n = 0; n < 5; n++){
|
227 |
|
|
wait();
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
resetx = false;
|
231 |
|
|
expect_connected = -4;
|
232 |
|
|
|
233 |
|
|
for(int n = 0; n < 5; n++){
|
234 |
|
|
wait();
|
235 |
|
|
}
|
236 |
|
|
|
237 |
|
|
/////////////////////////////////////////////
|
238 |
|
|
// Test normal 8 bit behavious, offset 0/0
|
239 |
|
|
/////////////////////////////////////////////
|
240 |
|
|
resetx = true;
|
241 |
|
|
|
242 |
|
|
transmitter->send_init_sequence(0,0);
|
243 |
|
|
expect_connected = 16;
|
244 |
|
|
|
245 |
|
|
cout << "Data transmission" << endl;
|
246 |
|
|
|
247 |
|
|
transmit.dword = "0xABCDEF01";
|
248 |
|
|
transmit.lctl = true;
|
249 |
|
|
transmit.hctl = true;
|
250 |
|
|
|
251 |
|
|
expected_transmission.push(transmit);
|
252 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
253 |
|
|
|
254 |
|
|
transmit.dword = "0x55336644";
|
255 |
|
|
transmit.lctl = true;
|
256 |
|
|
transmit.hctl = false;
|
257 |
|
|
|
258 |
|
|
expected_transmission.push(transmit);
|
259 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
for(int n = 0; n < 5; n++)
|
263 |
|
|
wait();
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
////////////////////////////////////////////////////////////////
|
267 |
|
|
// Testing LDTSTOP
|
268 |
|
|
////////////////////////////////////////////////////////////////
|
269 |
|
|
cout << "Testing LDTSTOP" << endl;
|
270 |
|
|
|
271 |
|
|
check_dword_reception = false;
|
272 |
|
|
|
273 |
|
|
expect_connected = -4;
|
274 |
|
|
expect_disable_receivers_phy = 6;
|
275 |
|
|
ldtstopx = false;
|
276 |
|
|
ldtstop_disconnect_rx = true;
|
277 |
|
|
|
278 |
|
|
transmit.dword = "0x00000000";
|
279 |
|
|
transmit.lctl = false;
|
280 |
|
|
transmit.hctl = false;
|
281 |
|
|
for(int n = 0; n < 4; n++)
|
282 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
283 |
|
|
|
284 |
|
|
ldtstopx = true;
|
285 |
|
|
ldtstop_disconnect_rx = false;
|
286 |
|
|
|
287 |
|
|
expect_disable_receivers_phy = -210;
|
288 |
|
|
transmitter->send_initial_value(210);
|
289 |
|
|
expect_connected = 210;
|
290 |
|
|
|
291 |
|
|
transmitter->send_init_sequence(0,0);
|
292 |
|
|
|
293 |
|
|
transmit.dword = "0xABCDEF01";
|
294 |
|
|
transmit.lctl = true;
|
295 |
|
|
transmit.hctl = true;
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
for(int n = 0; n < 5; n++)
|
303 |
|
|
wait();
|
304 |
|
|
|
305 |
|
|
////////////////////////////////////////////////////////////////
|
306 |
|
|
// Testing protocol error (invalid CTL transition)
|
307 |
|
|
////////////////////////////////////////////////////////////////
|
308 |
|
|
cout << "Testing protocol error" << endl;
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
sc_bv<CAD_IN_DEPTH> phy_ctl_lk_buf;
|
312 |
|
|
for(int n = 0; n < CAD_IN_DEPTH; n++){
|
313 |
|
|
phy_ctl_lk_buf[n] = (bool)(n % 2);
|
314 |
|
|
}
|
315 |
|
|
phy_ctl_lk = phy_ctl_lk_buf;
|
316 |
|
|
|
317 |
|
|
phy_available_lk = true;
|
318 |
|
|
expect_ctl_transition_error = 5;
|
319 |
|
|
wait();
|
320 |
|
|
|
321 |
|
|
transmit.dword = "0x00000000";
|
322 |
|
|
transmit.lctl = true;
|
323 |
|
|
transmit.hctl = true;
|
324 |
|
|
for(int n = 0; n < 5; n++)
|
325 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
326 |
|
|
|
327 |
|
|
expect_ctl_transition_error = 0;
|
328 |
|
|
|
329 |
|
|
resetx = false;
|
330 |
|
|
expect_connected = -4;
|
331 |
|
|
|
332 |
|
|
for(int n = 0; n < 5; n++){
|
333 |
|
|
wait();
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
////////////////////////////////////////////////////////////////
|
338 |
|
|
// Testing protocol error (invalid CTL transition) because of reset
|
339 |
|
|
////////////////////////////////////////////////////////////////
|
340 |
|
|
cout << "Testing protocol error because of reset" << endl;
|
341 |
|
|
|
342 |
|
|
resetx = true;
|
343 |
|
|
|
344 |
|
|
transmitter->send_init_sequence(0,0);
|
345 |
|
|
expect_connected = 16;
|
346 |
|
|
|
347 |
|
|
phy_ctl_lk_buf[0] = true;
|
348 |
|
|
for(int n = 1; n < CAD_IN_DEPTH; n++){
|
349 |
|
|
phy_ctl_lk_buf[n] = false;
|
350 |
|
|
}
|
351 |
|
|
phy_ctl_lk = phy_ctl_lk_buf;
|
352 |
|
|
|
353 |
|
|
phy_available_lk = true;
|
354 |
|
|
wait();
|
355 |
|
|
|
356 |
|
|
expect_connected = -10;
|
357 |
|
|
|
358 |
|
|
//Like reset signal
|
359 |
|
|
transmit.dword = "0x00000000";
|
360 |
|
|
transmit.lctl = false;
|
361 |
|
|
transmit.hctl = false;
|
362 |
|
|
for(int n = 0; n < 2; n++)
|
363 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
364 |
|
|
|
365 |
|
|
resetx = false;
|
366 |
|
|
for(int n = 0; n < 5; n++){
|
367 |
|
|
wait();
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
////////////////////////////////////////////////////////////////
|
371 |
|
|
// Testing Retry mode disconnect from CD
|
372 |
|
|
////////////////////////////////////////////////////////////////
|
373 |
|
|
|
374 |
|
|
////////////////////////////////////////////////////////////////
|
375 |
|
|
// Testing Retry mode with protocol error
|
376 |
|
|
////////////////////////////////////////////////////////////////
|
377 |
|
|
cout << "Testing protocol error with retry" << endl;
|
378 |
|
|
|
379 |
|
|
resetx = true;
|
380 |
|
|
csr_retry = true;
|
381 |
|
|
|
382 |
|
|
transmitter->send_init_sequence(0,0);
|
383 |
|
|
expect_connected = 16;
|
384 |
|
|
for(int n = 0; n < CAD_IN_DEPTH; n++){
|
385 |
|
|
phy_ctl_lk_buf[n] = (bool)(n % 2);
|
386 |
|
|
}
|
387 |
|
|
phy_ctl_lk = phy_ctl_lk_buf;
|
388 |
|
|
|
389 |
|
|
phy_available_lk = true;
|
390 |
|
|
expect_ctl_transition_error = 5;
|
391 |
|
|
expect_lk_initiate_retry_disconnect = 5;
|
392 |
|
|
wait();
|
393 |
|
|
|
394 |
|
|
transmit.dword = "0x00000000";
|
395 |
|
|
transmit.lctl = true;
|
396 |
|
|
transmit.hctl = true;
|
397 |
|
|
for(int n = 0; n < 3; n++)
|
398 |
|
|
transmitter->send_dword_link(transmit.dword,transmit.lctl,transmit.hctl);
|
399 |
|
|
|
400 |
|
|
expect_ctl_transition_error = 0;
|
401 |
|
|
|
402 |
|
|
resetx = false;
|
403 |
|
|
expect_connected = -4;
|
404 |
|
|
|
405 |
|
|
for(int n = 0; n < 5; n++){
|
406 |
|
|
wait();
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
////////////////////////////////////////////////////////////////
|
410 |
|
|
// Done
|
411 |
|
|
////////////////////////////////////////////////////////////////
|
412 |
|
|
cout << "Link testbench done" << endl;
|
413 |
|
|
|
414 |
|
|
while(true)
|
415 |
|
|
wait();
|
416 |
|
|
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
void link_frame_rx_l3_tb::validate_outputs(){
|
422 |
|
|
while(true){
|
423 |
|
|
wait();
|
424 |
|
|
|
425 |
|
|
//Test correctness of lk_rx_connected
|
426 |
|
|
if(!expect_connected) verify(
|
427 |
|
|
lk_rx_connected.read() == false,"Link should not be connected yet");
|
428 |
|
|
else if(expect_connected > 0){
|
429 |
|
|
verify(!(expect_connected == 1 && lk_rx_connected.read() == false),
|
430 |
|
|
"Link failed to connect");
|
431 |
|
|
if(!lk_rx_connected.read()) expect_connected--;
|
432 |
|
|
else(expect_connected = 1);
|
433 |
|
|
}
|
434 |
|
|
else{
|
435 |
|
|
verify(!(expect_connected == -1 && lk_rx_connected.read() == true),
|
436 |
|
|
"Link failed to disconnect");
|
437 |
|
|
if(lk_rx_connected.read()) expect_connected++;
|
438 |
|
|
else expect_connected = 0;
|
439 |
|
|
}
|
440 |
|
|
|
441 |
|
|
//Test correctness of lk_disable_receivers_phy
|
442 |
|
|
if(!expect_disable_receivers_phy) verify(
|
443 |
|
|
lk_disable_receivers_phy.read() == false,"Link should not be disabled yet");
|
444 |
|
|
else if(expect_disable_receivers_phy > 0){
|
445 |
|
|
verify(!(expect_disable_receivers_phy == 1 && lk_disable_receivers_phy.read() == false),
|
446 |
|
|
"Link failed to disable");
|
447 |
|
|
if(!lk_disable_receivers_phy.read()) expect_disable_receivers_phy--;
|
448 |
|
|
else(expect_disable_receivers_phy = 1);
|
449 |
|
|
}
|
450 |
|
|
else{
|
451 |
|
|
verify(!(expect_disable_receivers_phy == -1 && lk_disable_receivers_phy.read() == true),
|
452 |
|
|
"Link failed to re-enable");
|
453 |
|
|
if(lk_disable_receivers_phy.read()) expect_disable_receivers_phy++;
|
454 |
|
|
else expect_disable_receivers_phy = 0;
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
//Test correctness of lk_update_link_width_csr
|
458 |
|
|
if(!lk_link_failure_csr.read()){
|
459 |
|
|
if(!expect_link_width_update) verify(
|
460 |
|
|
lk_update_link_width_csr.read() == false,"Unexpected update of link width");
|
461 |
|
|
else {
|
462 |
|
|
verify(!(expect_link_width_update == 1 && lk_update_link_width_csr.read() == false),
|
463 |
|
|
"Link failed to update link width");
|
464 |
|
|
if(!lk_update_link_width_csr.read()) expect_link_width_update--;
|
465 |
|
|
else{
|
466 |
|
|
ostringstream o;
|
467 |
|
|
o << "Invalid updated link width value, Expected: " << expected_link_width <<
|
468 |
|
|
" Received: " << lk_sampled_link_width_csr.read();
|
469 |
|
|
verify(expected_link_width == lk_sampled_link_width_csr.read(),
|
470 |
|
|
o.str().c_str());
|
471 |
|
|
(expect_link_width_update = 0);
|
472 |
|
|
}
|
473 |
|
|
}
|
474 |
|
|
}
|
475 |
|
|
|
476 |
|
|
//Test correctness of lk_link_failure_csr
|
477 |
|
|
if(!expect_link_failure)
|
478 |
|
|
verify(lk_link_failure_csr.read() == false,"Unexpected link failure");
|
479 |
|
|
else{
|
480 |
|
|
verify(!(expect_link_failure == 1 && lk_link_failure_csr.read() == false),
|
481 |
|
|
"Link failed to fail : the link was supposed to fail and didn't");
|
482 |
|
|
if(!lk_link_failure_csr.read()) expect_link_failure--;
|
483 |
|
|
//else(expect_link_failure = 0);
|
484 |
|
|
}
|
485 |
|
|
|
486 |
|
|
//Test correctness of ctl_transition_error
|
487 |
|
|
if(!expect_ctl_transition_error)
|
488 |
|
|
verify(ctl_transition_error.read() == false,"Unexpected ctl transition error");
|
489 |
|
|
else{
|
490 |
|
|
verify(!(expect_ctl_transition_error == 1 && ctl_transition_error.read() == false),
|
491 |
|
|
"Link failed produce CTL error when it should have");
|
492 |
|
|
if(!ctl_transition_error.read()) expect_ctl_transition_error--;
|
493 |
|
|
}
|
494 |
|
|
|
495 |
|
|
//Test correctness of lk_initiate_retry_disconnect
|
496 |
|
|
if(!expect_lk_initiate_retry_disconnect)
|
497 |
|
|
verify(lk_initiate_retry_disconnect.read() == false,"Unexpected retry sequence initiated");
|
498 |
|
|
else{
|
499 |
|
|
verify(!(expect_lk_initiate_retry_disconnect == 1 && lk_initiate_retry_disconnect.read() == false),
|
500 |
|
|
"Link failed to initiate retry sequence when it should have");
|
501 |
|
|
if(!lk_initiate_retry_disconnect.read()) expect_lk_initiate_retry_disconnect--;
|
502 |
|
|
else(expect_lk_initiate_retry_disconnect = 0);
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
//Test reception of data
|
507 |
|
|
if(framed_data_available.read() && check_dword_reception){
|
508 |
|
|
verify(!(expected_transmission.empty()),
|
509 |
|
|
"Unexpected data reception");
|
510 |
|
|
if(!expected_transmission.empty()){
|
511 |
|
|
LinkTransmission t = expected_transmission.front();
|
512 |
|
|
|
513 |
|
|
cout << "Data in front : L=" << t.lctl << " H=" <<
|
514 |
|
|
t.hctl << " D=" << t.dword.to_string(SC_HEX) << endl;
|
515 |
|
|
cout << "Data received : L=" << framed_lctl.read() << " H=" <<
|
516 |
|
|
framed_hctl.read() << " D=" << framed_cad.read().to_string(SC_HEX) << endl;
|
517 |
|
|
|
518 |
|
|
expected_transmission.pop();
|
519 |
|
|
|
520 |
|
|
verify((t.dword == framed_cad.read() &&
|
521 |
|
|
t.lctl == framed_lctl.read() &&
|
522 |
|
|
t.hctl == framed_hctl.read()),
|
523 |
|
|
"Invalid data received");
|
524 |
|
|
}
|
525 |
|
|
}
|
526 |
|
|
}
|
527 |
|
|
}
|
528 |
|
|
|