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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [PCIe/] [sim/] [src/] [RIFFA/] [riffa_sequence_item.svh] - Blame information for rev 50

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 50 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2019 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
class riffa_sequence_item extends uvm_sequence_item;
29
  `uvm_object_utils(riffa_sequence_item)
30
 
31
  // --------------------------------------------------------------------
32
  riffa_transaction_t tr;
33
  int dwidth;
34
  bit [31:0] len; // length in 4 byte words
35
  bit [30:0] off;
36
  bit last;
37
  byte data[];
38
  int beats;
39
 
40
  // --------------------------------------------------------------------
41
  int size;
42
  int index = 0;
43
 
44
  // --------------------------------------------------------------------
45
  function void init(int dwidth, bit [31:0] len, bit [30:0] off, bit last);
46
    this.dwidth = dwidth;
47
    this.len = len;
48
    this.size = len * 4;
49
    this.data = new[size];
50
    this.beats = ((size % dwidth) == 0) ? (size / dwidth) : (size / dwidth) + 1;
51
  endfunction : init
52
 
53
  // // --------------------------------------------------------------------
54
  // function bit do_compare(uvm_object rhs, uvm_comparer comparer);
55
    // riffa_sequence_item tested;
56
    // bit same;
57
 
58
    // if (rhs==null)
59
      // `uvm_fatal(get_type_name(), "| %m | comparison to a null pointer");
60
 
61
    // if (!$cast(tested,rhs))
62
      // same = 0;
63
    // else
64
      // same  = super.do_compare(rhs, comparer);
65
 
66
    // return same;
67
  // endfunction : do_compare
68
 
69
  // --------------------------------------------------------------------
70
  function void do_copy(uvm_object rhs);
71
    riffa_sequence_item item;
72
    assert(rhs != null) else
73
      `uvm_fatal(get_type_name(), "| %m | copy null transaction");
74
    super.do_copy(rhs);
75
    assert($cast(item,rhs)) else
76
      `uvm_fatal(get_type_name(), "| %m | failed cast");
77
 
78
    tr     = item.tr    ;
79
    dwidth = item.dwidth;
80
    len    = item.len   ;
81
    off    = item.off   ;
82
    last   = item.last  ;
83
    data   = item.data  ;
84
    beats  = item.beats ;
85
    size   = item.size  ;
86
    index  = item.index ;
87
  endfunction : do_copy
88
 
89
  // // --------------------------------------------------------------------
90
  // function string convert2string();
91
    // string s0, s1, s2, s3;
92
    // s0 = $sformatf( "| %m | wr | rd | full | empty |\n");
93
    // s1 = $sformatf( "| %m | %1h  | %1h  | %1h    | %1h     |\n"
94
                  // , (command == FIFO_WR) || (command == FIFO_BOTH)
95
                  // , (command == FIFO_RD) || (command == FIFO_BOTH)
96
                  // , wr_full
97
                  // , rd_empty
98
                  // );
99
    // s2 = $sformatf("| %m | wr_data: %h\n" , wr_data);
100
    // s3 = $sformatf("| %m | rd_data: %h\n" , rd_data);
101
 
102
    // if(command == FIFO_NULL)
103
      // return {s1, s0};
104
    // else if(command == FIFO_BOTH)
105
      // return {s3, s2, s1, s0};
106
    // else if(command == FIFO_WR)
107
      // return {s2, s1, s0};
108
    // else if(command == FIFO_RD)
109
      // return {s3, s1, s0};
110
  // endfunction : convert2string
111
 
112
  // --------------------------------------------------------------------
113
  function new(string name = "");
114
    super.new(name);
115
  endfunction : new
116
 
117
// --------------------------------------------------------------------
118
endclass

powered by: WebSVN 2.1.0

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