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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [basal/] [sim/] [tests/] [tb_fifo/] [fifo_scoreboard.svh] - Blame information for rev 44

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 44 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 fifo_scoreboard extends uvm_subscriber #(fifo_sequence_item);
29
  `uvm_component_utils(fifo_scoreboard);
30
 
31
  // --------------------------------------------------------------------
32
  function new (string name, uvm_component parent);
33
    super.new(name, parent);
34
  endfunction : new
35
 
36
  // --------------------------------------------------------------------
37
  function void build_phase(uvm_phase phase);
38
  endfunction : build_phase
39
 
40
  // --------------------------------------------------------------------
41
  mailbox #(fifo_sequence_item) mb = new();
42
  fifo_sequence_item c_t;
43
  fifo_sequence_item item;
44
  int m_matches = 0;
45
  int m_mismatches = 0;
46
 
47
  function void write(fifo_sequence_item t);
48
 
49
    $cast(c_t, t.clone);
50
 
51
    if((c_t.command = FIFO_WR) || (c_t.command = FIFO_BOTH))
52
      mb.try_put(c_t);
53
 
54
    if((c_t.command = FIFO_RD) || (c_t.command = FIFO_BOTH))
55
      mb.try_get(item);
56
 
57
    if(~c_t.compare(item))
58
    begin
59
      uvm_report_info(get_name(), $sformatf("^^^ %16.t | %m | MISMATCH!!! | %s", $time, {20{"-"}}));
60
      uvm_report_info(get_name(), c_t.convert2string);
61
      uvm_report_info(get_name(), item.convert2string);
62
      m_mismatches++;
63
    end
64
    else
65
      m_matches++;
66
  endfunction : write
67
 
68
  // --------------------------------------------------------------------
69
  function void report_phase(uvm_phase phase);
70
    uvm_report_info(get_name(), $sformatf("Matches   : %0d", m_matches));
71
    uvm_report_info(get_name(), $sformatf("Mismatches: %0d", m_mismatches));
72
  endfunction
73
 
74
// --------------------------------------------------------------------
75
endclass : fifo_scoreboard

powered by: WebSVN 2.1.0

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