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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [core/] [ds_dma64/] [pcie_src/] [pcie_core64_m1/] [source/] [pcie_blk_plus_ll_tx.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dsmv
 
2
//-----------------------------------------------------------------------------
3
//
4
// (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.
5
//
6
// This file contains confidential and proprietary information
7
// of Xilinx, Inc. and is protected under U.S. and
8
// international copyright and other intellectual property
9
// laws.
10
//
11
// DISCLAIMER
12
// This disclaimer is not a license and does not grant any
13
// rights to the materials distributed herewith. Except as
14
// otherwise provided in a valid license issued to you by
15
// Xilinx, and to the maximum extent permitted by applicable
16
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
17
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
18
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
19
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
20
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
21
// (2) Xilinx shall not be liable (whether in contract or tort,
22
// including negligence, or under any other theory of
23
// liability) for any loss or damage of any kind or nature
24
// related to, arising under or in connection with these
25
// materials, including for any direct, or any indirect,
26
// special, incidental, or consequential loss or damage
27
// (including loss of data, profits, goodwill, or any type of
28
// loss or damage suffered as a result of any action brought
29
// by a third party) even if such damage or loss was
30
// reasonably foreseeable or Xilinx had been advised of the
31
// possibility of the same.
32
//
33
// CRITICAL APPLICATIONS
34
// Xilinx products are not designed or intended to be fail-
35
// safe, or for use in any application requiring fail-safe
36
// performance, such as life-support or safety devices or
37
// systems, Class III medical devices, nuclear facilities,
38
// applications related to the deployment of airbags, or any
39
// other applications that could lead to death, personal
40
// injury, or severe property or environmental damage
41
// (individually and collectively, "Critical
42
// Applications"). Customer assumes the sole risk and
43
// liability of any use of Xilinx products in Critical
44
// Applications, subject only to applicable laws and
45
// regulations governing limitations on product liability.
46
//
47
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
48
// PART OF THIS FILE AT ALL TIMES.
49
//
50
//-----------------------------------------------------------------------------
51
// Project    : V5-Block Plus for PCI Express
52
// File       : pcie_blk_plus_ll_tx.v
53
//--------------------------------------------------------------------------------
54
//--------------------------------------------------------------------------------
55
/*****************************************************************************
56
 *  Description : PCIe Block Plus Tx Bridge - instantiates the primary
57
 *                LocalLink bridge (which translates between Soft-macro
58
 *                LocalLink and the Hard-Block interface) and the TX Mux/arb
59
 *                module (which muxes in input from the config module)
60
 *
61
 *  NOTE:  Search for "FIXME" tags for high-priority changes to be made
62
 ****************************************************************************/
63
 
64
`timescale 1ns/1ns
65
`ifndef TCQ
66
 `define TCQ 1
67
`endif
68
 
69
module pcie_blk_plus_ll_tx #
70
  ( parameter   TX_CPL_STALL_THRESHOLD   = 6,
71
    parameter   TX_DATACREDIT_FIX_EN     = 1,
72
    parameter   TX_DATACREDIT_FIX_1DWONLY= 1,
73
    parameter   TX_DATACREDIT_FIX_MARGIN = 6,
74
    parameter   MPS = 0,
75
    parameter   LEGACY_EP = 1'b0             // Legacy PCI endpoint?
76
  )
77
  (
78
   // Clock and reset
79
 
80
   input             clk,
81
   input             rst_n,
82
 
83
   // Transaction Link Up
84
 
85
   input             trn_lnk_up_n,
86
 
87
   // PCIe Block Tx Ports
88
   output [63:0]     llk_tx_data,
89
   output            llk_tx_src_rdy_n,
90
   output            llk_tx_src_dsc_n,
91
   output            llk_tx_sof_n,
92
   output            llk_tx_eof_n,
93
   output            llk_tx_sop_n,
94
   output            llk_tx_eop_n,
95
   output [1:0]      llk_tx_enable_n,
96
   output [2:0]      llk_tx_ch_tc,
97
   output [1:0]      llk_tx_ch_fifo,
98
 
99
   input             llk_tx_dst_rdy_n,
100
   input [9:0]       llk_tx_chan_space,            // ignored input
101
   input [7:0]       llk_tx_ch_posted_ready_n,     // ignored input
102
   input [7:0]       llk_tx_ch_non_posted_ready_n, // ignored input
103
   input [7:0]       llk_tx_ch_completion_ready_n, // ignored input
104
 
105
 
106
   // LocalLink Tx Ports from userapp
107
 
108
   input [63:0]      trn_td,
109
   input [7:0]       trn_trem_n,
110
   input             trn_tsof_n,
111
   input             trn_teof_n,
112
   input             trn_tsrc_rdy_n,
113
   input             trn_tsrc_dsc_n,    // NOTE: may not be supported by Block
114
   input             trn_terrfwd_n,     // NOTE: not supported by bridge/Block
115
 
116
   output            trn_tdst_rdy_n,
117
   output            trn_tdst_dsc_n,
118
   output reg [3:0]  trn_tbuf_av,
119
 
120
   // LocalLink TX Ports from cfg/mgmt logic
121
   input [63:0]      cfg_tx_td,
122
   input             cfg_tx_rem_n,
123
   input             cfg_tx_sof_n,
124
   input             cfg_tx_eof_n,
125
   input             cfg_tx_src_rdy_n,
126
   output            cfg_tx_dst_rdy_n,
127
 
128
   // Status output to config-bridge
129
   output reg         tx_err_wr_ep_n = 1'b1,
130
   input  wire  [7:0] tx_ch_credits_consumed,
131
   input  wire [11:0] tx_pd_credits_available,
132
   input  wire [11:0] tx_pd_credits_consumed,
133
   input  wire [11:0] tx_npd_credits_available,
134
   input  wire [11:0] tx_npd_credits_consumed,
135
   input  wire [11:0] tx_cd_credits_available,
136
   input  wire [11:0] tx_cd_credits_consumed,
137
   input  wire        pd_credit_limited,
138
   input  wire        npd_credit_limited,
139
   input  wire        cd_credit_limited,
140
   output wire        clear_cpl_count,
141
   input  wire  [7:0] trn_pfc_cplh_cl,
142
   input  wire        trn_pfc_cplh_cl_upd,
143
   input  wire        l0_stats_cfg_transmitted
144
   );
145
 
146
   wire [63:0] tx_td;
147
   wire        tx_sof_n;
148
   wire        tx_eof_n;
149
   wire [7:0]  tx_rem_n;
150
   wire        tx_src_dsc_n;
151
   wire        tx_src_rdy_n;
152
   wire        tx_dst_rdy_n;
153
   reg  [2:0]  trn_tbuf_av_int;
154
 
155
  pcie_blk_ll_tx_arb tx_arb
156
    (
157
     .clk( clk ),                                                    // I
158
     .rst_n( rst_n ),                                                // I
159
     // Outputs to original TX Bridge
160
     .tx_td( tx_td ),                                                // O[63:0]
161
     .tx_sof_n( tx_sof_n ),                                          // O
162
     .tx_eof_n( tx_eof_n ),                                          // O
163
     .tx_rem_n( tx_rem_n ),                                          // O
164
     .tx_src_dsc_n( tx_src_dsc_n ),                                  // O
165
     .tx_src_rdy_n( tx_src_rdy_n ),                                  // O
166
     .tx_dst_rdy_n( tx_dst_rdy_n ),                                  // I
167
     // User (TRN) Tx Ports
168
     .trn_td( trn_td ),                                              // I[63:0]
169
     .trn_trem_n( trn_trem_n ),                                      // I[7:0]
170
     .trn_tsof_n( trn_tsof_n ),                                      // I
171
     .trn_teof_n( trn_teof_n ),                                      // I
172
     .trn_tsrc_rdy_n( trn_tsrc_rdy_n ),                              // I
173
     .trn_tsrc_dsc_n( trn_tsrc_dsc_n ),                              // I
174
     .trn_tdst_rdy_n( trn_tdst_rdy_n ),                              // O 
175
     .trn_tdst_dsc_n( trn_tdst_dsc_n ),                              // O 
176
     // Config Tx Ports
177
     .cfg_tx_td( cfg_tx_td ),                                        // I[63:0]
178
     .cfg_tx_rem_n( cfg_tx_rem_n ),                                  // I
179
     .cfg_tx_sof_n( cfg_tx_sof_n ),                                  // I
180
     .cfg_tx_eof_n( cfg_tx_eof_n ),                                  // I
181
     .cfg_tx_src_rdy_n( cfg_tx_src_rdy_n ),                          // I
182
     .cfg_tx_dst_rdy_n( cfg_tx_dst_rdy_n )                           // O
183
     );
184
 
185
  always @(posedge clk) begin
186
    // Pulse tx_err_wr_ep_n output when a packet with the EP
187
    // bit set is transmitted
188
    tx_err_wr_ep_n  <= #`TCQ !(!tx_sof_n && !tx_src_rdy_n &&
189
                               !tx_dst_rdy_n && tx_td[46]);
