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

Subversion Repositories hssdrc

[/] [hssdrc/] [trunk/] [testbench/] [hssrdc_scoreboard_class.sv] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 des00
//
2
// Project      : High-Speed SDRAM Controller with adaptive bank management and command pipeline
3
//
4
// Project Nick : HSSDRC
5
//
6
// Version      : 1.0-beta
7
//
8
// Revision     : $Revision: 1.1 $
9
//
10
// Date         : $Date: 2008-03-06 13:54:00 $
11
//
12
// Workfile     : hssrdc_scoreboard_class.sv
13
//
14
// Description  : scoreboard for test read transaction
15
//
16
// HSSDRC is licensed under MIT License
17
//
18
// Copyright (c) 2007-2008, Denis V.Shekhalev (des00@opencores.org)
19
//
20
// Permission  is hereby granted, free of charge, to any person obtaining a copy of
21
// this  software  and  associated documentation files (the "Software"), to deal in
22
// the  Software  without  restriction,  including without limitation the rights to
23
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
24
// the  Software, and to permit persons to whom the Software is furnished to do so,
25
// subject to the following conditions:
26
//
27
// The  above  copyright notice and this permission notice shall be included in all
28
// copies or substantial portions of the Software.
29
//
30
// THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
32
// FOR  A  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
33
// COPYRIGHT  HOLDERS  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
34
// IN  AN  ACTION  OF  CONTRACT,  TORT  OR  OTHERWISE,  ARISING  FROM, OUT OF OR IN
35
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36
//
37
 
38
 
39
 
40
`include "tb_define.svh"
41
 
42
`include "message_class.sv"
43
`include "hssrdc_driver_cbs_class.sv"
44
 
45
class hssdrc_scoreboard_class extends hssrdc_driver_cbs_class;
46
 
47
  sdram_tr_mbx   out_mbx;
48
  message_class  msg;
49
 
50
  event done;
51
 
52
  function new (message_class msg, ref event done);
53
 
54
    this.msg      = msg;
55
 
56
    this.done     = done;
57
 
58
  endfunction
59
 
60
  int checked_tr_num;
61
  int check_err_num;
62
 
63
  //
64
  //
65
  //
66
 
67
  task start ();
68
    checked_tr_num = 0;
69
    check_err_num  = 0;
70
  endtask
71
 
72
  //
73
  //
74
  //
75
 
76
  virtual task post_ReadData (input realtime t, sdram_transaction_class tr);
77
    tb_data_t golden_data2cmp;
78
    tb_data_t data2cmp;
79
 
80
    tb_chid_t golden_chid2cmp;
81
    tb_chid_t chid2cmp;
82
 
83
    tb_datam_t datam;
84
 
85
    int burst;
86
 
87
    string str;
88
  begin
89
 
90
    burst = tr.burst + 1;
91
 
92
    golden_chid2cmp = tr.chid;
93
 
94
    for (int i = 0; i < burst; i++) begin
95
 
96
      datam           = tr.wdatam [i];
97
 
98
      data2cmp        = MaskData(tr.rdata [i], datam);
99
      golden_data2cmp = MaskData(tr.wdata [i], datam);
100
 
101
      chid2cmp = tr.rchid [i];
102
 
103
      if (data2cmp !== golden_data2cmp) begin
104
        str = $psprintf("data compare error at ba = %0d, rowa = %0d, cola = %0d : ", tr.ba, tr.rowa, tr.cola);
105
        str = {str, ($psprintf("write data %h : read data %h", golden_data2cmp, data2cmp))};
106
        msg.err(str);
107
 
108
        check_err_num++;
109
      end
110
 
111
      if (chid2cmp !== golden_chid2cmp) begin
112
        str = $psprintf("chid compare error at ba = %0d, rowa = %0d, cola = %0d : ", tr.ba, tr.rowa, tr.cola);
113
        str = {str, ($psprintf("write chid %h : read chid %h", golden_chid2cmp, chid2cmp))};
114
        msg.err(str);
115
 
116
        check_err_num++;
117
      end
118
 
119
    end
120
 
121
    checked_tr_num++;
122
    -> done;
123
  end
124
  endtask
125
 
126
  //
127
  //
128
  //
129
 
130
  function data_t MaskData (input tb_data_t data, tb_datam_t datam);
131
    if (datam == 0)
132
      MaskData = data;
133
    else begin
134
      for (int m = 0; m < $size(datam); m++) begin
135
        for (int b = 0; b < 8; b++) begin
136
          MaskData[8*m + b] = data [8*m + b] & ~datam[m];
137
        end
138
      end
139
    end
140
  endfunction
141
 
142
endclass

powered by: WebSVN 2.1.0

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