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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [tb/] [bfm_pkg.sv] - Blame information for rev 34

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
 
29
package bfm_pkg;
30
 
31
  // --------------------------------------------------------------------
32
  //
33
   typedef enum
34
   {
35
      NONE,
36
      REGULAR
37
      // BURSTY
38
   } traffic_type_e;
39
 
40
 
41
  // --------------------------------------------------------------------
42
  //
43
  class delay_class;
44
 
45
    rand int delay = 0;
46
 
47
 
48
    // --------------------------------------------------------------------
49
    //
50
    virtual function void set_delay(traffic_type_e kind = REGULAR);
51
      case(kind)
52
        NONE:     delay = 0;
53
        REGULAR:  assert(this.randomize() with{delay dist {0 := 40, [1:3] := 40, [4:7] := 20};});
54
        default:  assert(this.randomize() with{delay dist {0 := 40, [1:3] := 40, [4:7] := 20};});
55
      endcase
56
    endfunction: set_delay
57
 
58
 
59
    // --------------------------------------------------------------------
60
    //
61
    virtual function int next(traffic_type_e kind = REGULAR);
62
      set_delay(kind);
63
      return(delay);
64
    endfunction: next
65
 
66
 
67
  // --------------------------------------------------------------------
68
  //
69
  endclass: delay_class
70
 
71
 
72
  // --------------------------------------------------------------------
73
  //
74
  virtual class transaction_class #(parameter type TR_T);
75
 
76
    delay_class delay_h;
77
 
78
    // --------------------------------------------------------------------
79
    //
80
    function void random;
81
      assert(this.randomize());
82
    endfunction: random
83
 
84
 
85
    //--------------------------------------------------------------------
86
    //
87
    function new;
88
      delay_h = new();
89
    endfunction: new
90
 
91
 
92
    // --------------------------------------------------------------------
93
    //
94
    pure virtual function void copy(TR_T from);
95
 
96
 
97
    // --------------------------------------------------------------------
98
    //
99
    function automatic TR_T clone;
100
      TR_T child;
101
      clone = new();
102
      $cast(child, this);
103
      clone.copy(child);
104
      return(clone);
105
    endfunction: clone
106
 
107
 
108
  // --------------------------------------------------------------------
109
  //
110
  endclass: transaction_class
111
 
112
 
113
//--------------------------------------------------------------------
114
//
115
endpackage: bfm_pkg
116
 

powered by: WebSVN 2.1.0

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