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

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE13.3/] [ipcore_dir_ISE13.3/] [v6_pcie_v1_7_x1/] [example_design/] [PIO_64_TX_ENGINE.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
//-----------------------------------------------------------------------------
2
//
3
// (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
4
//
5
// This file contains confidential and proprietary information
6
// of Xilinx, Inc. and is protected under U.S. and
7
// international copyright and other intellectual property
8
// laws.
9
//
10
// DISCLAIMER
11
// This disclaimer is not a license and does not grant any
12
// rights to the materials distributed herewith. Except as
13
// otherwise provided in a valid license issued to you by
14
// Xilinx, and to the maximum extent permitted by applicable
15
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
16
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
17
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
18
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
19
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
20
// (2) Xilinx shall not be liable (whether in contract or tort,
21
// including negligence, or under any other theory of
22
// liability) for any loss or damage of any kind or nature
23
// related to, arising under or in connection with these
24
// materials, including for any direct, or any indirect,
25
// special, incidental, or consequential loss or damage
26
// (including loss of data, profits, goodwill, or any type of
27
// loss or damage suffered as a result of any action brought
28
// by a third party) even if such damage or loss was
29
// reasonably foreseeable or Xilinx had been advised of the
30
// possibility of the same.
31
//
32
// CRITICAL APPLICATIONS
33
// Xilinx products are not designed or intended to be fail-
34
// safe, or for use in any application requiring fail-safe
35
// performance, such as life-support or safety devices or
36
// systems, Class III medical devices, nuclear facilities,
37
// applications related to the deployment of airbags, or any
38
// other applications that could lead to death, personal
39
// injury, or severe property or environmental damage
40
// (individually and collectively, "Critical
41
// Applications"). Customer assumes the sole risk and
42
// liability of any use of Xilinx products in Critical
43
// Applications, subject only to applicable laws and
44
// regulations governing limitations on product liability.
45
//
46
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
47
// PART OF THIS FILE AT ALL TIMES.
48
//
49
//-----------------------------------------------------------------------------
50
// Project    : Virtex-6 Integrated Block for PCI Express
51
// File       : PIO_64_TX_ENGINE.v
52
// Version    : 1.7
53
//-- Description: 64 bit Local-Link Transmit Unit.
54
//--
55
//--------------------------------------------------------------------------------
56
 
57
`timescale 1ns/1ns
58
 
59
`define PIO_64_CPLD_FMT_TYPE 7'b10_01010
60
 
61
`define PIO_64_TX_RST_STATE  1'b0
62
`define PIO_64_TX_CPLD_QW1   1'b1
63
 
64
module PIO_64_TX_ENGINE    (
65
 
66
                        clk,
67
                        rst_n,
68
 
69
                        trn_td,
70
                        trn_trem_n,
71
                        trn_tsof_n,
72
                        trn_teof_n,
73
                        trn_tsrc_rdy_n,
74
                        trn_tsrc_dsc_n,
75
                        trn_tdst_rdy_n,
76
                        trn_tdst_dsc_n,
77
 
78
                        req_compl_i,
79
                        compl_done_o,
80
 
81
                        req_tc_i,
82
                        req_td_i,
83
                        req_ep_i,
84
                        req_attr_i,
85
                        req_len_i,
86
                        req_rid_i,
87
                        req_tag_i,
88
                        req_be_i,
89
                        req_addr_i,
90
 
91
                        // Read Access
92
 
93
                        rd_addr_o,
94
                        rd_be_o,
95
                        rd_data_i,
96
 
97
                        completer_id_i,
98
                        cfg_bus_mstr_enable_i
99
 
100
                        );
101
 
102
    input               clk;
103
    input               rst_n;
104
 
105
    output [63:0]       trn_td;
106
    output [7:0]        trn_trem_n;
107
    output              trn_tsof_n;
108
    output              trn_teof_n;
109
    output              trn_tsrc_rdy_n;
110
    output              trn_tsrc_dsc_n;
111
    input               trn_tdst_rdy_n;
112
    input               trn_tdst_dsc_n;
113
 
114
    input               req_compl_i;
115
    output              compl_done_o;
116
 
117
    input [2:0]         req_tc_i;
118
    input               req_td_i;
119
    input               req_ep_i;
120
    input [1:0]         req_attr_i;
121
    input [9:0]         req_len_i;
122
    input [15:0]        req_rid_i;
123
    input [7:0]         req_tag_i;
124
    input [7:0]         req_be_i;
125
    input [12:0]        req_addr_i;
126
 
127
    output [10:0]       rd_addr_o;
128
    output [3:0]        rd_be_o;
129
    input  [31:0]       rd_data_i;
130
 
131
    input [15:0]        completer_id_i;
132
    input               cfg_bus_mstr_enable_i;
133
 
134
    // Local registers
135
 
136
    reg [63:0]          trn_td;
137
    reg [7:0]           trn_trem_n;
138
    reg                 trn_tsof_n;
139
    reg                 trn_teof_n;
140
    reg                 trn_tsrc_rdy_n;
141
    reg                 trn_tsrc_dsc_n /*synthesis syn_keep = 1*/;
142
 
143
    reg [11:0]          byte_count;
144
    reg [06:0]          lower_addr;
145
 
146
    reg                 compl_done_o;
147
    reg                 req_compl_q;
148
 
149
    reg [0:0]           state;
150
 
151
    // Local wires
152
 
153
    /*
154
     * Present address and byte enable to memory module
155
     */
156
 
157
    assign rd_addr_o = req_addr_i[12:2];
158
    assign rd_be_o =   req_be_i[3:0];
159
 
160
    /*
161
     * Calculate byte count based on byte enable
162
     */
163
 
164
    always @ (rd_be_o) begin
165
 
166
      casex (rd_be_o[3:0])
167
 
168
        4'b1xx1 : byte_count = 12'h004;
169
        4'b01x1 : byte_count = 12'h003;
170
        4'b1x10 : byte_count = 12'h003;
171
        4'b0011 : byte_count = 12'h002;
172
        4'b0110 : byte_count = 12'h002;
173
        4'b1100 : byte_count = 12'h002;
174
        4'b0001 : byte_count = 12'h001;
175
        4'b0010 : byte_count = 12'h001;
176
        4'b0100 : byte_count = 12'h001;
177
        4'b1000 : byte_count = 12'h001;
178
        4'b0000 : byte_count = 12'h001;
179
 
180
      endcase
181
 
182
    end
183
 
184
    /*
185
     * Calculate lower address based on  byte enable
186
     */
187
 
188
    always @ (rd_be_o or req_addr_i) begin
189
 
190
      casex (rd_be_o[3:0])
191
 
192
        4'b0000 : lower_addr = {req_addr_i[6:2], 2'b00};
