| 1 |
33 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// Copyright (C) 2017 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 |
|
|
module
|
| 30 |
|
|
PCIe_debug
|
| 31 |
|
|
(
|
| 32 |
|
|
PCIe_debug_if dbg_bus,
|
| 33 |
|
|
input [31:0] h0,
|
| 34 |
|
|
input [31:0] h1,
|
| 35 |
|
|
input [31:0] h2,
|
| 36 |
|
|
input [31:0] h3,
|
| 37 |
|
|
input enable,
|
| 38 |
|
|
input reset,
|
| 39 |
|
|
input clk
|
| 40 |
|
|
);
|
| 41 |
|
|
|
| 42 |
|
|
// --------------------------------------------------------------------
|
| 43 |
|
|
//
|
| 44 |
|
|
always_ff @(posedge clk)
|
| 45 |
|
|
begin
|
| 46 |
|
|
dbg_bus.h0_r <= h0;
|
| 47 |
|
|
dbg_bus.h1_r <= h1;
|
| 48 |
|
|
dbg_bus.h2_r <= h2;
|
| 49 |
|
|
dbg_bus.h3_r <= h3;
|
| 50 |
|
|
dbg_bus.enable_r <= enable;
|
| 51 |
|
|
end
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
|
|
// --------------------------------------------------------------------
|
| 55 |
|
|
//
|
| 56 |
|
|
always_ff @(posedge clk)
|
| 57 |
|
|
if(dbg_bus.enable_r)
|
| 58 |
|
|
begin
|
| 59 |
|
|
dbg_bus.tlp_fmt <= dbg_bus.h0_r[31:29];
|
| 60 |
|
|
dbg_bus.tlp_type <= dbg_bus.h0_r[28:24];
|
| 61 |
|
|
dbg_bus.tlp_tc <= dbg_bus.h0_r[22:20];
|
| 62 |
|
|
dbg_bus.tlp_th <= dbg_bus.h0_r[16];
|
| 63 |
|
|
dbg_bus.tlp_td <= dbg_bus.h0_r[15];
|
| 64 |
|
|
dbg_bus.tlp_ep <= dbg_bus.h0_r[14];
|
| 65 |
|
|
dbg_bus.tlp_attr <= {dbg_bus.h0_r[18], dbg_bus.h0_r[13:12]};
|
| 66 |
|
|
dbg_bus.tlp_at <= dbg_bus.h0_r[11:10];
|
| 67 |
|
|
dbg_bus.tlp_length <= dbg_bus.h0_r[9:0];
|
| 68 |
|
|
end
|
| 69 |
|
|
|
| 70 |
|
|
|
| 71 |
|
|
// --------------------------------------------------------------------
|
| 72 |
|
|
//
|
| 73 |
|
|
assign dbg_bus.tlp_is_3dw = ~dbg_bus.h0_r[29];
|
| 74 |
|
|
assign dbg_bus.tlp_is_4dw = dbg_bus.h0_r[29];
|
| 75 |
|
|
assign dbg_bus.tlp_address = dbg_bus.tlp_is_4dw
|
| 76 |
|
|
? {dbg_bus.h2_r, dbg_bus.h3_r}
|
| 77 |
|
|
: {32'h0, dbg_bus.h2_r};
|
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
// --------------------------------------------------------------------
|
| 81 |
|
|
//
|
| 82 |
|
|
endmodule
|
| 83 |
|
|
|