Line 33... |
Line 33... |
gmii_rxclk_offset = 1'b0;
|
gmii_rxclk_offset = 1'b0;
|
forever #4 gmii_rxclk_offset = !gmii_rxclk_offset;
|
forever #4 gmii_rxclk_offset = !gmii_rxclk_offset;
|
end
|
end
|
assign #2 gmii_rxclk = gmii_rxclk_offset;
|
assign #2 gmii_rxclk = gmii_rxclk_offset;
|
|
|
integer feeder_file_rx, r_rx;
|
integer feeder_file_rx, r_rx, s_rx;
|
integer start_addr_rx, end_addr_rx;
|
integer start_addr_rx, end_addr_rx;
|
integer index_rx, num_rx;
|
integer index_rx, num_rx;
|
reg eof_rx;
|
reg eof_rx;
|
reg pcap_endian_rx;
|
reg pcap_endian_rx;
|
reg [31:0] pcap_4bytes_rx;
|
reg [31:0] pcap_4bytes_rx;
|
Line 57... |
Line 57... |
else
|
else
|
begin
|
begin
|
// test pcap file endian
|
// test pcap file endian
|
r_rx = $fread(pcap_4bytes_rx, feeder_file_rx);
|
r_rx = $fread(pcap_4bytes_rx, feeder_file_rx);
|
pcap_endian_rx = (pcap_4bytes_rx == 32'ha1b2c3d4)? 1:0;
|
pcap_endian_rx = (pcap_4bytes_rx == 32'ha1b2c3d4)? 1:0;
|
$fseek(feeder_file_rx, -4, 1);
|
s_rx = $fseek(feeder_file_rx, -4, 1);
|
// skip pcap file header 24*8
|
// skip pcap file header 24*8
|
$fseek(feeder_file_rx, 24, 1);
|
s_rx = $fseek(feeder_file_rx, 24, 1);
|
// read packet content
|
// read packet content
|
eof_rx = 0;
|
eof_rx = 0;
|
num_rx = 0;
|
num_rx = 0;
|
while (!eof_rx & !$feof(feeder_file_rx))
|
while (!eof_rx & !$feof(feeder_file_rx))
|
begin : fileread_loop
|
begin : fileread_loop
|
// skip frame header (8+4)*8
|
// skip frame header (8+4)*8
|
start_addr_rx = $ftell(feeder_file_rx);
|
start_addr_rx = $ftell(feeder_file_rx);
|
$fseek(feeder_file_rx, 8+4, 1);
|
s_rx = $fseek(feeder_file_rx, 8+4, 1);
|
// get frame length big endian 4*8
|
// get frame length big endian 4*8
|
r_rx = $fread(packet_leng_rx, feeder_file_rx);
|
r_rx = $fread(packet_leng_rx, feeder_file_rx);
|
packet_leng_rx = pcap_endian_rx?
|
packet_leng_rx = pcap_endian_rx?
|
{packet_leng_rx[31:24], packet_leng_rx[23:16], packet_leng_rx[15: 8], packet_leng_rx[ 7: 0]}:
|
{packet_leng_rx[31:24], packet_leng_rx[23:16], packet_leng_rx[15: 8], packet_leng_rx[ 7: 0]}:
|
{packet_leng_rx[ 7: 0], packet_leng_rx[15: 8], packet_leng_rx[23:16], packet_leng_rx[31:24]};
|
{packet_leng_rx[ 7: 0], packet_leng_rx[15: 8], packet_leng_rx[23:16], packet_leng_rx[31:24]};
|