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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_pkt_generator.h] - Blame information for rev 28

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_generator.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 GENERATOR_H
39
#define GENERATOR_H
40
 
41
#include "systemc.h"
42
 
43
#include "sc_packet.h"
44
 
45
SC_MODULE(pkt_generator) {
46
 
47
  private:
48
 
49
    //---
50
    // Variables
51
 
52
    sc_fifo<packet_t*> * tx_fifo;
53
 
54
    int tx_bucket;
55
 
56
    int min_pkt_size;
57
    int max_pkt_size;
58
 
59
    int crc_interval;
60
    int fragment_interval;
61
    int coding_interval;
62
    int local_fault_interval;
63
    int remote_fault_interval;
64
    int inject_pause_interval;
65
 
66
  public:
67
 
68
    //---
69
    // Functions
70
 
71
    void init(void);
72
 
73
    void connect_fifo(sc_fifo<packet_t*> * fifo);
74
 
75
    void set_tx_bucket(int cnt);
76
    int get_tx_bucket(void);
77
 
78
    void set_pkt_size(int min, int max);
79
 
80
    void set_crc_errors(int interval);
81
    void set_fragment_errors(int interval);
82
    void set_coding_errors(int interval);
83
    void set_local_fault(int interval);
84
    void set_remote_fault(int interval);
85
    void set_inject_pause(int interval);
86
 
87
    //---
88
    // Threads
89
 
90
    void gen_packet();
91
 
92
    SC_CTOR(pkt_generator) {
93
 
94
        tx_bucket = 0;
95
 
96
        min_pkt_size = 64;
97
        max_pkt_size = 72;
98
 
99
        SC_THREAD (gen_packet);
100
 
101
    }
102
 
103
};
104
 
105
#endif

powered by: WebSVN 2.1.0

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