Line 14... |
Line 14... |
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;
|
integer start_addr_tx, end_addr_tx;
|
integer start_addr_tx, end_addr_tx;
|
integer index_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;
|
reg [31:0] packet_leng_tx;
|
reg [31:0] packet_leng_tx;
|
reg [ 7:0] packet_byte_tx;
|
reg [ 7:0] packet_byte_tx;
|
Line 41... |
Line 41... |
$fseek(feeder_file_tx, -4, 1);
|
$fseek(feeder_file_tx, -4, 1);
|
// skip pcap file header 24*8
|
// skip pcap file header 24*8
|
$fseek(feeder_file_tx, 24, 1);
|
$fseek(feeder_file_tx, 24, 1);
|
// read packet content
|
// read packet content
|
eof_tx = 0;
|
eof_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);
|
$fseek(feeder_file_tx, 8+4, 1);
|
Line 67... |
Line 68... |
begin
|
begin
|
@(posedge gmii_txclk_offset)
|
@(posedge gmii_txclk_offset)
|
gmii_txctrl = 1'b0;
|
gmii_txctrl = 1'b0;
|
gmii_txdata = 8'h00;
|
gmii_txdata = 8'h00;
|
end
|
end
|
// send frame pre-amble 555555d5=4*8
|
// send frame preamble and sfd 5555555d=4*8
|
repeat (3)
|
repeat (3)
|
begin
|
begin
|
@(posedge gmii_txclk_offset);
|
@(posedge gmii_txclk_offset);
|
gmii_txctrl = 1'b1;
|
gmii_txctrl = 1'b1;
|
gmii_txdata = 8'h55;
|
gmii_txdata = 8'h55;
|
end
|
end
|
@(posedge gmii_txclk_offset)
|
@(posedge gmii_txclk_offset)
|
gmii_txctrl = 1'b1;
|
gmii_txctrl = 1'b1;
|
gmii_txdata = 8'hd5;
|
gmii_txdata = 8'h5d;
|
// send frame content
|
// send frame content
|
for (index_tx=0; index_tx<packet_leng_tx; index_tx=index_tx+1)
|
for (index_tx=0; index_tx<packet_leng_tx; index_tx=index_tx+1)
|
begin
|
begin
|
r_tx = $fread(packet_byte_tx, feeder_file_tx);
|
r_tx = $fread(packet_byte_tx, feeder_file_tx);
|
@(posedge gmii_txclk_offset);
|
@(posedge gmii_txclk_offset);
|
Line 95... |
Line 96... |
gmii_txdata = 8'h00;
|
gmii_txdata = 8'h00;
|
disable fileread_loop;
|
disable fileread_loop;
|
end
|
end
|
end
|
end
|
end_addr_tx = $ftell(feeder_file_tx);
|
end_addr_tx = $ftell(feeder_file_tx);
|
|
num_tx = num_tx + 1;
|
end
|
end
|
$fclose(feeder_file_tx);
|
$fclose(feeder_file_tx);
|
gmii_txctrl = 1'b0;
|
gmii_txctrl = 1'b0;
|
gmii_txdata = 8'h00;
|
gmii_txdata = 8'h00;
|
end
|
end
|
#100 $stop;
|
|
end
|
end
|
|
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|