OpenCores
URL https://opencores.org/ocsvn/ha1588/ha1588/trunk

Subversion Repositories ha1588

[/] [ha1588/] [trunk/] [sim/] [top/] [nic_drv_bfm/] [gmii_rx_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_rx_bfm.v
 * $gmii_rx_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_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]};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.