1 |
4 |
dwp |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// File name "ge_1000baseX_tb_script.v" ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the : ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// "1000BASE-X IEEE 802.3-2008 Clause 36 - PCS project" ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// http://opencores.org/project,1000base-x ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// Author(s): ////
|
12 |
|
|
//// - D.W.Pegler Cambridge Broadband Networks Ltd ////
|
13 |
|
|
//// ////
|
14 |
|
|
//// { peglerd@gmail.com, dwp@cambridgebroadand.com } ////
|
15 |
|
|
//// ////
|
16 |
|
|
//////////////////////////////////////////////////////////////////////
|
17 |
|
|
//// ////
|
18 |
|
|
//// Copyright (C) 2009 AUTHORS. All rights reserved. ////
|
19 |
|
|
//// ////
|
20 |
|
|
//// This source file may be used and distributed without ////
|
21 |
|
|
//// restriction provided that this copyright statement is not ////
|
22 |
|
|
//// removed from the file and that any derivative work contains ////
|
23 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
24 |
|
|
//// ////
|
25 |
|
|
//// This source file is free software; you can redistribute it ////
|
26 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
27 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
28 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
29 |
|
|
//// later version. ////
|
30 |
|
|
//// ////
|
31 |
|
|
//// This source is distributed in the hope that it will be ////
|
32 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
33 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
34 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
35 |
|
|
//// details. ////
|
36 |
|
|
//// ////
|
37 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
38 |
|
|
//// Public License along with this source; if not, download it ////
|
39 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
40 |
|
|
//// ////
|
41 |
|
|
//////////////////////////////////////////////////////////////////////
|
42 |
|
|
//// ////
|
43 |
|
|
//// ////
|
44 |
|
|
//////////////////////////////////////////////////////////////////////
|
45 |
|
|
|
46 |
|
|
`include "timescale_tb.v"
|
47 |
|
|
|
48 |
|
|
package ge_1000baseX_tb_script;
|
49 |
|
|
|
50 |
|
|
import tb_utils::VirIntfHandle;
|
51 |
|
|
|
52 |
|
|
import ethernet_threads::EthernetFlow;
|
53 |
|
|
import ethernet_threads::GmiiTxThread;
|
54 |
|
|
import ethernet_threads::GmiiRxThread;
|
55 |
|
|
|
56 |
|
|
import ge_1000baseX_utils::reg_read;
|
57 |
|
|
import ge_1000baseX_utils::reg_write;
|
58 |
|
|
import ge_1000baseX_utils::read_phy_ident;
|
59 |
|
|
import ge_1000baseX_utils::unplug_fo;
|
60 |
|
|
import ge_1000baseX_utils::insert_fo;
|
61 |
|
|
import ge_1000baseX_utils::restart_aneg;
|
62 |
|
|
import ge_1000baseX_utils::read_aneg_link_partner_capablities;
|
63 |
|
|
import ge_1000baseX_utils::reset_aneg;
|
64 |
|
|
import ge_1000baseX_utils::aneg_complete_poll;
|
65 |
|
|
import ge_1000baseX_utils::signal_detect_poll;
|
66 |
|
|
|
67 |
|
|
import ethernet_frame::ETH_A_TB;
|
68 |
|
|
import ethernet_frame::ETH1000;
|
69 |
|
|
|
70 |
|
|
task automatic main(VirIntfHandle vih, ref int errors);
|
71 |
|
|
|
72 |
|
|
EthernetFlow eFlow = new();
|
73 |
|
|
|
74 |
|
|
# 3us;
|
75 |
|
|
|
76 |
|
|
vih.gmii_tx_model.set_speed(ETH1000); vih.gmii_rx_model.set_speed(ETH1000);
|
77 |
|
|
|
78 |
|
|
read_phy_ident(vih);
|
79 |
|
|
|
80 |
|
|
// Simulate inserting FO cable and wait for signal_detect
|
81 |
|
|
insert_fo(vih); signal_detect_poll(vih);
|
82 |
|
|
|
83 |
|
|
// Force ANEG restart and wait for ANEG with link partner
|
84 |
|
|
restart_aneg(vih); aneg_complete_poll(vih);
|
85 |
|
|
|
86 |
|
|
// Display link partner capabilities
|
87 |
|
|
read_aneg_link_partner_capablities(vih);
|
88 |
|
|
|
89 |
|
|
eFlow.clear();
|
90 |
|
|
|
91 |
|
|
$display("%m: Starting Ethernet frame (GMII <-> 1000baseX) tests");
|
92 |
|
|
|
93 |
|
|
eFlow.create(GmiiTxThread::NEW(vih.gmii_tx_model, ETH_A_TB, ETH_A_TB, -64, 10, 96ns),
|
94 |
|
|
GmiiRxThread::NEW(vih.gmii_rx_model, ETH_A_TB, 250us, 250us, .dut_will_pad(0)));
|
95 |
|
|
|
96 |
|
|
eFlow.start(errors); if (errors) return;
|
97 |
|
|
|
98 |
|
|
endtask
|
99 |
|
|
|
100 |
|
|
endpackage
|
101 |
|
|
|