Line 70... |
Line 70... |
reg [7:0] st_data;
|
reg [7:0] st_data;
|
reg [31:0] lfsr;
|
reg [31:0] lfsr;
|
integer lfsr_last_byte;
|
integer lfsr_last_byte;
|
|
|
// Is number of ethernet packets to send if doing the eth-rx test.
|
// Is number of ethernet packets to send if doing the eth-rx test.
|
parameter eth_stim_num_rx_only_num_packets = 500; // Set to 0 for continuous RX
|
parameter eth_stim_num_rx_only_num_packets = 12; // Set to 0 for continuous RX
|
parameter eth_stim_num_rx_only_packet_size = 512;
|
parameter eth_stim_num_rx_only_packet_size = 60;
|
parameter eth_stim_num_rx_only_packet_size_change = 2'b01; // 2'b01: Increment
|
parameter eth_stim_num_rx_only_packet_size_change = 2'b01; // 2'b01: Increment
|
parameter eth_stim_num_rx_only_packet_size_change_amount = 1;
|
parameter eth_stim_num_rx_only_packet_size_change_amount = 127;
|
parameter eth_stim_num_rx_only_IPG = 800000000; // ns
|
parameter eth_stim_num_rx_only_IPG = 180_000_000; // ps
|
|
|
// Do call/response test
|
// Do call/response test
|
reg eth_stim_do_rx_reponse_to_tx;
|
reg eth_stim_do_rx_reponse_to_tx;
|
|
|
|
|
Line 93... |
Line 93... |
//parameter rx_while_tx_min_packet_size = max_eth_packet_size;
|
//parameter rx_while_tx_min_packet_size = max_eth_packet_size;
|
parameter rx_while_tx_min_packet_size = 32;
|
parameter rx_while_tx_min_packet_size = 32;
|
|
|
// Use the smallest possible IPG
|
// Use the smallest possible IPG
|
parameter eth_stim_use_min_IPG = 0;
|
parameter eth_stim_use_min_IPG = 0;
|
parameter eth_stim_IPG_delay_max = 500_000; // Maximum 500uS ga
|
parameter eth_stim_IPG_delay_max = 500_000_000; // Maximum 500uS ga
|
//parameter eth_stim_IPG_delay_max = 100_000_000; // Maximum 100mS between packets
|
//parameter eth_stim_IPG_delay_max = 100_000_000; // Maximum 100mS between packets
|
parameter eth_stim_IPG_min_10mb = 9600; // 9.6 uS
|
parameter eth_stim_IPG_min_10mb = 9600_000; // 9.6 uS
|
parameter eth_stim_IPG_min_100mb = 800; // 860+~100 = 960 nS 100MBit min IPG
|
parameter eth_stim_IPG_min_100mb = 800_000; // 860+~100 = 960 nS 100MBit min IPG
|
parameter eth_stim_check_rx_packet_contents = 1;
|
parameter eth_stim_check_rx_packet_contents = 1;
|
parameter eth_stim_check_tx_packet_contents = 1;
|
parameter eth_stim_check_tx_packet_contents = 1;
|
|
|
parameter eth_inject_errors = 0;
|
parameter eth_inject_errors = 0;
|
|
|
Line 113... |
Line 113... |
// For 25MHz sdram controller, use following:
|
// For 25MHz sdram controller, use following:
|
//parameter Td_rx_packet_check = (`BOARD_CLOCK_PERIOD * 2000);
|
//parameter Td_rx_packet_check = (`BOARD_CLOCK_PERIOD * 2000);
|
// For 64MHz sdram controller, use following:
|
// For 64MHz sdram controller, use following:
|
parameter Td_rx_packet_check = (`BOARD_CLOCK_PERIOD * 500);
|
parameter Td_rx_packet_check = (`BOARD_CLOCK_PERIOD * 500);
|
|
|
|
|
|
|
integer expected_rxbd;// init to 0
|
integer expected_rxbd;// init to 0
|
integer expected_txbd;
|
integer expected_txbd;
|
|
|
wire ethmac_rxen;
|
wire ethmac_rxen;
|
wire ethmac_txen;
|
wire ethmac_txen;
|
Line 579... |
Line 577... |
end
|
end
|
endtask // get_byte_from_xilinx_ddr2
|
endtask // get_byte_from_xilinx_ddr2
|
|
|
`endif
|
`endif
|
|
|
|
`ifdef XILINX_DDR2
|
|
task sync_controller_cache_xilinx_ddr;
|
|
begin
|
|
// Sync cache (writeback dirty lines) with external memory
|
|
dut.xilinx_ddr2_0.xilinx_ddr2_if0.do_sync;
|
|
// Wait for it to occur.
|
|
while (dut.xilinx_ddr2_0.xilinx_ddr2_if0.sync)
|
|
#100;
|
|
|
|
// Wait just incase writeback of all data hasn't fully occurred.
|
|
// 4uS, in case RAM needs to refresh while writing back.
|
|
#4_000_000;
|
|
|
|
|
|
end
|
|
endtask // sync_controller_cache_xilinx_ddr
|
|
`endif
|
|
|
|
|
//
|
//
|
// Check packet TX'd by MAC was good
|
// Check packet TX'd by MAC was good
|
//
|
//
|
task check_tx_packet;
|
task check_tx_packet;
|
Line 615... |
Line 631... |
eth_phy0.tx_len-4, tx_len_bd);
|
eth_phy0.tx_len-4, tx_len_bd);
|
#100;
|
#100;
|
$finish;
|
$finish;
|
end
|
end
|
|
|
|
`ifdef XILINX_DDR2
|
|
sync_controller_cache_xilinx_ddr;
|
|
`endif
|
|
|
get_bd_addr(tx_bd_num, tx_bd_addr);
|
get_bd_addr(tx_bd_num, tx_bd_addr);
|
|
|
// We're never going to be using more than about 256K of receive buffer
|
// We're never going to be using more than about 256K of receive buffer
|
// so let's lop off the top bit of the address pointer - we only want
|
// so let's lop off the top bit of the address pointer - we only want
|
// the offset from the base of the memory bank
|
// the offset from the base of the memory bank
|
Line 632... |
Line 652... |
begin
|
begin
|
//$display("Checking address in tx bd 0x%0h",txpnt_sdram);
|
//$display("Checking address in tx bd 0x%0h",txpnt_sdram);
|
sdram_byte = 8'hx;
|
sdram_byte = 8'hx;
|
`ifdef RAM_WB
|
`ifdef RAM_WB
|
sdram_byte = dut.ram_wb0.ram_wb_b3_0.get_byte(txpnt_sdram);
|
sdram_byte = dut.ram_wb0.ram_wb_b3_0.get_byte(txpnt_sdram);
|
`endif
|
`else
|
`ifdef VERSATILE_SDRAM
|
`ifdef VERSATILE_SDRAM
|
sdram0.get_byte(txpnt_sdram,sdram_byte);
|
sdram0.get_byte(txpnt_sdram,sdram_byte);
|
`endif
|
`else
|
`ifdef XILINX_DDR2
|
`ifdef XILINX_DDR2
|
get_byte_from_xilinx_ddr2(txpnt_sdram, sdram_byte);
|
get_byte_from_xilinx_ddr2(txpnt_sdram, sdram_byte);
|
`endif
|
`else
|
if (sdram_byte === 8'hx)
|
|
begin
|
|
$display(" * Error: sdram_byte was %x", sdram_byte);
|
$display(" * Error: sdram_byte was %x", sdram_byte);
|
|
|
$display(" * eth_stim needs to be able to access the main memory to check packet rx/tx");
|
$display(" * eth_stim needs to be able to access the main memory to check packet rx/tx");
|
$display(" * RAM pointer for BD is 0x%h, bank offset we'll use is 0x%h",
|
|
tx_bd_addr, txpnt_wb);
|
|
$finish;
|
$finish;
|
end
|
|
|
|
|
`endif
|
|
`endif
|
|
`endif
|
|
|
phy_byte = eth_phy0.tx_mem[buffer];
|
phy_byte = eth_phy0.tx_mem[buffer];
|
// Debugging output
|
// Debugging output
|
//$display("txpnt_sdram = 0x%h, sdram_byte = 0x%h, buffer = 0x%h, phy_byte = 0x%h", txpnt_sdram, sdram_byte, buffer, phy_byte);
|
//$display("txpnt_sdram = 0x%h, sdram_byte = 0x%h, buffer = 0x%h, phy_byte = 0x%h", txpnt_sdram, sdram_byte, buffer, phy_byte);
|
|
|
if (phy_byte !== sdram_byte)
|
if (phy_byte !== sdram_byte)
|
begin
|
begin
|
`TIME;
|
`TIME;
|
$display("*E Wrong byte (%d) of TX packet! ram = %h, phy = %h",buffer, sdram_byte, phy_byte);
|
$display("*E Wrong byte (%d) of TX packet! ram = %h, phy = %h",buffer, sdram_byte, phy_byte);
|
failure = 1;
|
failure = 1;
|
Line 1105... |
Line 1124... |
|
|
reg [31:0] rxpnt_wb; // Pointer in array to where data should be
|
reg [31:0] rxpnt_wb; // Pointer in array to where data should be
|
reg [24:0] rxpnt_sdram; // byte address from CPU in RAM
|
reg [24:0] rxpnt_sdram; // byte address from CPU in RAM
|
reg [15:0] sdram_short;
|
reg [15:0] sdram_short;
|
reg [7:0] sdram_byte;
|
reg [7:0] sdram_byte;
|
//reg [7:0] phy_rx_mem [0:2000];
|
|
|
|
integer i;
|
integer i;
|
integer failure;
|
integer failure;
|
|
|
begin
|
begin
|
Line 1130... |
Line 1148... |
|
|
// Delay some time - takes a bit for the Wishbone FSM to pipe out the
|
// Delay some time - takes a bit for the Wishbone FSM to pipe out the
|
// packet over Wishbone and into whatever memory it's going into
|
// packet over Wishbone and into whatever memory it's going into
|
#Td_rx_packet_check;
|
#Td_rx_packet_check;
|
|
|
|
`ifdef XILINX_DDR2
|
|
sync_controller_cache_xilinx_ddr;
|
|
`endif
|
|
|
// Ok, buffer filled, let's get its offset in memory
|
// Ok, buffer filled, let's get its offset in memory
|
get_bd_addr(rx_bd_num, rx_bd_addr);
|
get_bd_addr(rx_bd_num, rx_bd_addr);
|
|
|
$display("(%t) Check RX packet: bd %d: 0x%h, addr 0x%h",$time,
|
$display("(%t) Check RX packet: bd %d: 0x%h, addr 0x%h",$time,
|
rx_bd_num, rx_bd_lenstat, rx_bd_addr);
|
rx_bd_num, rx_bd_lenstat, rx_bd_addr);
|
Line 1152... |
Line 1174... |
|
|
for (i=0;i<len;i=i+1)
|
for (i=0;i<len;i=i+1)
|
begin
|
begin
|
|
|
sdram_byte = 8'hx;
|
sdram_byte = 8'hx;
|
`ifdef RAM_WB
|
|
sdram_byte = dut.ram_wb0.ram_wb_b3_0.get_byte(rxpnt_sdram);
|
|
`endif
|
|
`ifdef VERSATILE_SDRAM
|
|
sdram0.get_byte(rxpnt_sdram,sdram_byte);
|
|
`endif
|
|
`ifdef XILINX_DDR2
|
`ifdef XILINX_DDR2
|
get_byte_from_xilinx_ddr2(rxpnt_sdram, sdram_byte);
|
get_byte_from_xilinx_ddr2(rxpnt_sdram, sdram_byte);
|
`endif
|
`else
|
if (sdram_byte === 8'hx)
|
|
begin
|
|
$display(" * Error:");
|
$display(" * Error:");
|
|
|
$display(" * eth_stim needs to be able to access the main memory to check packet rx/tx");
|
$display(" * eth_stim needs to be able to access the main memory to check packet rx/tx");
|
$display("RAM pointer for BD is 0x%h, bank offset we'll use is 0x%h",
|
|
rx_bd_addr, rxpnt_wb);
|
|
$finish;
|
$finish;
|
end
|
`endif
|
|
|
phy_byte = eth_rx_sent_circbuf[eth_rx_sent_circbuf_read_ptr];//phy_rx_mem[buffer]; //eth_phy0.rx_mem[buffer];
|
phy_byte = eth_rx_sent_circbuf[eth_rx_sent_circbuf_read_ptr];
|
|
|
if (phy_byte !== sdram_byte)
|
if (phy_byte !== sdram_byte)
|
begin
|
begin
|
// `TIME;
|
// `TIME;
|
$display("*E Wrong byte (%5d) of RX packet %5d! phy = %h, ram = %h",
|
$display("*E Wrong byte (%5d) of RX packet %5d. phy mem = %h, ram = %h",
|
i, eth_rx_num_packets_checked, phy_byte, sdram_byte);
|
i, eth_rx_num_packets_checked, phy_byte, sdram_byte);
|
failure = 1;
|
failure = 1;
|
end
|
end
|
|
|
eth_rx_sent_circbuf_read_ptr = (eth_rx_sent_circbuf_read_ptr+1)&
|
eth_rx_sent_circbuf_read_ptr = (eth_rx_sent_circbuf_read_ptr+1)&
|