1 |
53 |
dinesha |
task gmac_test2;
|
2 |
|
|
reg [31:0] read_data;
|
3 |
|
|
reg [3:0] desc_ptr;
|
4 |
|
|
reg [9:0] desc_rx_qbase;
|
5 |
|
|
reg [9:0] desc_tx_qbase;
|
6 |
|
|
reg [7:0] iFrmCnt;
|
7 |
|
|
|
8 |
|
|
//--------------------------
|
9 |
|
|
// Data Memory MAP
|
10 |
|
|
//-------------------------
|
11 |
|
|
// 0x0000 to 0x0FFF - 4K - Processor Data Memory
|
12 |
|
|
// 0x1000 to 0x1FFF - 4K - Gmac Rx Data Memory
|
13 |
|
|
// 0x2000 to 0x2FFF - 4K - Reserved for Rx
|
14 |
|
|
// 0x3000 to 0x3FFF - 4K - Gmac Tx Data Memory
|
15 |
|
|
// 0x4000 to 0x4FFF - 4K - Reserved for Tx
|
16 |
|
|
// 0x7000 to 0x703F - 64 - Rx Descriptor
|
17 |
|
|
// 0x7040 to 0x707F - 64 - Tx Descripto
|
18 |
|
|
|
19 |
|
|
events_log = $fopen("../test_log_files/test1_events.log");
|
20 |
|
|
tb_top.u_tb_eth.event_file = events_log;
|
21 |
|
|
|
22 |
|
|
$system("cp ../testcase/dat/gmac_loopback.dat ./dat/oc8051_xrom.in");
|
23 |
|
|
// Enable the RISC booting + Internal ROM Mode
|
24 |
|
|
tb_top.ea_in = 1;
|
25 |
|
|
tb_top.master_mode = 1;
|
26 |
|
|
|
27 |
|
|
#1000 wait(reset_out_n == 1);
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
desc_ptr = 0;
|
31 |
|
|
desc_rx_qbase = 10'h1C0;
|
32 |
|
|
desc_tx_qbase = 10'h1C1;
|
33 |
|
|
iFrmCnt = 0;
|
34 |
|
|
tb_top.u_tb_eth.init_port(3'b1, 3'b1, 1'b1, 0);
|
35 |
|
|
|
36 |
|
|
tb_top.cpu_write('h1,8'h0,{4'h1,4'h1,8'h45,8'h01}); // tx/rx-control
|
37 |
|
|
tb_top.cpu_write('h1,8'h8,{16'h0,8'd22,8'd22}); // Tx/Rx IFG
|
38 |
|
|
tb_top.cpu_write('h1,8'h24,{desc_tx_qbase,desc_ptr,2'b00,
|
39 |
|
|
desc_rx_qbase,desc_ptr,2'b00}); // Tx/Rx Descriptor
|
40 |
|
|
|
41 |
|
|
tb_top.u_tb_eth.set_flow_type(0);//L2 unicast
|
42 |
|
|
tb_top.u_tb_eth.set_L2_frame_size(1, 64, 84, 1); //, 1, 17, 33, 49, 64
|
43 |
|
|
tb_top.u_tb_eth.set_payload_type(2, 5000,0); //make sure frame size is honored
|
44 |
|
|
tb_top.u_tb_eth.set_L2_protocol(0); // Untagged frame
|
45 |
|
|
tb_top.u_tb_eth.set_L2_source_address(0, 48'h12_34_56_78_9a_bc, 0,0);
|
46 |
|
|
tb_top.u_tb_eth.set_L2_destination_address(0, 48'h16_22_33_44_55_66, 0,0);
|
47 |
|
|
tb_top.u_tb_eth.set_L3_protocol(4); // IPV4
|
48 |
|
|
tb_top.u_tb_eth.set_crc_option(0,0);
|
49 |
|
|
|
50 |
|
|
fork
|
51 |
|
|
tb_top.u_tb_eth.transmit_packet_sequence(10, 96, 1, 500000);
|
52 |
56 |
dinesha |
$display("Status: End of Transmission Loop");
|
53 |
53 |
dinesha |
begin
|
54 |
|
|
tb_top.u_tb_eth.wait_for_event(3, 0);
|
55 |
|
|
tb_top.u_tb_eth.wait_for_event(3, 0);
|
56 |
56 |
dinesha |
$display("Status: End of Waiting Event Loop");
|
57 |
53 |
dinesha |
end
|
58 |
|
|
join
|
59 |
|
|
|
60 |
|
|
#100000;
|
61 |
56 |
dinesha |
$display("Status: End of Waiting Delay Loop");
|
62 |
53 |
dinesha |
|
63 |
|
|
`TB_AGENTS_GMAC.full_mii.status; // test status
|
64 |
|
|
|
65 |
|
|
// Check the Transmitted & Received Frame cnt
|
66 |
|
|
if(`TB_AGENTS_GMAC.full_mii.transmitted_packet_count != `TB_AGENTS_GMAC.full_mii.receive_packet_count)
|
67 |
|
|
`TB_GLBL.test_err;
|
68 |
|
|
|
69 |
|
|
// Check the Transmitted & Received Byte cnt
|
70 |
|
|
if(`TB_AGENTS_GMAC.full_mii.transmitted_packet_byte_count != `TB_AGENTS_GMAC.full_mii.receive_packet_byte_count)
|
71 |
|
|
`TB_GLBL.test_err;
|
72 |
|
|
|
73 |
|
|
if(`TB_AGENTS_GMAC.full_mii.receive_crc_err_count)
|
74 |
|
|
`TB_GLBL.test_err;
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
endtask
|
78 |
|
|
|