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

Subversion Repositories xge_mac

[/] [xge_mac/] [tags/] [initial/] [tbench/] [systemc/] [sc_pkt_if.h] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 antanguay
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "sc_pkt_if.h"                                     ////
4
////                                                              ////
5
////  This file is part of the "10GE MAC" project                 ////
6
////  http://www.opencores.org/cores/xge_mac/                     ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - A. Tanguay (antanguay@opencores.org)                  ////
10
////                                                              ////
11
//////////////////////////////////////////////////////////////////////
12
////                                                              ////
13
//// Copyright (C) 2008 AUTHORS. All rights reserved.             ////
14
////                                                              ////
15
//// This source file may be used and distributed without         ////
16
//// restriction provided that this copyright statement is not    ////
17
//// removed from the file and that any derivative work contains  ////
18
//// the original copyright notice and the associated disclaimer. ////
19
////                                                              ////
20
//// This source file is free software; you can redistribute it   ////
21
//// and/or modify it under the terms of the GNU Lesser General   ////
22
//// Public License as published by the Free Software Foundation; ////
23
//// either version 2.1 of the License, or (at your option) any   ////
24
//// later version.                                               ////
25
////                                                              ////
26
//// This source is distributed in the hope that it will be       ////
27
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
28
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
29
//// PURPOSE.  See the GNU Lesser General Public License for more ////
30
//// details.                                                     ////
31
////                                                              ////
32
//// You should have received a copy of the GNU Lesser General    ////
33
//// Public License along with this source; if not, download it   ////
34
//// from http://www.opencores.org/lgpl.shtml                     ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
 
38
#ifndef PKT_IF_H
39
#define PKT_IF_H
40
 
41
#include "systemc.h"
42
 
43
#include "sc_packet.h"
44
#include "sc_scoreboard.h"
45
 
46
SC_MODULE(pkt_if) {
47
 
48
  public:
49
 
50
    //---
51
    // Ports
52
 
53
    sc_in<bool> clk_156m25;
54
 
55
    sc_in<bool> reset_156m25_n;
56
 
57
    sc_out<sc_bv<64> > pkt_tx_data;
58
    sc_out<unsigned int> pkt_tx_eop;
59
    sc_out<bool> pkt_tx_sop;
60
    sc_out<bool> pkt_tx_val;
61
 
62
    sc_in<bool> pkt_tx_full;
63
 
64
    sc_in<bool> pkt_rx_avail;
65
    sc_in<sc_bv<64> > pkt_rx_data;
66
    sc_in<unsigned int> pkt_rx_eop;
67
    sc_in<bool> pkt_rx_err;
68
    sc_in<bool> pkt_rx_sop;
69
    sc_in<bool> pkt_rx_val;
70
 
71
    sc_out<bool> pkt_rx_ren;
72
 
73
  private:
74
 
75
    //---
76
    // Variables
77
 
78
    sc_fifo<packet_t*> tx_fifo;
79
    sc_fifo<packet_t*> rx_fifo;
80
 
81
    scoreboard *sb;
82
    scoreboard::sbSourceId sb_id;
83
 
84
  public:
85
 
86
    //---
87
    // Variables
88
 
89
    bool disable_rx;
90
    bool allow_rx_sop_err;
91
 
92
    //---
93
    // Functions
94
 
95
    sc_fifo<packet_t*> * get_tx_fifo_ptr();
96
    sc_fifo<packet_t*> * get_rx_fifo_ptr();
97
 
98
    void init(void);
99
    void connect_scoreboard(scoreboard *sbptr, scoreboard::sbSourceId sid);
100
 
101
    //---
102
    // Threads
103
 
104
    void transmit();
105
    void receive();
106
 
107
    SC_CTOR(pkt_if) :
108
        tx_fifo (2),
109
        rx_fifo (2) {
110
 
111
        SC_CTHREAD (transmit, clk_156m25.pos());
112
 
113
        SC_CTHREAD (receive, clk_156m25.pos());
114
 
115
    }
116
 
117
};
118
 
119
#endif

powered by: WebSVN 2.1.0

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