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 29

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 19 antanguay
#include "sc_defines.h"
44
 
45 2 antanguay
#include "sc_packet.h"
46
#include "sc_scoreboard.h"
47
 
48
SC_MODULE(pkt_if) {
49
 
50
  public:
51
 
52
    //---
53
    // Ports
54
 
55
    sc_in<bool> clk_156m25;
56
 
57
    sc_in<bool> reset_156m25_n;
58
 
59 19 antanguay
    sc_out<vluint64_t > pkt_tx_data;
60 6 antanguay
    sc_out<bool> pkt_tx_eop;
61
    sc_out<unsigned int> pkt_tx_mod;
62 2 antanguay
    sc_out<bool> pkt_tx_sop;
63
    sc_out<bool> pkt_tx_val;
64
 
65
    sc_in<bool> pkt_tx_full;
66
 
67
    sc_in<bool> pkt_rx_avail;
68 19 antanguay
    sc_in<vluint64_t > pkt_rx_data;
69 6 antanguay
    sc_in<bool> pkt_rx_eop;
70
    sc_in<unsigned int> pkt_rx_mod;
71 2 antanguay
    sc_in<bool> pkt_rx_err;
72
    sc_in<bool> pkt_rx_sop;
73
    sc_in<bool> pkt_rx_val;
74
 
75
    sc_out<bool> pkt_rx_ren;
76
 
77
  private:
78
 
79
    //---
80
    // Variables
81
 
82
    sc_fifo<packet_t*> tx_fifo;
83
    sc_fifo<packet_t*> rx_fifo;
84
 
85
    scoreboard *sb;
86
    scoreboard::sbSourceId sb_id;
87
 
88
  public:
89
 
90
    //---
91
    // Variables
92
 
93
    bool disable_rx;
94 29 antanguay
    bool flush_rx;
95 2 antanguay
    bool allow_rx_sop_err;
96
 
97
    //---
98
    // Functions
99
 
100
    sc_fifo<packet_t*> * get_tx_fifo_ptr();
101
    sc_fifo<packet_t*> * get_rx_fifo_ptr();
102
 
103
    void init(void);
104
    void connect_scoreboard(scoreboard *sbptr, scoreboard::sbSourceId sid);
105
 
106
    //---
107
    // Threads
108
 
109
    void transmit();
110
    void receive();
111
 
112
    SC_CTOR(pkt_if) :
113
        tx_fifo (2),
114
        rx_fifo (2) {
115
 
116
        SC_CTHREAD (transmit, clk_156m25.pos());
117
 
118
        SC_CTHREAD (receive, clk_156m25.pos());
119
 
120
    }
121
 
122
};
123
 
124
#endif

powered by: WebSVN 2.1.0

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