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 29

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 29 antanguay
    int lenght_err_interval;
62
    int lenght_err_size;
63 2 antanguay
    int coding_interval;
64
    int local_fault_interval;
65
    int remote_fault_interval;
66
    int inject_pause_interval;
67
 
68
  public:
69
 
70
    //---
71
    // Functions
72
 
73
    void init(void);
74
 
75
    void connect_fifo(sc_fifo<packet_t*> * fifo);
76
 
77
    void set_tx_bucket(int cnt);
78
    int get_tx_bucket(void);
79
 
80
    void set_pkt_size(int min, int max);
81
 
82
    void set_crc_errors(int interval);
83
    void set_fragment_errors(int interval);
84 29 antanguay
    void set_lenght_errors(int interval, int size);
85 2 antanguay
    void set_coding_errors(int interval);
86
    void set_local_fault(int interval);
87
    void set_remote_fault(int interval);
88
    void set_inject_pause(int interval);
89
 
90
    //---
91
    // Threads
92
 
93
    void gen_packet();
94
 
95
    SC_CTOR(pkt_generator) {
96
 
97
        tx_bucket = 0;
98
 
99
        min_pkt_size = 64;
100
        max_pkt_size = 72;
101
 
102
        SC_THREAD (gen_packet);
103
 
104
    }
105
 
106
};
107
 
108
#endif

powered by: WebSVN 2.1.0

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