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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [PCIe/] [sim/] [src/] [pcie_bfm_pkg.sv] - Diff between revs 32 and 33

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 32 Rev 33
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
////                                                              ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
//// later version.                                               ////
////                                                              ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
//// details.                                                     ////
////                                                              ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// --------------------------------------------------------------------
// --------------------------------------------------------------------
//
//
package pcie_bfm_pkg;
package pcie_bfm_pkg;
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  //
  //
  import pcie_common_pkg::*;
  import pcie_common_pkg::*;
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  //
  //
  class altera_pcie_transaction;
  class altera_pcie_transaction;
    tlp_header_class hd_h;
    tlp_header_class hd_h;
    byte packet[];
    byte data[];
 
    bit tlp_always_packed;
 
 
    //--------------------------------------------------------------------
    //--------------------------------------------------------------------
    //
    //
    function new(tlp_header_class hd_h, bit qword_aligned);
    function bit is_qword_aligned;
      this.hd_h = hd_h;
      is_qword_aligned = ~hd_h.address[2];
      if(qword_aligned & hd_h.fmt_type[5] == 0)
    endfunction: is_qword_aligned
        if(hd_h.length == 0)
 
          this.packet = new[1024 + 1];
 
 
    //--------------------------------------------------------------------
 
    //
 
    function bit is_tlp_packed;
 
      if(tlp_always_packed)
 
        return(1);
 
      if(hd_h.is_3_dw)
 
        if(is_qword_aligned)
 
          return(0);
        else
        else
          this.packet = new[hd_h.length + 1];
          return(1);
 
      else  // is_4_dw
 
        if(is_qword_aligned)
 
          return(1);
      else
      else
        if(hd_h.length == 0)
          return(0);
          this.packet = new[1024];
    endfunction: is_tlp_packed
 
 
 
 
 
    //--------------------------------------------------------------------
 
    //
 
    function void init(tlp_header_class hd_h);
 
      this.hd_h = hd_h;
 
    endfunction: init
 
 
 
 
 
    // --------------------------------------------------------------------
 
    // Memory Read Request
 
    function void make_MRd
 
    (
 
      logic [63:0] address,
 
      logic [9:0] length,
 
      bit use_64_addr = 0
 
    );
 
      hd_h = new(use_64_addr ? DW_4_NO_DATA : DW_3_NO_DATA, MRd, length);
 
      hd_h.set_address(address);
 
      init(hd_h);
 
      data.delete();
 
    endfunction: make_MRd
 
 
 
 
 
    // --------------------------------------------------------------------
 
    // Memory Write Request
 
    function void make_MWr
 
    (
 
      logic [63:0] address,
 
      byte data[],
 
      bit use_64_addr = 0
 
    );
 
      logic [9:0] length = (data.size() > 1023) ? 0 : data.size();
 
      hd_h = new(use_64_addr ? DW_4_DATA : DW_3_DATA, MWr, length);
 
      init(hd_h);
 
      this.data = data;
 
      hd_h.set_address(address);
 
    endfunction: make_MWr
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function tpl_packet_t make_packet;
 
      byte h0[4] = {<
 
      byte h1[4] = {<
 
      byte h2[4] = {<
 
      byte h3[4] = {<
 
      byte pad[4] = '{8'hxx, 8'hxx, 8'hxx, 8'hxx};
 
      byte header[];
 
      if(hd_h.is_4_dw)
 
      begin
 
        h3 = {<
 
        header = {h0, h1, h2, h3};
 
      end
 
      else
 
        header = {h0, h1, h2};
 
      if(data.size() == 0)
 
        make_packet = header;
 
      else if(is_tlp_packed)
 
        make_packet = {header, data};
        else
        else
          this.packet = new[hd_h.length];
        make_packet = {header, pad, data};
 
 
 
      // else if(hd_h.is_3_dw)
 
        // if(is_qword_aligned)
 
          // make_packet = {header, pad, data};
 
        // else
 
          // make_packet = {header, data};
 
      // else  // is_4_dw
 
        // if(is_qword_aligned)
 
          // make_packet = {header, data};
 
        // else
 
          // make_packet = {header, pad, data};
 
 
 
    endfunction: make_packet
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function tpl_packet_t get_MRd
 
    (
 
      logic [63:0] address,
 
      logic [9:0] length,
 
      bit use_64_addr = 0
 
    );
 
      make_MRd(address, length, use_64_addr);
 
      return(make_packet());
 
    endfunction: get_MRd
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function tpl_packet_t get_counting_MWr
 
    (
 
      logic [63:0] address,
 
      int size,
 
      bit use_64_addr = 0
 
    );
 
      byte data[];
 
      data = new[size];
 
      foreach(data[i])
 
        data[i] = i;
 
      make_MWr(address, data, use_64_addr);
 
      return(make_packet());
 
    endfunction: get_counting_MWr
 
 
 
 
 
    //--------------------------------------------------------------------
 
    //
 
    function new(bit tlp_always_packed = 0);
 
      this.tlp_always_packed = tlp_always_packed;
    endfunction: new
    endfunction: new
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  //
  //
  endclass: altera_pcie_transaction
  endclass: altera_pcie_transaction
  // // --------------------------------------------------------------------
  // // --------------------------------------------------------------------
  // //
  // //
  // class base_tlp_packet_class;
  // class base_tlp_packet_class;
    // tlp_type_t        header_type       = Reserved;
    // tlp_type_t        header_type       = Reserved;
    // tlp_routing_t     routing_type      = ROUTING_UNKNOWN;
    // tlp_routing_t     routing_type      = ROUTING_UNKNOWN;
    // tlp_transaction_t transaction_type  = TRANSACTION_UNKNOWN;
    // tlp_transaction_t transaction_type  = TRANSACTION_UNKNOWN;
    // logic [7:0] fmt_type;
    // logic [7:0] fmt_type;
    // logic [2:0] tc;
    // logic [2:0] tc;
    // logic       th;
    // logic       th;
    // logic [2:0] attr;
    // logic [2:0] attr;
    // logic       td;
    // logic       td;
    // logic       ep;
    // logic       ep;
    // logic [9:0] length;
    // logic [9:0] length;
    // logic [7:0] header [16];
    // logic [7:0] header [16];
    // logic       header_is_4_dw;
    // logic       header_is_4_dw;
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function tlp_type_t get_tlp_type(logic [7:0] fmt_type);
    // function tlp_type_t get_tlp_type(logic [7:0] fmt_type);
      // casez(fmt_type)
      // casez(fmt_type)
        // 8'b000_00000: get_tlp_type = MRd;
        // 8'b000_00000: get_tlp_type = MRd;
        // 8'b001_00000: get_tlp_type = MRd;
        // 8'b001_00000: get_tlp_type = MRd;
        // 8'b000_00001: get_tlp_type = MRdLk;
        // 8'b000_00001: get_tlp_type = MRdLk;
        // 8'b001_00001: get_tlp_type = MRdLk;
        // 8'b001_00001: get_tlp_type = MRdLk;
        // 8'b010_00000: get_tlp_type = MWr;
        // 8'b010_00000: get_tlp_type = MWr;
        // 8'b011_00000: get_tlp_type = MWr;
        // 8'b011_00000: get_tlp_type = MWr;
        // 8'b000_00010: get_tlp_type = IORd;
        // 8'b000_00010: get_tlp_type = IORd;
        // 8'b010_00010: get_tlp_type = IOWr;
        // 8'b010_00010: get_tlp_type = IOWr;
        // 8'b000_00100: get_tlp_type = CfgRd0;
        // 8'b000_00100: get_tlp_type = CfgRd0;
        // 8'b010_00100: get_tlp_type = CfgWr0;
        // 8'b010_00100: get_tlp_type = CfgWr0;
        // 8'b000_00101: get_tlp_type = CfgRd1;
        // 8'b000_00101: get_tlp_type = CfgRd1;
        // 8'b010_00101: get_tlp_type = CfgWr1;
        // 8'b010_00101: get_tlp_type = CfgWr1;
        // 8'b000_11011: get_tlp_type = TCfgRd;
        // 8'b000_11011: get_tlp_type = TCfgRd;
        // 8'b010_11011: get_tlp_type = TCfgWr;
        // 8'b010_11011: get_tlp_type = TCfgWr;
        // 8'b001_10???: get_tlp_type = Msg;
        // 8'b001_10???: get_tlp_type = Msg;
        // 8'b011_10???: get_tlp_type = MsgD;
        // 8'b011_10???: get_tlp_type = MsgD;
        // 8'b000_01010: get_tlp_type = Cpl;
        // 8'b000_01010: get_tlp_type = Cpl;
        // 8'b010_01010: get_tlp_type = CplD;
        // 8'b010_01010: get_tlp_type = CplD;
        // 8'b000_01011: get_tlp_type = CplLk;
        // 8'b000_01011: get_tlp_type = CplLk;
        // 8'b010_01011: get_tlp_type = CplDLk;
        // 8'b010_01011: get_tlp_type = CplDLk;
        // 8'b010_01100: get_tlp_type = FetchAdd;
        // 8'b010_01100: get_tlp_type = FetchAdd;
        // 8'b011_01100: get_tlp_type = FetchAdd;
        // 8'b011_01100: get_tlp_type = FetchAdd;
        // 8'b010_01101: get_tlp_type = Swap;
        // 8'b010_01101: get_tlp_type = Swap;
        // 8'b011_01101: get_tlp_type = Swap;
        // 8'b011_01101: get_tlp_type = Swap;
        // 8'b010_01110: get_tlp_type = CAS;
        // 8'b010_01110: get_tlp_type = CAS;
        // 8'b011_01110: get_tlp_type = CAS;
        // 8'b011_01110: get_tlp_type = CAS;
        // 8'b100_0????: get_tlp_type = LPrfx;
        // 8'b100_0????: get_tlp_type = LPrfx;
        // 8'b100_1????: get_tlp_type = EPrfx;
        // 8'b100_1????: get_tlp_type = EPrfx;
        // default:      get_tlp_type = Reserved;
        // default:      get_tlp_type = Reserved;
      // endcase
      // endcase
    // endfunction: get_tlp_type
    // endfunction: get_tlp_type
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function tlp_routing_t get_tlp_routing(tlp_type_t tlp_type);
    // function tlp_routing_t get_tlp_routing(tlp_type_t tlp_type);
      // case(tlp_type)
      // case(tlp_type)
        // MRd:      get_tlp_routing = ADDRESS;
        // MRd:      get_tlp_routing = ADDRESS;
        // MRdLk:    get_tlp_routing = ADDRESS;
        // MRdLk:    get_tlp_routing = ADDRESS;
        // MWr:      get_tlp_routing = ADDRESS;
        // MWr:      get_tlp_routing = ADDRESS;
        // IORd:     get_tlp_routing = ADDRESS;
        // IORd:     get_tlp_routing = ADDRESS;
        // IOWr:     get_tlp_routing = ADDRESS;
        // IOWr:     get_tlp_routing = ADDRESS;
        // CfgRd0:   get_tlp_routing = ID;
        // CfgRd0:   get_tlp_routing = ID;
        // CfgWr0:   get_tlp_routing = ID;
        // CfgWr0:   get_tlp_routing = ID;
        // CfgRd1:   get_tlp_routing = ID;
        // CfgRd1:   get_tlp_routing = ID;
        // CfgWr1:   get_tlp_routing = ID;
        // CfgWr1:   get_tlp_routing = ID;
        // TCfgRd:   get_tlp_routing = ID;
        // TCfgRd:   get_tlp_routing = ID;
        // TCfgWr:   get_tlp_routing = ID;
        // TCfgWr:   get_tlp_routing = ID;
        // Msg:      get_tlp_routing = ROUTING_UNKNOWN;
        // Msg:      get_tlp_routing = ROUTING_UNKNOWN;
        // MsgD:     get_tlp_routing = ROUTING_UNKNOWN;
        // MsgD:     get_tlp_routing = ROUTING_UNKNOWN;
        // Cpl:      get_tlp_routing = ID;
        // Cpl:      get_tlp_routing = ID;
        // CplD:     get_tlp_routing = ID;
        // CplD:     get_tlp_routing = ID;
        // CplLk:    get_tlp_routing = ID;
        // CplLk:    get_tlp_routing = ID;
        // CplDLk:   get_tlp_routing = ID;
        // CplDLk:   get_tlp_routing = ID;
        // FetchAdd: get_tlp_routing = ROUTING_UNKNOWN;
        // FetchAdd: get_tlp_routing = ROUTING_UNKNOWN;
        // Swap:     get_tlp_routing = ROUTING_UNKNOWN;
        // Swap:     get_tlp_routing = ROUTING_UNKNOWN;
        // CAS:      get_tlp_routing = ROUTING_UNKNOWN;
        // CAS:      get_tlp_routing = ROUTING_UNKNOWN;
        // LPrfx:    get_tlp_routing = ROUTING_UNKNOWN;
        // LPrfx:    get_tlp_routing = ROUTING_UNKNOWN;
        // EPrfx:    get_tlp_routing = ROUTING_UNKNOWN;
        // EPrfx:    get_tlp_routing = ROUTING_UNKNOWN;
        // default:  get_tlp_routing = ROUTING_UNKNOWN;
        // default:  get_tlp_routing = ROUTING_UNKNOWN;
      // endcase
      // endcase
    // endfunction: get_tlp_routing
    // endfunction: get_tlp_routing
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function tlp_transaction_t get_tlp_transaction(tlp_type_t tlp_type);
    // function tlp_transaction_t get_tlp_transaction(tlp_type_t tlp_type);
      // case(tlp_type)
      // case(tlp_type)
        // MRd:      get_tlp_transaction = REQUESTER;
        // MRd:      get_tlp_transaction = REQUESTER;
        // MRdLk:    get_tlp_transaction = REQUESTER;
        // MRdLk:    get_tlp_transaction = REQUESTER;
        // MWr:      get_tlp_transaction = REQUESTER;
        // MWr:      get_tlp_transaction = REQUESTER;
        // IORd:     get_tlp_transaction = REQUESTER;
        // IORd:     get_tlp_transaction = REQUESTER;
        // IOWr:     get_tlp_transaction = REQUESTER;
        // IOWr:     get_tlp_transaction = REQUESTER;
        // CfgRd0:   get_tlp_transaction = REQUESTER;
        // CfgRd0:   get_tlp_transaction = REQUESTER;
        // CfgWr0:   get_tlp_transaction = REQUESTER;
        // CfgWr0:   get_tlp_transaction = REQUESTER;
        // CfgRd1:   get_tlp_transaction = REQUESTER;
        // CfgRd1:   get_tlp_transaction = REQUESTER;
        // CfgWr1:   get_tlp_transaction = REQUESTER;
        // CfgWr1:   get_tlp_transaction = REQUESTER;
        // TCfgRd:   get_tlp_transaction = REQUESTER;
        // TCfgRd:   get_tlp_transaction = REQUESTER;
        // TCfgWr:   get_tlp_transaction = REQUESTER;
        // TCfgWr:   get_tlp_transaction = REQUESTER;
        // Msg:      get_tlp_transaction = REQUESTER;
        // Msg:      get_tlp_transaction = REQUESTER;
        // MsgD:     get_tlp_transaction = REQUESTER;
        // MsgD:     get_tlp_transaction = REQUESTER;
        // Cpl:      get_tlp_transaction = COMPLETER;
        // Cpl:      get_tlp_transaction = COMPLETER;
        // CplD:     get_tlp_transaction = COMPLETER;
        // CplD:     get_tlp_transaction = COMPLETER;
        // CplLk:    get_tlp_transaction = COMPLETER;
        // CplLk:    get_tlp_transaction = COMPLETER;
        // CplDLk:   get_tlp_transaction = COMPLETER;
        // CplDLk:   get_tlp_transaction = COMPLETER;
        // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
        // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
        // Swap:     get_tlp_transaction = TRANSACTION_UNKNOWN;
        // Swap:     get_tlp_transaction = TRANSACTION_UNKNOWN;
        // CAS:      get_tlp_transaction = TRANSACTION_UNKNOWN;
        // CAS:      get_tlp_transaction = TRANSACTION_UNKNOWN;
        // LPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // LPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // EPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // EPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // default:  get_tlp_transaction = TRANSACTION_UNKNOWN;
        // default:  get_tlp_transaction = TRANSACTION_UNKNOWN;
      // endcase
      // endcase
    // endfunction: get_tlp_transaction
    // endfunction: get_tlp_transaction
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function void display_tlp_cfg(tlp_type_t tlp_type);
    // function void display_tlp_cfg(tlp_type_t tlp_type);
      // logic [5:0] Register_Number = header[11][7:2];
      // logic [5:0] Register_Number = header[11][7:2];
      // logic [3:0] Extended_Register_Number = header[10][3:0];
      // logic [3:0] Extended_Register_Number = header[10][3:0];
      // // $display("??? %16.t | Register_Number           = %b", $time, Register_Number);
      // // $display("??? %16.t | Register_Number           = %b", $time, Register_Number);
      // // $display("??? %16.t | Extended_Register_Number  = %b", $time, Extended_Register_Number);
      // // $display("??? %16.t | Extended_Register_Number  = %b", $time, Extended_Register_Number);
      // $display("??? %16.t | config offset             = 0x%5.x",
      // $display("??? %16.t | config offset             = 0x%5.x",
                // $time, {Extended_Register_Number, Register_Number, 2'b00});
                // $time, {Extended_Register_Number, Register_Number, 2'b00});
    // endfunction: display_tlp_cfg
    // endfunction: display_tlp_cfg
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function void display_tlp_type(tlp_type_t tlp_type);
    // function void display_tlp_type(tlp_type_t tlp_type);
      // case(tlp_type)
      // case(tlp_type)
        // // MRd:      get_tlp_transaction = REQUESTER;
        // // MRd:      get_tlp_transaction = REQUESTER;
        // // MRdLk:    get_tlp_transaction = REQUESTER;
        // // MRdLk:    get_tlp_transaction = REQUESTER;
        // // MWr:      get_tlp_transaction = REQUESTER;
        // // MWr:      get_tlp_transaction = REQUESTER;
        // // IORd:     get_tlp_transaction = REQUESTER;
        // // IORd:     get_tlp_transaction = REQUESTER;
        // // IOWr:     get_tlp_transaction = REQUESTER;
        // // IOWr:     get_tlp_transaction = REQUESTER;
        // CfgRd0:   display_tlp_cfg(tlp_type);
        // CfgRd0:   display_tlp_cfg(tlp_type);
        // CfgWr0:   display_tlp_cfg(tlp_type);
        // CfgWr0:   display_tlp_cfg(tlp_type);
        // CfgRd1:   display_tlp_cfg(tlp_type);
        // CfgRd1:   display_tlp_cfg(tlp_type);
        // CfgWr1:   display_tlp_cfg(tlp_type);
        // CfgWr1:   display_tlp_cfg(tlp_type);
        // TCfgRd:   display_tlp_cfg(tlp_type);
        // TCfgRd:   display_tlp_cfg(tlp_type);
        // TCfgWr:   display_tlp_cfg(tlp_type);
        // TCfgWr:   display_tlp_cfg(tlp_type);
        // // Msg:      get_tlp_transaction = REQUESTER;
        // // Msg:      get_tlp_transaction = REQUESTER;
        // // MsgD:     get_tlp_transaction = REQUESTER;
        // // MsgD:     get_tlp_transaction = REQUESTER;
        // // Cpl:      get_tlp_transaction = COMPLETER;
        // // Cpl:      get_tlp_transaction = COMPLETER;
        // // CplD:     get_tlp_transaction = COMPLETER;
        // // CplD:     get_tlp_transaction = COMPLETER;
        // // CplLk:    get_tlp_transaction = COMPLETER;
        // // CplLk:    get_tlp_transaction = COMPLETER;
        // // CplDLk:   get_tlp_transaction = COMPLETER;
        // // CplDLk:   get_tlp_transaction = COMPLETER;
        // // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // Swap:     get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // Swap:     get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // CAS:      get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // CAS:      get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // LPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // LPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // EPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // // EPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
        // default:  return;
        // default:  return;
      // endcase
      // endcase
    // endfunction: display_tlp_type
    // endfunction: display_tlp_type
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function void set_little_endian_header( logic [127:0] data);
    // function void set_little_endian_header( logic [127:0] data);
      // logic [2:0] fmt = data[7:5];
      // logic [2:0] fmt = data[7:5];
      // if(fmt > 3'b011)
      // if(fmt > 3'b011)
      // begin
      // begin
        // $display("!!! %16.t | fmt 3'b%b not supported", $time, fmt);
        // $display("!!! %16.t | fmt 3'b%b not supported", $time, fmt);
        // $stop;
        // $stop;
      // end
      // end
      // header_is_4_dw = data[5];
      // header_is_4_dw = data[5];
      // for(int i = 0; i < (header_is_4_dw ? 16 : 12); i += 4)
      // for(int i = 0; i < (header_is_4_dw ? 16 : 12); i += 4)
        // {header[i + 0], header[i + 1], header[i + 2], header[i + 3]} = data[i*8 +: 32];
        // {header[i + 0], header[i + 1], header[i + 2], header[i + 3]} = data[i*8 +: 32];
      // header_type      = get_tlp_type(header[0]);
      // header_type      = get_tlp_type(header[0]);
      // routing_type     = get_tlp_routing(header_type);
      // routing_type     = get_tlp_routing(header_type);
      // transaction_type = get_tlp_transaction(header_type);
      // transaction_type = get_tlp_transaction(header_type);
      // fmt_type = header[0];
      // fmt_type = header[0];
      // tc       = header[1][6:4];
      // tc       = header[1][6:4];
      // th       = header[1][0];
      // th       = header[1][0];
      // attr     = {header[1][2], header[2][5:4]};
      // attr     = {header[1][2], header[2][5:4]};
      // td       = header[2][7];
      // td       = header[2][7];
      // ep       = header[2][6];
      // ep       = header[2][6];
      // length   = {header[2][1:0], header[3]};
      // length   = {header[2][1:0], header[3]};
    // endfunction: set_little_endian_header
    // endfunction: set_little_endian_header
    // // --------------------------------------------------------------------
    // // --------------------------------------------------------------------
    // //
    // //
    // function void display_header(string str);
    // function void display_header(string str);
      // $display("??? %16.t | .....................", $time);
      // $display("??? %16.t | .....................", $time);
      // $display("??? %16.t | %s | TLP type | %s", $time, str, header_type.name);
      // $display("??? %16.t | %s | TLP type | %s", $time, str, header_type.name);
      // // $display("??? %16.t | fmt           = %b | type = %b", $time, fmt_type[7:5], fmt_type[4:0]);
      // // $display("??? %16.t | fmt           = %b | type = %b", $time, fmt_type[7:5], fmt_type[4:0]);
      // $display("??? %16.t | length = %d", $time, length);
      // $display("??? %16.t | length = %d", $time, length);
      // $display("??? %16.t | tc = %b | th = %b | attr = %b | td = %b | ep = %b",
      // $display("??? %16.t | tc = %b | th = %b | attr = %b | td = %b | ep = %b",
                // $time, tc, th, attr, td, ep);
                // $time, tc, th, attr, td, ep);
      // if(routing_type == ADDRESS)
      // if(routing_type == ADDRESS)
        // if(header_is_4_dw)
        // if(header_is_4_dw)
          // $display("??? %16.t | address[63:0] = 0x%16.x", $time,
          // $display("??? %16.t | address[63:0] = 0x%16.x", $time,
                    // { header[8],  header[9],  header[10], header[11],
                    // { header[8],  header[9],  header[10], header[11],
                      // header[12], header[13], header[14], header[15][7:2], 2'b00});
                      // header[12], header[13], header[14], header[15][7:2], 2'b00});
        // else
        // else
          // $display("??? %16.t | address[31:0] = 0x%8.x", $time,
          // $display("??? %16.t | address[31:0] = 0x%8.x", $time,
                    // { header[8],  header[9],  header[10], header[11][7:2], 2'b00});
                    // { header[8],  header[9],  header[10], header[11][7:2], 2'b00});
      // else if(routing_type == ID)
      // else if(routing_type == ID)
          // $display("??? %16.t | bus = 0x%2.x | device = 0x%x | function = 0x%x", $time,
          // $display("??? %16.t | bus = 0x%2.x | device = 0x%x | function = 0x%x", $time,
                    // header[8],  header[9][7:3],  header[9][2:0]);
                    // header[8],  header[9][7:3],  header[9][2:0]);
      // if(transaction_type == COMPLETER)
      // if(transaction_type == COMPLETER)
      // begin
      // begin
        // $display("??? %16.t | Completer ID  = %b", $time, {header[4], header[5]});
        // $display("??? %16.t | Completer ID  = %b", $time, {header[4], header[5]});
        // $display("??? %16.t | requester ID  = %b", $time, {header[8], header[9]});
        // $display("??? %16.t | requester ID  = %b", $time, {header[8], header[9]});
        // $display("??? %16.t | tag           = %b", $time, header[10]);
        // $display("??? %16.t | tag           = %b", $time, header[10]);
      // end
      // end
      // else
      // else
      // begin
      // begin
        // $display("??? %16.t | requester ID  = %b", $time, {header[4], header[5]});
        // $display("??? %16.t | requester ID  = %b", $time, {header[4], header[5]});
        // $display("??? %16.t | tag           = %b", $time, header[6]);
        // $display("??? %16.t | tag           = %b", $time, header[6]);
        // $display("??? %16.t | last DW BE = %b | first DW BE = %b",
        // $display("??? %16.t | last DW BE = %b | first DW BE = %b",
                  // $time, header[7][7:4], header[7][3:0]);
                  // $time, header[7][7:4], header[7][3:0]);
      // end
      // end
      // display_tlp_type(header_type);
      // display_tlp_type(header_type);
      // $display("??? %16.t | ---------------------", $time);
      // $display("??? %16.t | ---------------------", $time);
    // endfunction: display_header
    // endfunction: display_header
    // // //--------------------------------------------------------------------
    // // //--------------------------------------------------------------------
    // // //
    // // //
    // // function new;
    // // function new;
    // // endfunction: new
    // // endfunction: new
  // // --------------------------------------------------------------------
  // // --------------------------------------------------------------------
  // //
  // //
  // endclass: base_tlp_packet_class
  // endclass: base_tlp_packet_class
// --------------------------------------------------------------------
// --------------------------------------------------------------------
//
//
endpackage: pcie_bfm_pkg
endpackage: pcie_bfm_pkg
 
 

powered by: WebSVN 2.1.0

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