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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_pkt_if.h] - Blame information for rev 14

Go to most recent revision | 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 6 antanguay
    sc_out<bool> pkt_tx_eop;
59
    sc_out<unsigned int> pkt_tx_mod;
60 2 antanguay
    sc_out<bool> pkt_tx_sop;
61
    sc_out<bool> pkt_tx_val;
62
 
63
    sc_in<bool> pkt_tx_full;
64
 
65
    sc_in<bool> pkt_rx_avail;
66
    sc_in<sc_bv<64> > pkt_rx_data;
67 6 antanguay
    sc_in<bool> pkt_rx_eop;
68
    sc_in<unsigned int> pkt_rx_mod;
69 2 antanguay
    sc_in<bool> pkt_rx_err;
70
    sc_in<bool> pkt_rx_sop;
71
    sc_in<bool> pkt_rx_val;
72
 
73
    sc_out<bool> pkt_rx_ren;
74
 
75
  private:
76
 
77
    //---
78
    // Variables
79
 
80
    sc_fifo<packet_t*> tx_fifo;
81
    sc_fifo<packet_t*> rx_fifo;
82
 
83
    scoreboard *sb;
84
    scoreboard::sbSourceId sb_id;
85
 
86
  public:
87
 
88
    //---
89
    // Variables
90
 
91
    bool disable_rx;
92
    bool allow_rx_sop_err;
93
 
94
    //---
95
    // Functions
96
 
97
    sc_fifo<packet_t*> * get_tx_fifo_ptr();
98
    sc_fifo<packet_t*> * get_rx_fifo_ptr();
99
 
100
    void init(void);
101
    void connect_scoreboard(scoreboard *sbptr, scoreboard::sbSourceId sid);
102
 
103
    //---
104
    // Threads
105
 
106
    void transmit();
107
    void receive();
108
 
109
    SC_CTOR(pkt_if) :
110
        tx_fifo (2),
111
        rx_fifo (2) {
112
 
113
        SC_CTHREAD (transmit, clk_156m25.pos());
114
 
115
        SC_CTHREAD (receive, clk_156m25.pos());
116
 
117
    }
118
 
119
};
120
 
121
#endif

powered by: WebSVN 2.1.0

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