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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [SPI/] [spi_sequence_item.svh] - Blame information for rev 47

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

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

powered by: WebSVN 2.1.0

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