| 1 |
32 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// Copyright (C) 2015 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 |
|
|
|
| 29 |
|
|
// --------------------------------------------------------------------
|
| 30 |
|
|
//
|
| 31 |
|
|
package pcie_bfm_pkg;
|
| 32 |
|
|
|
| 33 |
|
|
// --------------------------------------------------------------------
|
| 34 |
|
|
//
|
| 35 |
|
|
import pcie_common_pkg::*;
|
| 36 |
|
|
|
| 37 |
|
|
|
| 38 |
|
|
// --------------------------------------------------------------------
|
| 39 |
33 |
qaztronic |
//
|
| 40 |
32 |
qaztronic |
class altera_pcie_transaction;
|
| 41 |
33 |
qaztronic |
|
| 42 |
32 |
qaztronic |
tlp_header_class hd_h;
|
| 43 |
33 |
qaztronic |
byte data[];
|
| 44 |
|
|
bit tlp_always_packed;
|
| 45 |
32 |
qaztronic |
|
| 46 |
|
|
|
| 47 |
|
|
//--------------------------------------------------------------------
|
| 48 |
|
|
//
|
| 49 |
33 |
qaztronic |
function bit is_qword_aligned;
|
| 50 |
|
|
is_qword_aligned = ~hd_h.address[2];
|
| 51 |
|
|
endfunction: is_qword_aligned
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
|
|
//--------------------------------------------------------------------
|
| 55 |
|
|
//
|
| 56 |
|
|
function bit is_tlp_packed;
|
| 57 |
|
|
if(tlp_always_packed)
|
| 58 |
|
|
return(1);
|
| 59 |
|
|
if(hd_h.is_3_dw)
|
| 60 |
|
|
if(is_qword_aligned)
|
| 61 |
|
|
return(0);
|
| 62 |
|
|
else
|
| 63 |
|
|
return(1);
|
| 64 |
|
|
else // is_4_dw
|
| 65 |
|
|
if(is_qword_aligned)
|
| 66 |
|
|
return(1);
|
| 67 |
|
|
else
|
| 68 |
|
|
return(0);
|
| 69 |
|
|
endfunction: is_tlp_packed
|
| 70 |
|
|
|
| 71 |
|
|
|
| 72 |
|
|
//--------------------------------------------------------------------
|
| 73 |
|
|
//
|
| 74 |
|
|
function void init(tlp_header_class hd_h);
|
| 75 |
32 |
qaztronic |
this.hd_h = hd_h;
|
| 76 |
33 |
qaztronic |
endfunction: init
|
| 77 |
|
|
|
| 78 |
|
|
|
| 79 |
|
|
// --------------------------------------------------------------------
|
| 80 |
|
|
// Memory Read Request
|
| 81 |
|
|
function void make_MRd
|
| 82 |
|
|
(
|
| 83 |
|
|
logic [63:0] address,
|
| 84 |
|
|
logic [9:0] length,
|
| 85 |
|
|
bit use_64_addr = 0
|
| 86 |
|
|
);
|
| 87 |
|
|
hd_h = new(use_64_addr ? DW_4_NO_DATA : DW_3_NO_DATA, MRd, length);
|
| 88 |
|
|
hd_h.set_address(address);
|
| 89 |
|
|
init(hd_h);
|
| 90 |
|
|
data.delete();
|
| 91 |
|
|
endfunction: make_MRd
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
// --------------------------------------------------------------------
|
| 95 |
|
|
// Memory Write Request
|
| 96 |
|
|
function void make_MWr
|
| 97 |
|
|
(
|
| 98 |
|
|
logic [63:0] address,
|
| 99 |
|
|
byte data[],
|
| 100 |
|
|
bit use_64_addr = 0
|
| 101 |
|
|
);
|
| 102 |
|
|
logic [9:0] length = (data.size() > 1023) ? 0 : data.size();
|
| 103 |
|
|
hd_h = new(use_64_addr ? DW_4_DATA : DW_3_DATA, MWr, length);
|
| 104 |
|
|
init(hd_h);
|
| 105 |
|
|
this.data = data;
|
| 106 |
|
|
hd_h.set_address(address);
|
| 107 |
|
|
endfunction: make_MWr
|
| 108 |
|
|
|
| 109 |
|
|
|
| 110 |
|
|
// --------------------------------------------------------------------
|
| 111 |
|
|
//
|
| 112 |
|
|
function tpl_packet_t make_packet;
|
| 113 |
|
|
byte h0[4] = {<
|
| 114 |
|
|
byte h1[4] = {<
|
| 115 |
|
|
byte h2[4] = {<
|
| 116 |
|
|
byte h3[4] = {<
|
| 117 |
|
|
byte pad[4] = '{8'hxx, 8'hxx, 8'hxx, 8'hxx};
|
| 118 |
|
|
byte header[];
|
| 119 |
|
|
if(hd_h.is_4_dw)
|
| 120 |
|
|
begin
|
| 121 |
|
|
h3 = {<
|
| 122 |
|
|
header = {h0, h1, h2, h3};
|
| 123 |
|
|
end
|
| 124 |
32 |
qaztronic |
else
|
| 125 |
33 |
qaztronic |
header = {h0, h1, h2};
|
| 126 |
|
|
if(data.size() == 0)
|
| 127 |
|
|
make_packet = header;
|
| 128 |
|
|
else if(is_tlp_packed)
|
| 129 |
|
|
make_packet = {header, data};
|
| 130 |
|
|
else
|
| 131 |
|
|
make_packet = {header, pad, data};
|
| 132 |
|
|
|
| 133 |
|
|
// else if(hd_h.is_3_dw)
|
| 134 |
|
|
// if(is_qword_aligned)
|
| 135 |
|
|
// make_packet = {header, pad, data};
|
| 136 |
|
|
// else
|
| 137 |
|
|
// make_packet = {header, data};
|
| 138 |
|
|
// else // is_4_dw
|
| 139 |
|
|
// if(is_qword_aligned)
|
| 140 |
|
|
// make_packet = {header, data};
|
| 141 |
|
|
// else
|
| 142 |
|
|
// make_packet = {header, pad, data};
|
| 143 |
|
|
|
| 144 |
|
|
endfunction: make_packet
|
| 145 |
|
|
|
| 146 |
|
|
|
| 147 |
|
|
// --------------------------------------------------------------------
|
| 148 |
|
|
//
|
| 149 |
|
|
function tpl_packet_t get_MRd
|
| 150 |
|
|
(
|
| 151 |
|
|
logic [63:0] address,
|
| 152 |
|
|
logic [9:0] length,
|
| 153 |
|
|
bit use_64_addr = 0
|
| 154 |
|
|
);
|
| 155 |
|
|
make_MRd(address, length, use_64_addr);
|
| 156 |
|
|
return(make_packet());
|
| 157 |
|
|
endfunction: get_MRd
|
| 158 |
|
|
|
| 159 |
|
|
|
| 160 |
|
|
// --------------------------------------------------------------------
|
| 161 |
|
|
//
|
| 162 |
|
|
function tpl_packet_t get_counting_MWr
|
| 163 |
|
|
(
|
| 164 |
|
|
logic [63:0] address,
|
| 165 |
|
|
int size,
|
| 166 |
|
|
bit use_64_addr = 0
|
| 167 |
|
|
);
|
| 168 |
|
|
byte data[];
|
| 169 |
|
|
data = new[size];
|
| 170 |
|
|
foreach(data[i])
|
| 171 |
|
|
data[i] = i;
|
| 172 |
|
|
make_MWr(address, data, use_64_addr);
|
| 173 |
|
|
return(make_packet());
|
| 174 |
|
|
endfunction: get_counting_MWr
|
| 175 |
|
|
|
| 176 |
|
|
|
| 177 |
|
|
//--------------------------------------------------------------------
|
| 178 |
|
|
//
|
| 179 |
|
|
function new(bit tlp_always_packed = 0);
|
| 180 |
|
|
this.tlp_always_packed = tlp_always_packed;
|
| 181 |
32 |
qaztronic |
endfunction: new
|
| 182 |
|
|
|
| 183 |
|
|
|
| 184 |
|
|
// --------------------------------------------------------------------
|
| 185 |
|
|
//
|
| 186 |
|
|
endclass: altera_pcie_transaction
|
| 187 |
33 |
qaztronic |
|
| 188 |
|
|
|
| 189 |
32 |
qaztronic |
// // --------------------------------------------------------------------
|
| 190 |
|
|
// //
|
| 191 |
|
|
// class base_tlp_packet_class;
|
| 192 |
|
|
|
| 193 |
|
|
// tlp_type_t header_type = Reserved;
|
| 194 |
|
|
// tlp_routing_t routing_type = ROUTING_UNKNOWN;
|
| 195 |
|
|
// tlp_transaction_t transaction_type = TRANSACTION_UNKNOWN;
|
| 196 |
|
|
// logic [7:0] fmt_type;
|
| 197 |
|
|
// logic [2:0] tc;
|
| 198 |
|
|
// logic th;
|
| 199 |
|
|
// logic [2:0] attr;
|
| 200 |
|
|
// logic td;
|
| 201 |
|
|
// logic ep;
|
| 202 |
|
|
// logic [9:0] length;
|
| 203 |
|
|
// logic [7:0] header [16];
|
| 204 |
|
|
// logic header_is_4_dw;
|
| 205 |
|
|
|
| 206 |
|
|
|
| 207 |
|
|
// // --------------------------------------------------------------------
|
| 208 |
|
|
// //
|
| 209 |
|
|
// function tlp_type_t get_tlp_type(logic [7:0] fmt_type);
|
| 210 |
|
|
|
| 211 |
|
|
// casez(fmt_type)
|
| 212 |
|
|
// 8'b000_00000: get_tlp_type = MRd;
|
| 213 |
|
|
// 8'b001_00000: get_tlp_type = MRd;
|
| 214 |
|
|
// 8'b000_00001: get_tlp_type = MRdLk;
|
| 215 |
|
|
// 8'b001_00001: get_tlp_type = MRdLk;
|
| 216 |
|
|
// 8'b010_00000: get_tlp_type = MWr;
|
| 217 |
|
|
// 8'b011_00000: get_tlp_type = MWr;
|
| 218 |
|
|
// 8'b000_00010: get_tlp_type = IORd;
|
| 219 |
|
|
// 8'b010_00010: get_tlp_type = IOWr;
|
| 220 |
|
|
// 8'b000_00100: get_tlp_type = CfgRd0;
|
| 221 |
|
|
// 8'b010_00100: get_tlp_type = CfgWr0;
|
| 222 |
|
|
// 8'b000_00101: get_tlp_type = CfgRd1;
|
| 223 |
|
|
// 8'b010_00101: get_tlp_type = CfgWr1;
|
| 224 |
|
|
// 8'b000_11011: get_tlp_type = TCfgRd;
|
| 225 |
|
|
// 8'b010_11011: get_tlp_type = TCfgWr;
|
| 226 |
|
|
// 8'b001_10???: get_tlp_type = Msg;
|
| 227 |
|
|
// 8'b011_10???: get_tlp_type = MsgD;
|
| 228 |
|
|
// 8'b000_01010: get_tlp_type = Cpl;
|
| 229 |
|
|
// 8'b010_01010: get_tlp_type = CplD;
|
| 230 |
|
|
// 8'b000_01011: get_tlp_type = CplLk;
|
| 231 |
|
|
// 8'b010_01011: get_tlp_type = CplDLk;
|
| 232 |
|
|
// 8'b010_01100: get_tlp_type = FetchAdd;
|
| 233 |
|
|
// 8'b011_01100: get_tlp_type = FetchAdd;
|
| 234 |
|
|
// 8'b010_01101: get_tlp_type = Swap;
|
| 235 |
|
|
// 8'b011_01101: get_tlp_type = Swap;
|
| 236 |
|
|
// 8'b010_01110: get_tlp_type = CAS;
|
| 237 |
|
|
// 8'b011_01110: get_tlp_type = CAS;
|
| 238 |
|
|
// 8'b100_0????: get_tlp_type = LPrfx;
|
| 239 |
|
|
// 8'b100_1????: get_tlp_type = EPrfx;
|
| 240 |
|
|
// default: get_tlp_type = Reserved;
|
| 241 |
|
|
// endcase
|
| 242 |
|
|
|
| 243 |
|
|
// endfunction: get_tlp_type
|
| 244 |
|
|
|
| 245 |
33 |
qaztronic |
|
| 246 |
32 |
qaztronic |
// // --------------------------------------------------------------------
|
| 247 |
|
|
// //
|
| 248 |
|
|
// function tlp_routing_t get_tlp_routing(tlp_type_t tlp_type);
|
| 249 |
33 |
qaztronic |
|
| 250 |
32 |
qaztronic |
// case(tlp_type)
|
| 251 |
|
|
// MRd: get_tlp_routing = ADDRESS;
|
| 252 |
|
|
// MRdLk: get_tlp_routing = ADDRESS;
|
| 253 |
|
|
// MWr: get_tlp_routing = ADDRESS;
|
| 254 |
|
|
// IORd: get_tlp_routing = ADDRESS;
|
| 255 |
|
|
// IOWr: get_tlp_routing = ADDRESS;
|
| 256 |
|
|
// CfgRd0: get_tlp_routing = ID;
|
| 257 |
|
|
// CfgWr0: get_tlp_routing = ID;
|
| 258 |
|
|
// CfgRd1: get_tlp_routing = ID;
|
| 259 |
|
|
// CfgWr1: get_tlp_routing = ID;
|
| 260 |
|
|
// TCfgRd: get_tlp_routing = ID;
|
| 261 |
|
|
// TCfgWr: get_tlp_routing = ID;
|
| 262 |
|
|
// Msg: get_tlp_routing = ROUTING_UNKNOWN;
|
| 263 |
|
|
// MsgD: get_tlp_routing = ROUTING_UNKNOWN;
|
| 264 |
|
|
// Cpl: get_tlp_routing = ID;
|
| 265 |
|
|
// CplD: get_tlp_routing = ID;
|
| 266 |
|
|
// CplLk: get_tlp_routing = ID;
|
| 267 |
|
|
// CplDLk: get_tlp_routing = ID;
|
| 268 |
|
|
// FetchAdd: get_tlp_routing = ROUTING_UNKNOWN;
|
| 269 |
|
|
// Swap: get_tlp_routing = ROUTING_UNKNOWN;
|
| 270 |
|
|
// CAS: get_tlp_routing = ROUTING_UNKNOWN;
|
| 271 |
|
|
// LPrfx: get_tlp_routing = ROUTING_UNKNOWN;
|
| 272 |
|
|
// EPrfx: get_tlp_routing = ROUTING_UNKNOWN;
|
| 273 |
|
|
// default: get_tlp_routing = ROUTING_UNKNOWN;
|
| 274 |
|
|
// endcase
|
| 275 |
|
|
|
| 276 |
|
|
// endfunction: get_tlp_routing
|
| 277 |
33 |
qaztronic |
|
| 278 |
|
|
|
| 279 |
32 |
qaztronic |
// // --------------------------------------------------------------------
|
| 280 |
|
|
// //
|
| 281 |
|
|
// function tlp_transaction_t get_tlp_transaction(tlp_type_t tlp_type);
|
| 282 |
33 |
qaztronic |
|
| 283 |
32 |
qaztronic |
// case(tlp_type)
|
| 284 |
|
|
// MRd: get_tlp_transaction = REQUESTER;
|
| 285 |
|
|
// MRdLk: get_tlp_transaction = REQUESTER;
|
| 286 |
|
|
// MWr: get_tlp_transaction = REQUESTER;
|
| 287 |
|
|
// IORd: get_tlp_transaction = REQUESTER;
|
| 288 |
|
|
// IOWr: get_tlp_transaction = REQUESTER;
|
| 289 |
|
|
// CfgRd0: get_tlp_transaction = REQUESTER;
|
| 290 |
|
|
// CfgWr0: get_tlp_transaction = REQUESTER;
|
| 291 |
|
|
// CfgRd1: get_tlp_transaction = REQUESTER;
|
| 292 |
|
|
// CfgWr1: get_tlp_transaction = REQUESTER;
|
| 293 |
|
|
// TCfgRd: get_tlp_transaction = REQUESTER;
|
| 294 |
|
|
// TCfgWr: get_tlp_transaction = REQUESTER;
|
| 295 |
|
|
// Msg: get_tlp_transaction = REQUESTER;
|
| 296 |
|
|
// MsgD: get_tlp_transaction = REQUESTER;
|
| 297 |
|
|
// Cpl: get_tlp_transaction = COMPLETER;
|
| 298 |
|
|
// CplD: get_tlp_transaction = COMPLETER;
|
| 299 |
|
|
// CplLk: get_tlp_transaction = COMPLETER;
|
| 300 |
|
|
// CplDLk: get_tlp_transaction = COMPLETER;
|
| 301 |
|
|
// FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 302 |
|
|
// Swap: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 303 |
|
|
// CAS: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 304 |
|
|
// LPrfx: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 305 |
|
|
// EPrfx: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 306 |
|
|
// default: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 307 |
|
|
// endcase
|
| 308 |
|
|
|
| 309 |
|
|
// endfunction: get_tlp_transaction
|
| 310 |
33 |
qaztronic |
|
| 311 |
|
|
|
| 312 |
32 |
qaztronic |
// // --------------------------------------------------------------------
|
| 313 |
|
|
// //
|
| 314 |
|
|
// function void display_tlp_cfg(tlp_type_t tlp_type);
|
| 315 |
33 |
qaztronic |
|
| 316 |
32 |
qaztronic |
// logic [5:0] Register_Number = header[11][7:2];
|
| 317 |
|
|
// logic [3:0] Extended_Register_Number = header[10][3:0];
|
| 318 |
33 |
qaztronic |
|
| 319 |
32 |
qaztronic |
// // $display("??? %16.t | Register_Number = %b", $time, Register_Number);
|
| 320 |
|
|
// // $display("??? %16.t | Extended_Register_Number = %b", $time, Extended_Register_Number);
|
| 321 |
33 |
qaztronic |
// $display("??? %16.t | config offset = 0x%5.x",
|
| 322 |
32 |
qaztronic |
// $time, {Extended_Register_Number, Register_Number, 2'b00});
|
| 323 |
33 |
qaztronic |
|
| 324 |
32 |
qaztronic |
// endfunction: display_tlp_cfg
|
| 325 |
33 |
qaztronic |
|
| 326 |
|
|
|
| 327 |
32 |
qaztronic |
// // --------------------------------------------------------------------
|
| 328 |
|
|
// //
|
| 329 |
|
|
// function void display_tlp_type(tlp_type_t tlp_type);
|
| 330 |
33 |
qaztronic |
|
| 331 |
32 |
qaztronic |
// case(tlp_type)
|
| 332 |
|
|
// // MRd: get_tlp_transaction = REQUESTER;
|
| 333 |
|
|
// // MRdLk: get_tlp_transaction = REQUESTER;
|
| 334 |
|
|
// // MWr: get_tlp_transaction = REQUESTER;
|
| 335 |
|
|
// // IORd: get_tlp_transaction = REQUESTER;
|
| 336 |
|
|
// // IOWr: get_tlp_transaction = REQUESTER;
|
| 337 |
|
|
// CfgRd0: display_tlp_cfg(tlp_type);
|
| 338 |
|
|
// CfgWr0: display_tlp_cfg(tlp_type);
|
| 339 |
|
|
// CfgRd1: display_tlp_cfg(tlp_type);
|
| 340 |
|
|
// CfgWr1: display_tlp_cfg(tlp_type);
|
| 341 |
|
|
// TCfgRd: display_tlp_cfg(tlp_type);
|
| 342 |
|
|
// TCfgWr: display_tlp_cfg(tlp_type);
|
| 343 |
|
|
// // Msg: get_tlp_transaction = REQUESTER;
|
| 344 |
|
|
// // MsgD: get_tlp_transaction = REQUESTER;
|
| 345 |
|
|
// // Cpl: get_tlp_transaction = COMPLETER;
|
| 346 |
|
|
// // CplD: get_tlp_transaction = COMPLETER;
|
| 347 |
|
|
// // CplLk: get_tlp_transaction = COMPLETER;
|
| 348 |
|
|
// // CplDLk: get_tlp_transaction = COMPLETER;
|
| 349 |
|
|
// // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 350 |
|
|
// // Swap: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 351 |
|
|
// // CAS: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 352 |
|
|
// // LPrfx: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 353 |
|
|
// // EPrfx: get_tlp_transaction = TRANSACTION_UNKNOWN;
|
| 354 |
|
|
// default: return;
|
| 355 |
|
|
// endcase
|
| 356 |
|
|
|
| 357 |
|
|
// endfunction: display_tlp_type
|
| 358 |
33 |
qaztronic |
|
| 359 |
|
|
|
| 360 |
32 |
qaztronic |
// // --------------------------------------------------------------------
|
| 361 |
|
|
// //
|
| 362 |
|
|
// function void set_little_endian_header( logic [127:0] data);
|
| 363 |
|
|
|
| 364 |
|
|
// logic [2:0] fmt = data[7:5];
|
| 365 |
33 |
qaztronic |
|
| 366 |
32 |
qaztronic |
// if(fmt > 3'b011)
|
| 367 |
|
|
// begin
|
| 368 |
|
|
// $display("!!! %16.t | fmt 3'b%b not supported", $time, fmt);
|
| 369 |
|
|
// $stop;
|
| 370 |
|
|
// end
|
| 371 |
|
|
|
| 372 |
|
|
// header_is_4_dw = data[5];
|
| 373 |
33 |
qaztronic |
|
| 374 |
32 |
qaztronic |
// for(int i = 0; i < (header_is_4_dw ? 16 : 12); i += 4)
|
| 375 |
|
|
// {header[i + 0], header[i + 1], header[i + 2], header[i + 3]} = data[i*8 +: 32];
|
| 376 |
|
|
|
| 377 |
|
|
// header_type = get_tlp_type(header[0]);
|
| 378 |
|
|
// routing_type = get_tlp_routing(header_type);
|
| 379 |
|
|
// transaction_type = get_tlp_transaction(header_type);
|
| 380 |
33 |
qaztronic |
|
| 381 |
32 |
qaztronic |
// fmt_type = header[0];
|
| 382 |
|
|
// tc = header[1][6:4];
|
| 383 |
|
|
// th = header[1][0];
|
| 384 |
|
|
// attr = {header[1][2], header[2][5:4]};
|
| 385 |
|
|
// td = header[2][7];
|
| 386 |
|
|
// ep = header[2][6];
|
| 387 |
|
|
// length = {header[2][1:0], header[3]};
|
| 388 |
33 |
qaztronic |
|
| 389 |
32 |
qaztronic |
// endfunction: set_little_endian_header
|
| 390 |
|
|
|
| 391 |
|
|
|
| 392 |
|
|
// // --------------------------------------------------------------------
|
| 393 |
|
|
// //
|
| 394 |
|
|
// function void display_header(string str);
|
| 395 |
|
|
|
| 396 |
|
|
// $display("??? %16.t | .....................", $time);
|
| 397 |
|
|
// $display("??? %16.t | %s | TLP type | %s", $time, str, header_type.name);
|
| 398 |
|
|
// // $display("??? %16.t | fmt = %b | type = %b", $time, fmt_type[7:5], fmt_type[4:0]);
|
| 399 |
|
|
// $display("??? %16.t | length = %d", $time, length);
|
| 400 |
33 |
qaztronic |
// $display("??? %16.t | tc = %b | th = %b | attr = %b | td = %b | ep = %b",
|
| 401 |
32 |
qaztronic |
// $time, tc, th, attr, td, ep);
|
| 402 |
|
|
|
| 403 |
|
|
// if(routing_type == ADDRESS)
|
| 404 |
|
|
// if(header_is_4_dw)
|
| 405 |
33 |
qaztronic |
// $display("??? %16.t | address[63:0] = 0x%16.x", $time,
|
| 406 |
|
|
// { header[8], header[9], header[10], header[11],
|
| 407 |
32 |
qaztronic |
// header[12], header[13], header[14], header[15][7:2], 2'b00});
|
| 408 |
|
|
// else
|
| 409 |
33 |
qaztronic |
// $display("??? %16.t | address[31:0] = 0x%8.x", $time,
|
| 410 |
32 |
qaztronic |
// { header[8], header[9], header[10], header[11][7:2], 2'b00});
|
| 411 |
|
|
// else if(routing_type == ID)
|
| 412 |
33 |
qaztronic |
// $display("??? %16.t | bus = 0x%2.x | device = 0x%x | function = 0x%x", $time,
|
| 413 |
32 |
qaztronic |
// header[8], header[9][7:3], header[9][2:0]);
|
| 414 |
33 |
qaztronic |
|
| 415 |
32 |
qaztronic |
// if(transaction_type == COMPLETER)
|
| 416 |
|
|
// begin
|
| 417 |
|
|
// $display("??? %16.t | Completer ID = %b", $time, {header[4], header[5]});
|
| 418 |
|
|
// $display("??? %16.t | requester ID = %b", $time, {header[8], header[9]});
|
| 419 |
|
|
// $display("??? %16.t | tag = %b", $time, header[10]);
|
| 420 |
|
|
// end
|
| 421 |
|
|
// else
|
| 422 |
|
|
// begin
|
| 423 |
|
|
// $display("??? %16.t | requester ID = %b", $time, {header[4], header[5]});
|
| 424 |
|
|
// $display("??? %16.t | tag = %b", $time, header[6]);
|
| 425 |
33 |
qaztronic |
// $display("??? %16.t | last DW BE = %b | first DW BE = %b",
|
| 426 |
32 |
qaztronic |
// $time, header[7][7:4], header[7][3:0]);
|
| 427 |
|
|
// end
|
| 428 |
33 |
qaztronic |
|
| 429 |
32 |
qaztronic |
// display_tlp_type(header_type);
|
| 430 |
33 |
qaztronic |
|
| 431 |
32 |
qaztronic |
// $display("??? %16.t | ---------------------", $time);
|
| 432 |
|
|
|
| 433 |
|
|
// endfunction: display_header
|
| 434 |
|
|
|
| 435 |
|
|
|
| 436 |
|
|
// // //--------------------------------------------------------------------
|
| 437 |
|
|
// // //
|
| 438 |
|
|
// // function new;
|
| 439 |
|
|
|
| 440 |
|
|
// // endfunction: new
|
| 441 |
|
|
|
| 442 |
|
|
|
| 443 |
|
|
// // --------------------------------------------------------------------
|
| 444 |
|
|
// //
|
| 445 |
|
|
// endclass: base_tlp_packet_class
|
| 446 |
|
|
|
| 447 |
|
|
|
| 448 |
|
|
// --------------------------------------------------------------------
|
| 449 |
|
|
//
|
| 450 |
|
|
endpackage: pcie_bfm_pkg
|
| 451 |
|
|
|
| 452 |
|
|
|