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

Subversion Repositories qaz_libs

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

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_common_pkg;
package pcie_common_pkg;
  typedef enum
  typedef enum
  {
  {
    MRd,      // Memory Read Request
    MRd,      // Memory Read Request
    MRdLk,    // Memory Read Request-Locked
    MRdLk,    // Memory Read Request-Locked
    MWr,      // Memory Write Request
    MWr,      // Memory Write Request
    IORd,     // I/O Read Request
    IORd,     // I/O Read Request
    IOWr,     // I/O Write Request
    IOWr,     // I/O Write Request
    CfgRd0,   // Configuration Read Type
    CfgRd0,   // Configuration Read Type
    CfgWr0,   // Configuration Write Type
    CfgWr0,   // Configuration Write Type
    CfgRd1,   // Configuration Read Type
    CfgRd1,   // Configuration Read Type
    CfgWr1,   // Configuration Write Type
    CfgWr1,   // Configuration Write Type
    TCfgRd,   // Deprecated TLP Type3
    TCfgRd,   // Deprecated TLP Type3
    TCfgWr,   // Deprecated TLP Type3
    TCfgWr,   // Deprecated TLP Type3
    Msg,      // Message Request
    Msg,      // Message Request
    MsgD,     // Message Request with data payload
    MsgD,     // Message Request with data payload
    Cpl,      // Completion without Data
    Cpl,      // Completion without Data
    CplD,     // Completion with Data
    CplD,     // Completion with Data
    CplLk,    // Completion for Locked Memory Read without Data
    CplLk,    // Completion for Locked Memory Read without Data
    CplDLk,   // Completion for Locked Memory Read
    CplDLk,   // Completion for Locked Memory Read
    FetchAdd, // Fetch and Add AtomicOp Request
    FetchAdd, // Fetch and Add AtomicOp Request
    Swap,     // Unconditional Swap AtomicOp Request
    Swap,     // Unconditional Swap AtomicOp Request
    CAS,      // Compare and Swap AtomicOp Request
    CAS,      // Compare and Swap AtomicOp Request
    LPrfx,    // Local TLP Prefix
    LPrfx,    // Local TLP Prefix
    EPrfx,    // End-End TLP Prefix
    EPrfx,    // End-End TLP Prefix
    Reserved
    Reserved
  } tlp_type_t;
  } tlp_type_t;
  typedef enum
  typedef enum
  {
  {
 
    DW_3_NO_DATA,
 
    DW_4_NO_DATA,
 
    DW_3_DATA,
 
    DW_4_DATA,
 
    TPL_PREFIX,
 
    RESERVED
 
  } tlp_fmt_t;
 
 
 
  typedef enum
 
  {
    ROUTING_UNKNOWN,
    ROUTING_UNKNOWN,
    ADDRESS,
    ADDRESS,
    ID,
    ID,
    IMPLICIT
    IMPLICIT
  } tlp_routing_t;
  } tlp_routing_t;
  typedef enum
  typedef enum
  {
  {
    TRANSACTION_UNKNOWN,
    TRANSACTION_UNKNOWN,
    REQUESTER,
    REQUESTER,
    COMPLETER
    COMPLETER
  } tlp_transaction_t;
  } tlp_transaction_t;
 
 
 
  typedef byte tpl_packet_t[];
 
 
 
 
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  //
  //
  class tlp_header_class;
  class tlp_header_class;
 
 
    tlp_type_t  header_type;
    tlp_fmt_t   tlp_fmt;
 
    tlp_type_t  tlp_type;
    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 [63:0] address;
    logic       header_is_4_dw;
    logic [1:0] ph;
 
    byte header[];
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function bit is_3_dw;
 
      return(~this.fmt_type[5]);
 
    endfunction: is_3_dw
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function bit is_4_dw;
 
      return(this.fmt_type[5]);
 
    endfunction: is_4_dw
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_tc(logic [2:0] tc);
 
      this.tc = tc;
 
      header[1][6:4] = tc;
 
    endfunction: set_tc
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_th(logic th);
 
      this.th = th;
 
      header[1][0] = th;
 
    endfunction: set_th
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_attr(logic [2:0] attr);
 
      this.attr = attr;
 
      {header[1][2], header[2][5:4]} = attr;
 
    endfunction: set_attr
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_td(logic td);
 
      this.td = td;
 
      header[2][7] = td;
 
    endfunction: set_td
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_ep(logic ep);
 
      this.ep = ep;
 
      header[2][6] = ep;
 
    endfunction: set_ep
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_address(logic [63:0] address);
 
      this.address = address;
 
      if(is_3_dw)
 
      begin
 
        header[8] = this.address[31:24];
 
        header[9] = this.address[23:16];
 
        header[10] = this.address[15:8];
 
        header[11][7:2] = this.address[7:2];
 
      end
 
      else
 
      begin
 
        header[8] = this.address[63:56];
 
        header[9] = this.address[55:48];
 
        header[10] = this.address[47:40];
 
        header[11] = this.address[39:32];
 
        header[12] = this.address[31:24];
 
        header[13] = this.address[23:16];
 
        header[14] = this.address[15:8];
 
        header[15][7:2] = this.address[7:2];
 
      end
 
    endfunction: set_address
 
 
 
 
 
    // --------------------------------------------------------------------
 
    //
 
    function void set_ph(logic [1:0] ph);
 
      this.ph = ph;
 
      if(is_3_dw)
 
        header[11][1:0] = ph;
 
      else
 
        header[15][1:0] = ph;
 
    endfunction: set_ph
 
 
    // --------------------------------------------------------------------
    // --------------------------------------------------------------------
    //
    //
    // function logic [7:0] get_fmt_type(tlp_type_t header_type);
 
    function logic [7:0] get_fmt_type;
    function logic [7:0] get_fmt_type;
      casez(header_type)
      casez({tlp_fmt, tlp_type})
        MRd:      get_fmt_type = 8'b000_00000;
        {DW_3_NO_DATA, MRd}:    get_fmt_type = 8'b000_00000;
        MRd:      get_fmt_type = 8'b001_00000;
        {DW_4_NO_DATA, MRd}:    get_fmt_type = 8'b001_00000;
        MRdLk:    get_fmt_type = 8'b000_00001;
        {DW_3_NO_DATA, MRdLk}:  get_fmt_type = 8'b000_00001;
        MRdLk:    get_fmt_type = 8'b001_00001;
        {DW_4_NO_DATA, MRdLk}:  get_fmt_type = 8'b001_00001;
        MWr:      get_fmt_type = 8'b010_00000;
        {DW_3_DATA, MWr}:       get_fmt_type = 8'b010_00000;
        MWr:      get_fmt_type = 8'b011_00000;
        {DW_4_DATA, MWr}:       get_fmt_type = 8'b011_00000;
        IORd:     get_fmt_type = 8'b000_00010;
        {DW_3_NO_DATA, IORd}:   get_fmt_type = 8'b000_00010;
        IOWr:     get_fmt_type = 8'b010_00010;
        {DW_3_DATA, IOWr}:      get_fmt_type = 8'b010_00010;
        CfgRd0:   get_fmt_type = 8'b000_00100;
        {DW_3_NO_DATA, CfgRd0}: get_fmt_type = 8'b000_00100;
        CfgWr0:   get_fmt_type = 8'b010_00100;
        {DW_3_DATA, CfgWr0}:    get_fmt_type = 8'b010_00100;
        CfgRd1:   get_fmt_type = 8'b000_00101;
        {DW_3_NO_DATA, CfgRd1}: get_fmt_type = 8'b000_00101;
        CfgWr1:   get_fmt_type = 8'b010_00101;
        {DW_3_DATA, CfgWr1}:    get_fmt_type = 8'b010_00101;
        TCfgRd:   get_fmt_type = 8'b000_11011;
        {DW_3_NO_DATA, TCfgRd}: get_fmt_type = 8'b000_11011;
        TCfgWr:   get_fmt_type = 8'b010_11011;
        {DW_3_DATA, TCfgWr}:    get_fmt_type = 8'b010_11011;
        Msg:      get_fmt_type = 8'b001_10xxx;
        {DW_4_NO_DATA, Msg}:    get_fmt_type = 8'b001_10xxx;
        MsgD:     get_fmt_type = 8'b011_10xxx;
        {DW_4_DATA, MsgD}:      get_fmt_type = 8'b011_10xxx;
        Cpl:      get_fmt_type = 8'b000_01010;
        {DW_3_NO_DATA, Cpl}:    get_fmt_type = 8'b000_01010;
        CplD:     get_fmt_type = 8'b010_01010;
        {DW_3_DATA, CplD}:      get_fmt_type = 8'b010_01010;
        CplLk:    get_fmt_type = 8'b000_01011;
        {DW_3_NO_DATA, CplLk}:  get_fmt_type = 8'b000_01011;
        CplDLk:   get_fmt_type = 8'b010_01011;
        {DW_3_DATA, CplDLk}:    get_fmt_type = 8'b010_01011;
        FetchAdd: get_fmt_type = 8'b010_01100;
        {DW_3_DATA, FetchAdd}:  get_fmt_type = 8'b010_01100;
        FetchAdd: get_fmt_type = 8'b011_01100;
        {DW_4_DATA, FetchAdd}:  get_fmt_type = 8'b011_01100;
        Swap:     get_fmt_type = 8'b010_01101;
        {DW_3_DATA, Swap}:      get_fmt_type = 8'b010_01101;
        Swap:     get_fmt_type = 8'b011_01101;
        {DW_4_DATA, Swap}:      get_fmt_type = 8'b011_01101;
        CAS:      get_fmt_type = 8'b010_01110;
        {DW_3_DATA, CAS}:       get_fmt_type = 8'b010_01110;
        CAS:      get_fmt_type = 8'b011_01110;
        {DW_4_DATA, CAS}:       get_fmt_type = 8'b011_01110;
        LPrfx:    get_fmt_type = 8'b100_0xxxx;
        {TPL_PREFIX, LPrfx}:    get_fmt_type = 8'b100_0xxxx;
        EPrfx:    get_fmt_type = 8'b100_1xxxx;
        {TPL_PREFIX, EPrfx}:    get_fmt_type = 8'b100_1xxxx;
        default:  get_fmt_type = Reserved;
        default:  get_fmt_type = Reserved;
      endcase
      endcase
    endfunction: get_fmt_type
    endfunction: get_fmt_type
    // --------------------------------------------------------------------
    // --------------------------------------------------------------------
    //
    //
    function tlp_type_t get_tlp_type(logic [7:0] fmt_type);
    function tlp_type_t get_tlp_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 header_type);
 
    function tlp_routing_t get_tlp_routing;
    function tlp_routing_t get_tlp_routing;
 
 
      case(header_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 header_type);
 
    function tlp_transaction_t get_tlp_transaction;
    function tlp_transaction_t get_tlp_transaction;
 
 
      case(header_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_header(string str);
    function void display_header(string str = "");
      tlp_routing_t routing_type = get_tlp_routing;
      tlp_routing_t routing_type = get_tlp_routing();
      tlp_transaction_t transaction_type = get_tlp_transaction;
      tlp_transaction_t transaction_type = get_tlp_transaction;
      $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, tlp_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(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(tlp_type);
 
 
      $display("??? %16.t | ---------------------", $time);
      $display("??? %16.t | ---------------------", $time);
    endfunction: display_header
    endfunction: display_header
    //--------------------------------------------------------------------
    //--------------------------------------------------------------------
    //
    //
    function new(tlp_type_t header_type, logic [9:0] length);
    function new(tlp_fmt_t tlp_fmt, tlp_type_t tlp_type, logic [9:0] length);
      this.header_type = header_type;
      this.tlp_fmt = tlp_fmt;
      this.fmt_type = get_fmt_type;
      this.tlp_type = tlp_type;
 
      this.fmt_type = get_fmt_type();
      this.length = length;
      this.length = length;
      this.header_is_4_dw = fmt_type[5];
      if(is_3_dw)
 
        this.header = new[12];
 
      else
 
        this.header =  new[16];
      this.header[0] = fmt_type;
      this.header[0] = fmt_type;
      this.header[3] = length[7:0];
      this.header[3] = length[7:0];
      this.header[2][1:0] = length[9:8];
      this.header[2][1:0] = length[9:8];
    endfunction: new
    endfunction: new
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  //
  //
  endclass: tlp_header_class
  endclass: tlp_header_class
// --------------------------------------------------------------------
// --------------------------------------------------------------------
//
//
endpackage: pcie_common_pkg
endpackage: pcie_common_pkg
 
 

powered by: WebSVN 2.1.0

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