193
        4'bxxx1 : lower_addr = {req_addr_i[6:2], 2'b00};
194
        4'bxx10 : lower_addr = {req_addr_i[6:2], 2'b01};
195
        4'bx100 : lower_addr = {req_addr_i[6:2], 2'b10};
196
        4'b1000 : lower_addr = {req_addr_i[6:2], 2'b11};
197
 
198
      endcase
199
 
200
    end
201
 
202
    always @ ( posedge clk ) begin
203
 
204
        if (!rst_n ) begin
205
 
206
          req_compl_q <= 1'b0;
207
 
208
        end else begin
209
 
210
          req_compl_q <= req_compl_i;
211
 
212
        end
213
 
214
    end
215
 
216
    /*
217
     *  Generate Completion with 1 DW Payload
218
     */
219
 
220
    always @ ( posedge clk ) begin
221
 
222
        if (!rst_n ) begin
223
 
224
          trn_tsof_n        <= 1'b1;
225
          trn_teof_n        <= 1'b1;
226
          trn_tsrc_rdy_n    <= 1'b1;
227
          trn_tsrc_dsc_n    <= 1'b1;
228
          trn_td            <= 64'b0;
229
          trn_trem_n        <= 8'b0;
230
 
231
          compl_done_o      <= 1'b0;
232
 
233
          state             <= `PIO_64_TX_RST_STATE;
234
 
235
        end else begin
236
 
237
 
238
          case ( state )
239
 
240
            `PIO_64_TX_RST_STATE : begin
241
 
242
              if (req_compl_q && trn_tdst_dsc_n) begin
243
 
244
                trn_tsof_n       <= 1'b0;
245
                trn_teof_n       <= 1'b1;
246
                trn_tsrc_rdy_n   <= 1'b0;
247
                trn_td           <= { {1'b0},
248
                                      `PIO_64_CPLD_FMT_TYPE,
249
                                      {1'b0},
250
                                      req_tc_i,
251
                                      {4'b0},
252
                                      req_td_i,
253
                                      req_ep_i,
254
                                      req_attr_i,
255
                                      {2'b0},
256
                                      req_len_i,
257
                                      completer_id_i,
258
                                      {3'b0},
259
                                      {1'b0},
260
                                      byte_count };
261
                trn_trem_n        <= 8'b0;
262
 
263
                state             <= `PIO_64_TX_CPLD_QW1;
264
 
265
              end else begin
266
 
267
                trn_tsof_n        <= 1'b1;
268
                trn_teof_n        <= 1'b1;
269
                trn_tsrc_rdy_n    <= 1'b1;
270
                trn_tsrc_dsc_n    <= 1'b1;
271
                trn_td            <= 64'b0;
272
                trn_trem_n        <= 8'b0;
273
                compl_done_o      <= 1'b0;
274
 
275
                state             <= `PIO_64_TX_RST_STATE;
276
 
277
              end
278
 
279
            end
280
 
281
            `PIO_64_TX_CPLD_QW1 : begin
282
 
283
              if ((!trn_tdst_rdy_n) && (trn_tdst_dsc_n)) begin
284
 
285
                trn_tsof_n       <= 1'b1;
286
                trn_teof_n       <= 1'b0;
287
                trn_tsrc_rdy_n   <= 1'b0;
288
                trn_td           <= { req_rid_i,
289
                                      req_tag_i,
290
                                      {1'b0},
291
                                      lower_addr,
292
                                      rd_data_i };
293
                trn_trem_n        <= 8'h00;
294
                compl_done_o      <= 1'b1;
295
 
296
                state             <= `PIO_64_TX_RST_STATE;
297
 
298
              end else if (!trn_tdst_dsc_n) begin
299
 
300
                state             <= `PIO_64_TX_RST_STATE;
301
                trn_tsrc_dsc_n    <= 1'b0;
302
 
303
              end else
304
                state             <= `PIO_64_TX_CPLD_QW1;
305
 
306
            end
307
 
308
          endcase
309
 
310
        end
311
 
312
    end
313
 
314
endmodule // PIO_64_TX_ENGINE
315
 
316
 

powered by: WebSVN 2.1.0

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