OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [tags/] [v0.0/] [hw/] [src/] [tb/] [bfm_eth_log/] [rgmii_rx_if.sv] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 kuzmi4
//////////////////////////////////////////////////////////////////////////////////
2
// Company:
3
// Engineer:        IK
4
//
5
// Create Date:     11:35:01 03/21/2013
6
// Design Name:
7
// Module Name:     rgmii_rx_if
8
// Project Name:
9
// Target Devices:
10
// Tool versions:
11
// Description:
12
//
13
//
14
// Revision:
15
// Revision 0.01 - File Created,
16
//
17
//////////////////////////////////////////////////////////////////////////////////
18
`timescale 1ns / 1ps
19
 
20
interface rgmii_rx_if
21
(
22
    input i_clk
23
);
24
//////////////////////////////////////////////////////////////////////////////////
25
//
26
localparam  lp_MTU = 1500;
27
//
28
localparam  lp_ETH_SFD_LEN = 8; // ...the corresponding hexadecimal representation is 0x55 0x55 0x55 0x55 0x55 0x55 0x55 0xD5.
29
//////////////////////////////////////////////////////////////////////////////////
30
    //
31
    logic           i_rxc;
32
    logic   [ 3:0]  iv_rxd;
33
    //
34
    bit [ 7:0]  sv_rx_pkt[lp_MTU];
35
    int         sv_bpos;
36
    int         sv_rx_len;
37
    //
38
    bit         s_verbose;
39
 
40
//////////////////////////////////////////////////////////////////////////////////
41
//
42
default clocking cb @(posedge i_clk or negedge i_clk);
43
endclocking : cb
44
 
45
//////////////////////////////////////////////////////////////////////////////////
46
//
47
task init(input i_verbose=0);
48
    //
49
    sv_bpos = 0;
50
    sv_rx_len = 0;
51
    s_verbose = i_verbose;
52
    //
53
    foreach(sv_rx_pkt[i])
54
        sv_rx_pkt[i] = 0;
55
    // Final
56
endtask : init
57
 
58
task rx_pkt;
59
    //
60
    do @cb;
61
    while (i_rxc == 0);
62
    //
63
    sv_bpos = 0;
64
    sv_rx_len = 0;
65
    foreach(sv_rx_pkt[i])
66
        sv_rx_pkt[i] = 0;
67
    //
68
    do begin : RX_PKT
69
        //
70
        if (sv_bpos == 0)
71
            begin
72
                sv_rx_pkt[sv_rx_len][3:0] = iv_rxd;
73
                sv_bpos = 1;
74
            end
75
        else
76
            begin
77
                sv_rx_pkt[sv_rx_len++][7:4] = iv_rxd;
78
                sv_bpos = 0;
79
            end
80
        //
81
        @cb;
82
        end while(i_rxc == 1);
83
        if (s_verbose)
84
            $display("[%t]: %m: rx-done", $time);
85
    //
86
endtask : rx_pkt
87
//////////////////////////////////////////////////////////////////////////////////
88
//
89
//
90
//
91
 
92
function int rx_pkt_len;
93
    return(sv_rx_len-lp_ETH_SFD_LEN);
94
endfunction : rx_pkt_len
95
 
96
function [7:0] rx_pkt_data(input int ii_idx);
97
    return(sv_rx_pkt[lp_ETH_SFD_LEN+ii_idx]);
98
endfunction : rx_pkt_data
99
 
100
//////////////////////////////////////////////////////////////////////////////////
101
endinterface : rgmii_rx_if

powered by: WebSVN 2.1.0

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