Line 33... |
Line 33... |
gmii_txclk_offset = 1'b0;
|
gmii_txclk_offset = 1'b0;
|
forever #4 gmii_txclk_offset = !gmii_txclk_offset;
|
forever #4 gmii_txclk_offset = !gmii_txclk_offset;
|
end
|
end
|
assign #2 gmii_txclk = gmii_txclk_offset;
|
assign #2 gmii_txclk = gmii_txclk_offset;
|
|
|
integer feeder_file_tx, r_tx;
|
integer feeder_file_tx, r_tx, s_tx;
|
integer start_addr_tx, end_addr_tx;
|
integer start_addr_tx, end_addr_tx;
|
integer index_tx, num_tx;
|
integer index_tx, num_tx;
|
reg eof_tx;
|
reg eof_tx;
|
reg pcap_endian_tx;
|
reg pcap_endian_tx;
|
reg [31:0] pcap_4bytes_tx;
|
reg [31:0] pcap_4bytes_tx;
|
Line 57... |
Line 57... |
else
|
else
|
begin
|
begin
|
// test pcap file endian
|
// test pcap file endian
|
r_tx = $fread(pcap_4bytes_tx, feeder_file_tx);
|
r_tx = $fread(pcap_4bytes_tx, feeder_file_tx);
|
pcap_endian_tx = (pcap_4bytes_tx == 32'ha1b2c3d4)? 1:0;
|
pcap_endian_tx = (pcap_4bytes_tx == 32'ha1b2c3d4)? 1:0;
|
$fseek(feeder_file_tx, -4, 1);
|
s_tx = $fseek(feeder_file_tx, -4, 1);
|
// skip pcap file header 24*8
|
// skip pcap file header 24*8
|
$fseek(feeder_file_tx, 24, 1);
|
s_tx = $fseek(feeder_file_tx, 24, 1);
|
// read packet content
|
// read packet content
|
eof_tx = 0;
|
eof_tx = 0;
|
num_tx = 0;
|
num_tx = 0;
|
while (!eof_tx & !$feof(feeder_file_tx))
|
while (!eof_tx & !$feof(feeder_file_tx))
|
begin : fileread_loop
|
begin : fileread_loop
|
// skip frame header (8+4)*8
|
// skip frame header (8+4)*8
|
start_addr_tx = $ftell(feeder_file_tx);
|
start_addr_tx = $ftell(feeder_file_tx);
|
$fseek(feeder_file_tx, 8+4, 1);
|
s_tx = $fseek(feeder_file_tx, 8+4, 1);
|
// get frame length big endian 4*8
|
// get frame length big endian 4*8
|
r_tx = $fread(packet_leng_tx, feeder_file_tx);
|
r_tx = $fread(packet_leng_tx, feeder_file_tx);
|
packet_leng_tx = pcap_endian_tx?
|
packet_leng_tx = pcap_endian_tx?
|
{packet_leng_tx[31:24], packet_leng_tx[23:16], packet_leng_tx[15: 8], packet_leng_tx[ 7: 0]}:
|
{packet_leng_tx[31:24], packet_leng_tx[23:16], packet_leng_tx[15: 8], packet_leng_tx[ 7: 0]}:
|
{packet_leng_tx[ 7: 0], packet_leng_tx[15: 8], packet_leng_tx[23:16], packet_leng_tx[31:24]};
|
{packet_leng_tx[ 7: 0], packet_leng_tx[15: 8], packet_leng_tx[23:16], packet_leng_tx[31:24]};
|