Line 40... |
Line 40... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.33 2005/02/21 13:02:13 igorm
|
|
// Tests for delayed CRC and defer indication added.
|
|
//
|
// Revision 1.32 2004/03/26 15:59:21 tadejm
|
// Revision 1.32 2004/03/26 15:59:21 tadejm
|
// Latest Ethernet IP core testbench.
|
// Latest Ethernet IP core testbench.
|
//
|
//
|
// Revision 1.31 2003/12/05 12:46:26 tadejm
|
// Revision 1.31 2003/12/05 12:46:26 tadejm
|
// Updated testbench. Some more testcases, some repaired.
|
// Updated testbench. Some more testcases, some repaired.
|
Line 510... |
Line 513... |
test_mac_full_duplex_transmit(0, 23); // 0 - 23
|
test_mac_full_duplex_transmit(0, 23); // 0 - 23
|
test_mac_full_duplex_receive(0, 15); // 0 - 15
|
test_mac_full_duplex_receive(0, 15); // 0 - 15
|
test_mac_full_duplex_flow_control(0, 5); // 0 - 5
|
test_mac_full_duplex_flow_control(0, 5); // 0 - 5
|
test_mac_half_duplex_flow(0, 1);
|
test_mac_half_duplex_flow(0, 1);
|
|
|
|
|
|
// Tests not working, yet.
|
|
// test_mac_half_duplex_flow(0, 0); // 2, 3, 4, 5 These tests need to be fixed !!!
|
|
|
$display("");
|
$display("");
|
$display("===========================================================================");
|
$display("===========================================================================");
|
$display("PHY generates 'real delayed' Carrier sense and Collision signals for following tests");
|
$display("PHY generates 'real delayed' Carrier sense and Collision signals for following tests");
|
$display("===========================================================================");
|
$display("===========================================================================");
|
test_note("PHY generates 'real delayed' Carrier sense and Collision signals for following tests");
|
test_note("PHY generates 'real delayed' Carrier sense and Collision signals for following tests");
|
eth_phy.carrier_sense_real_delay(1);
|
eth_phy.carrier_sense_real_delay(1);
|
test_mac_full_duplex_transmit(0, 21); // 0 - 21
|
test_mac_full_duplex_transmit(0, 23); // 0 - 23
|
test_mac_full_duplex_receive(0, 13); // 0 - 13
|
test_mac_full_duplex_receive(0, 15); // 0 - 15
|
test_mac_full_duplex_flow_control(0, 5); // 0 - 5
|
test_mac_full_duplex_flow_control(0, 5); // 0 - 5
|
test_mac_half_duplex_flow(0, 1);
|
test_mac_half_duplex_flow(0, 1);
|
|
|
|
|
// Finish test's logs
|
// Finish test's logs
|
Line 2208... |
Line 2215... |
// check the BUSY signal to see if the bus is still IDLE
|
// check the BUSY signal to see if the bus is still IDLE
|
for (i1 = 0; i1 < 8; i1 = i1 + 1)
|
for (i1 = 0; i1 < 8; i1 = i1 + 1)
|
check_mii_busy; // wait for bus to become idle
|
check_mii_busy; // wait for bus to become idle
|
|
|
// try normal write or read after read was finished
|
// try normal write or read after read was finished
|
#Tp phy_data = {8'h7D, (i[7:0] + 1)};
|
#Tp phy_data = {8'h7D, (i[7:0] + 1'b1)};
|
#Tp cnt = 0;
|
#Tp cnt = 0;
|
if (i3 == 0) // write after read
|
if (i3 == 0) // write after read
|
begin
|
begin
|
// write request
|
// write request
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
Line 2344... |
Line 2351... |
// set address
|
// set address
|
reg_addr = 5'h0; // control register
|
reg_addr = 5'h0; // control register
|
phy_addr = 5'h1; // correct PHY address
|
phy_addr = 5'h1; // correct PHY address
|
cnt = 0;
|
cnt = 0;
|
// write request
|
// write request
|
phy_data = {8'h75, (i[7:0] + 1)};
|
phy_data = {8'h75, (i[7:0] + 1'b1)};
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
fork
|
fork
|
begin
|
begin
|
repeat(i) @(posedge Mdc_O);
|
repeat(i) @(posedge Mdc_O);
|
// write command 0x0 into MII command register
|
// write command 0x0 into MII command register
|
Line 2391... |
Line 2398... |
|
|
// try normal write or read after write was finished
|
// try normal write or read after write was finished
|
#Tp cnt = 0;
|
#Tp cnt = 0;
|
if (i3 == 0) // write after write
|
if (i3 == 0) // write after write
|
begin
|
begin
|
phy_data = {8'h7A, (i[7:0] + 1)};
|
phy_data = {8'h7A, (i[7:0] + 1'b1)};
|
// write request
|
// write request
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
// wait for serial bus to become active
|
// wait for serial bus to become active
|
wait(Mdio_IO !== 1'bz);
|
wait(Mdio_IO !== 1'bz);
|
// count transfer length
|
// count transfer length
|
Line 3856... |
Line 3863... |
// check the BUSY signal to see if the bus is still IDLE
|
// check the BUSY signal to see if the bus is still IDLE
|
for (i1 = 0; i1 < 8; i1 = i1 + 1)
|
for (i1 = 0; i1 < 8; i1 = i1 + 1)
|
check_mii_busy; // wait for bus to become idle
|
check_mii_busy; // wait for bus to become idle
|
|
|
// try normal write or read after scan was finished
|
// try normal write or read after scan was finished
|
phy_data = {8'h7D, (i[7:0] + 1)};
|
phy_data = {8'h7D, (i[7:0] + 1'b1)};
|
cnt = 0;
|
cnt = 0;
|
if (i3 == 0) // write after scan
|
if (i3 == 0) // write after scan
|
begin
|
begin
|
// write request
|
// write request
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
Line 4121... |
Line 4128... |
// check the BUSY signal to see if the bus is still IDLE
|
// check the BUSY signal to see if the bus is still IDLE
|
for (i1 = 0; i1 < 8; i1 = i1 + 1)
|
for (i1 = 0; i1 < 8; i1 = i1 + 1)
|
check_mii_busy; // wait for bus to become idle
|
check_mii_busy; // wait for bus to become idle
|
|
|
// try normal write or read after scan was finished
|
// try normal write or read after scan was finished
|
phy_data = {8'h7D, (i[7:0] + 1)};
|
phy_data = {8'h7D, (i[7:0] + 1'b1)};
|
cnt = 0;
|
cnt = 0;
|
if (i3 == 0) // write after scan
|
if (i3 == 0) // write after scan
|
begin
|
begin
|
// write request
|
// write request
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
#Tp mii_write_req(phy_addr, reg_addr, phy_data);
|
Line 19591... |
Line 19598... |
end
|
end
|
end
|
end
|
end
|
end
|
else
|
else
|
begin
|
begin
|
|
#200;
|
if(!MTxEn) // Pause frame was not received because RxFlow is turned off.
|
if(!MTxEn) // Pause frame was not received because RxFlow is turned off.
|
begin
|
begin
|
`TIME; $display("*E Transmission should be started because pause frame was not received (RxFlow=0).");
|
`TIME; $display("*E Transmission should be started because pause frame was not received (RxFlow=0).");
|
test_fail("Transmission should be started because pause frame was not received (RxFlow=0).");
|
test_fail("Transmission should be started because pause frame was not received (RxFlow=0).");
|
fail = fail + 1;
|
fail = fail + 1;
|