190
  end
191
 
192
  pcie_blk_ll_tx #
193
    ( .TX_CPL_STALL_THRESHOLD   ( TX_CPL_STALL_THRESHOLD ),
194
      .TX_DATACREDIT_FIX_EN     ( TX_DATACREDIT_FIX_EN ),
195
      .TX_DATACREDIT_FIX_1DWONLY( TX_DATACREDIT_FIX_1DWONLY ),
196
      .TX_DATACREDIT_FIX_MARGIN ( TX_DATACREDIT_FIX_MARGIN ),
197
      .MPS                      ( MPS ),
198
      .LEGACY_EP                ( LEGACY_EP )
199
    )
200
  tx_bridge
201
    (
202
     // Clock & Reset
203
     .clk( clk ),                                                    // I
204
     .rst_n( rst_n ),                                                // I
205
     // Transaction Link Up
206
     .trn_lnk_up_n (trn_lnk_up_n),                                   // I
207
     // PCIe Block Tx Ports
208
     .llk_tx_data( llk_tx_data ),                                    // O[63:0] 
209
     .llk_tx_src_rdy_n( llk_tx_src_rdy_n ),                          // O
210
     .llk_tx_src_dsc_n( llk_tx_src_dsc_n ),                          // O
211
     .llk_tx_sof_n( llk_tx_sof_n ),                                  // O
212
     .llk_tx_eof_n( llk_tx_eof_n ),                                  // O
213
     .llk_tx_sop_n( llk_tx_sop_n ),                                  // O
214
     .llk_tx_eop_n( llk_tx_eop_n ),                                  // O
215
     .llk_tx_enable_n( llk_tx_enable_n ),                            // O[1:0]
216
     .llk_tx_ch_tc( llk_tx_ch_tc ),                                  // O[2:0]
217
     .llk_tx_ch_fifo( llk_tx_ch_fifo ),                              // O[1:0]
218
     .llk_tx_dst_rdy_n( llk_tx_dst_rdy_n ),                          // I
219
     .llk_tx_chan_space( llk_tx_chan_space ),                        // I[9:0]
220
     .llk_tx_ch_posted_ready_n( llk_tx_ch_posted_ready_n ),          // I[7:0]
221
     .llk_tx_ch_non_posted_ready_n( llk_tx_ch_non_posted_ready_n ),  // I[7:0]
222
     .llk_tx_ch_completion_ready_n( llk_tx_ch_completion_ready_n ),  // I[7:0]
223
     // LocalLink Tx Ports (from arbiter/mux)
224
     .trn_td( tx_td ),                                               // I[63:0]
225
     .trn_trem_n( tx_rem_n ),                                        // I[7:0]
226
     .trn_tsof_n( tx_sof_n ),                                        // I
227
     .trn_teof_n( tx_eof_n ),                                        // I
228
     .trn_tsrc_rdy_n( tx_src_rdy_n ),                                // I
229
     .trn_tsrc_dsc_n( tx_src_dsc_n ),                                // I
230
     .trn_terrfwd_n( 1'b1 ), // Unused input                         // I
231
     .trn_tdst_rdy_n( tx_dst_rdy_n ),                                // O
232
     .trn_tdst_dsc_n( tx_dst_dsc_n ),                                // O
233
     .trn_tbuf_av_cpl( trn_tbuf_av_cpl ),
234
     .tx_ch_credits_consumed   ( tx_ch_credits_consumed ),
235
     .tx_pd_credits_available  ( tx_pd_credits_available ),
236
     .tx_pd_credits_consumed   ( tx_pd_credits_consumed ),
237
     .tx_npd_credits_available ( tx_npd_credits_available ),
238
     .tx_npd_credits_consumed  ( tx_npd_credits_consumed ),
239
     .tx_cd_credits_available  ( tx_cd_credits_available ),
240
     .tx_cd_credits_consumed   ( tx_cd_credits_consumed ),
241
     .clear_cpl_count          ( clear_cpl_count ),
242
     .pd_credit_limited        ( pd_credit_limited ),
243
     .npd_credit_limited       ( npd_credit_limited ),
244
     .cd_credit_limited        ( cd_credit_limited ),
245
     .trn_pfc_cplh_cl          ( trn_pfc_cplh_cl ),
246
     .trn_pfc_cplh_cl_upd      ( trn_pfc_cplh_cl_upd ),
247
     .l0_stats_cfg_transmitted ( l0_stats_cfg_transmitted )
248
    );
249
 
250
  // trn_tbuf_av output -
251
  //   Each bit corresponds to one payload type:
252
  //     0:  non-posted
253
  //     1:  posted
254
  //     2:  completion
255
  //   When all FIFOs of that type have room, the corresponding bit of
256
  //   trn_tbuf_av is asserted, indicating that the Block can definitely
257
  //   accept a packet of that type.
258
  always @(posedge clk) begin
259
    if (!rst_n) begin
260
      trn_tbuf_av_int    <= #`TCQ 3'b000;
261
    end else begin
262
      trn_tbuf_av_int[0] <= &(~llk_tx_ch_non_posted_ready_n);
263
      trn_tbuf_av_int[1] <= &(~llk_tx_ch_posted_ready_n);
264
      trn_tbuf_av_int[2] <= &(~llk_tx_ch_completion_ready_n);
265
    end
266
  end
267
 
268
  always @* begin
269
     trn_tbuf_av[2:0] = trn_tbuf_av_int[2:0];
270
     trn_tbuf_av[3]   = trn_tbuf_av_cpl;
271
  end
272
 
273
endmodule // pcie_blk_plus_ll_tx

powered by: WebSVN 2.1.0

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