OpenCores

Subversion Repositories ha1588

[/] [ha1588/] [trunk/] [sim/] [top/] [nic_drv_bfm/] [gmii_tx_bfm.v] - Diff between revs 34 and 37

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 34 Rev 37
Line 1... Line 1...
/*
/*
 * $gmii_tx_bfm.v
 * $gmii_tx_bfm.v
 *
 *
 * Copyright (c) 2012, BBY&HW. All rights reserved.
 * Copyright (c) 2012, BABY&HW. All rights reserved.
 *
 *
 * This library is free software; you can redistribute it and/or
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * version 2.1 of the License, or (at your option) any later version.
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]};

powered by: WebSVN 2.1.0

© copyright 1999-2014 OpenCores.org, equivalent to ORSoC AB, all rights reserved. OpenCores®, registered trademark.