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

Subversion Repositories hssdrc

[/] [hssdrc/] [trunk/] [testbench/] [hssrdc_scoreboard_class.sv] - Diff between revs 2 and 3

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 3
//
//
// Project      : High-Speed SDRAM Controller with adaptive bank management and command pipeline
// Project      : High-Speed SDRAM Controller with adaptive bank management and command pipeline
//
//
// Project Nick : HSSDRC
// Project Nick : HSSDRC
//
//
// Version      : 1.0-beta
// Version      : 1.0-beta
//
//
// Revision     : $Revision: 1.1 $
// Revision     : $Revision: 1.1 $
//
//
// Date         : $Date: 2008-03-06 13:54:00 $
// Date         : $Date: 2008-03-06 13:54:00 $
//
//
// Workfile     : hssrdc_scoreboard_class.sv
// Workfile     : hssrdc_scoreboard_class.sv
//
//
// Description  : scoreboard for test read transaction
// Description  : scoreboard for test read transaction
//
//
// HSSDRC is licensed under MIT License
// HSSDRC is licensed under MIT License
//
//
// Copyright (c) 2007-2008, Denis V.Shekhalev (des00@opencores.org)
// Copyright (c) 2007-2008, Denis V.Shekhalev (des00@opencores.org)
//
//
// Permission  is hereby granted, free of charge, to any person obtaining a copy of
// Permission  is hereby granted, free of charge, to any person obtaining a copy of
// this  software  and  associated documentation files (the "Software"), to deal in
// this  software  and  associated documentation files (the "Software"), to deal in
// the  Software  without  restriction,  including without limitation the rights to
// the  Software  without  restriction,  including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the  Software, and to permit persons to whom the Software is furnished to do so,
// the  Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// subject to the following conditions:
//
//
// The  above  copyright notice and this permission notice shall be included in all
// The  above  copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// copies or substantial portions of the Software.
//
//
// THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR  A  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// FOR  A  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT  HOLDERS  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// COPYRIGHT  HOLDERS  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN  AN  ACTION  OF  CONTRACT,  TORT  OR  OTHERWISE,  ARISING  FROM, OUT OF OR IN
// IN  AN  ACTION  OF  CONTRACT,  TORT  OR  OTHERWISE,  ARISING  FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
`include "tb_define.svh"
`include "tb_define.svh"
`include "message_class.sv"
`include "message_class.sv"
`include "hssrdc_driver_cbs_class.sv"
`include "hssrdc_driver_cbs_class.sv"
class hssdrc_scoreboard_class extends hssrdc_driver_cbs_class;
class hssdrc_scoreboard_class extends hssrdc_driver_cbs_class;
  sdram_tr_mbx   out_mbx;
  sdram_tr_mbx   out_mbx;
  message_class  msg;
  message_class  msg;
  event done;
  event done;
  function new (message_class msg, ref event done);
  function new (message_class msg, ref event done);
    this.msg      = msg;
    this.msg      = msg;
    this.done     = done;
    this.done     = done;
  endfunction
  endfunction
  int checked_tr_num;
  int checked_tr_num;
  int check_err_num;
  int check_err_num;
  //
  //
  //
  //
  //
  //
  task start ();
  task start ();
    checked_tr_num = 0;
    checked_tr_num = 0;
    check_err_num  = 0;
    check_err_num  = 0;
  endtask
  endtask
  //
  //
  //
  //
  //
  //
  virtual task post_ReadData (input realtime t, sdram_transaction_class tr);
  virtual task post_ReadData (input realtime t, sdram_transaction_class tr);
    tb_data_t golden_data2cmp;
    tb_data_t golden_data2cmp;
    tb_data_t data2cmp;
    tb_data_t data2cmp;
    tb_chid_t golden_chid2cmp;
    tb_chid_t golden_chid2cmp;
    tb_chid_t chid2cmp;
    tb_chid_t chid2cmp;
    tb_datam_t datam;
    tb_datam_t datam;
    int burst;
    int burst;
    string str;
    string str;
  begin
  begin
    burst = tr.burst + 1;
    burst = tr.burst + 1;
    golden_chid2cmp = tr.chid;
    golden_chid2cmp = tr.chid;
    for (int i = 0; i < burst; i++) begin
    for (int i = 0; i < burst; i++) begin
      datam           = tr.wdatam [i];
      datam           = tr.wdatam [i];
      data2cmp        = MaskData(tr.rdata [i], datam);
      data2cmp        = MaskData(tr.rdata [i], datam);
      golden_data2cmp = MaskData(tr.wdata [i], datam);
      golden_data2cmp = MaskData(tr.wdata [i], datam);
      chid2cmp = tr.rchid [i];
      chid2cmp = tr.rchid [i];
      if (data2cmp !== golden_data2cmp) begin
      if (data2cmp !== golden_data2cmp) begin
        str = $psprintf("data compare error at ba = %0d, rowa = %0d, cola = %0d : ", tr.ba, tr.rowa, tr.cola);
        str = $psprintf("data compare error at ba = %0d, rowa = %0d, cola = %0d : ", tr.ba, tr.rowa, tr.cola);
        str = {str, ($psprintf("write data %h : read data %h", golden_data2cmp, data2cmp))};
        str = {str, ($psprintf("write data %h : read data %h", golden_data2cmp, data2cmp))};
        msg.err(str);
        msg.err(str);
        check_err_num++;
        check_err_num++;
      end
      end
      if (chid2cmp !== golden_chid2cmp) begin
      if (chid2cmp !== golden_chid2cmp) begin
        str = $psprintf("chid compare error at ba = %0d, rowa = %0d, cola = %0d : ", tr.ba, tr.rowa, tr.cola);
        str = $psprintf("chid compare error at ba = %0d, rowa = %0d, cola = %0d : ", tr.ba, tr.rowa, tr.cola);
        str = {str, ($psprintf("write chid %h : read chid %h", golden_chid2cmp, chid2cmp))};
        str = {str, ($psprintf("write chid %h : read chid %h", golden_chid2cmp, chid2cmp))};
        msg.err(str);
        msg.err(str);
        check_err_num++;
        check_err_num++;
      end
      end
    end
    end
    checked_tr_num++;
    checked_tr_num++;
    -> done;
    -> done;
  end
  end
  endtask
  endtask
  //
  //
  //
  //
  //
  //
  function data_t MaskData (input tb_data_t data, tb_datam_t datam);
  function data_t MaskData (input tb_data_t data, tb_datam_t datam);
    if (datam == 0)
    if (datam == 0)
      MaskData = data;
      MaskData = data;
    else begin
    else begin
      for (int m = 0; m < $size(datam); m++) begin
      for (int m = 0; m < $size(datam); m++) begin
        for (int b = 0; b < 8; b++) begin
        for (int b = 0; b < 8; b++) begin
          MaskData[8*m + b] = data [8*m + b] & ~datam[m];
          MaskData[8*m + b] = data [8*m + b] & ~datam[m];
        end
        end
      end
      end
    end
    end
  endfunction
  endfunction
endclass
endclass
 
 

powered by: WebSVN 2.1.0

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