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_6/] [simulation/] [dsport/] [pci_exp_usrapp_cfg.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
 
2
//-----------------------------------------------------------------------------
3
//
4
// (c) Copyright 2009-2011 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    : Virtex-6 Integrated Block for PCI Express
52
// File       : pci_exp_usrapp_cfg.v
53
// Version    : 1.7
54
//--
55
//--------------------------------------------------------------------------------
56
 
57
`include "board_common.v"
58
 
59
module pci_exp_usrapp_cfg (
60
 
61
                          cfg_do,
62
                          cfg_di,
63
                          cfg_byte_en_n,
64
                          cfg_dwaddr,
65
                          cfg_wr_en_n,
66
                          cfg_rd_en_n,
67
                          cfg_rd_wr_done_n,
68
 
69
                          cfg_err_cor_n,
70
                          cfg_err_ur_n,
71
                          cfg_err_ecrc_n,
72
                          cfg_err_cpl_timeout_n,
73
                          cfg_err_cpl_abort_n,
74
                          cfg_err_cpl_unexpect_n,
75
                          cfg_err_posted_n,
76
                          cfg_err_tlp_cpl_header,
77
                          cfg_interrupt_n,
78
                          cfg_interrupt_rdy_n,
79
                          cfg_turnoff_ok_n,
80
                          cfg_to_turnoff_n,
81
                          cfg_bus_number,
82
                          cfg_device_number,
83
                          cfg_function_number,
84
                           cfg_status,
85
                          cfg_command,
86
                          cfg_dstatus,
87
                          cfg_dcommand,
88
                          cfg_lstatus,
89
                          cfg_lcommand,
90
 
91
                          cfg_pcie_link_state_n,
92
                          cfg_trn_pending_n,
93
                          cfg_pm_wake_n,
94
 
95
                          trn_clk,
96
                          trn_reset_n
97
 
98
                          );
99
 
100
 
101
 
102
input   [(32 - 1):0]     cfg_do;
103
output  [(32 - 1):0]     cfg_di;
104
output  [(32/8 - 1):0]   cfg_byte_en_n;
105
output  [(10 - 1):0]     cfg_dwaddr;
106
output                                        cfg_wr_en_n;
107
output                                        cfg_rd_en_n;
108
input                                         cfg_rd_wr_done_n;
109
 
110
output                                        cfg_err_cor_n;
111
output                                        cfg_err_ur_n;
112
output                                        cfg_err_ecrc_n;
113
output                                        cfg_err_cpl_timeout_n;
114
output                                        cfg_err_cpl_abort_n;
115
output                                        cfg_err_cpl_unexpect_n;
116
output                                        cfg_err_posted_n;
117
output  [(48 - 1):0]   cfg_err_tlp_cpl_header;
118
output                                        cfg_interrupt_n;
119
input                                         cfg_interrupt_rdy_n;
120
output                                        cfg_turnoff_ok_n;
121
input                                         cfg_to_turnoff_n;
122
output                                        cfg_pm_wake_n;
123
input    [(8 - 1):0]  cfg_bus_number;
124
input    [(5 - 1):0]  cfg_device_number;
125
input    [(3 - 1):0]  cfg_function_number;
126
input   [(16 - 1):0]      cfg_status;
127
input   [(16- 1):0]      cfg_command;
128
input   [(16- 1):0]      cfg_dstatus;
129
input   [(16 - 1):0]      cfg_dcommand;
130
input   [(16 - 1):0]      cfg_lstatus;
131
input   [(16 - 1):0]      cfg_lcommand;
132
 
133
input  [(3 - 1):0]     cfg_pcie_link_state_n;
134
output                                        cfg_trn_pending_n;
135
 
136
input                                         trn_clk;
137
input                                         trn_reset_n;
138
 
139
parameter                                     Tcq = 1;
140
 
141
reg  [(32 - 1):0]        cfg_di;
142
reg  [(32/8 - 1):0]      cfg_byte_en_n;
143
reg  [(10 - 1):0]        cfg_dwaddr;
144
reg                                           cfg_wr_en_n;
145
reg                                           cfg_rd_en_n;
146
 
147
reg                                           cfg_err_cor_n;
148
reg                                           cfg_err_ecrc_n;
149
reg                                           cfg_err_ur_n;
150
reg                                           cfg_err_cpl_timeout_n;
151
reg                                           cfg_err_cpl_abort_n;
152
reg                                           cfg_err_cpl_unexpect_n;
153
reg                                           cfg_err_posted_n;
154
reg  [(48 - 1):0]      cfg_err_tlp_cpl_header;
155
reg                                           cfg_interrupt_n;
156
reg                                           cfg_turnoff_ok_n;
157
reg                                           cfg_pm_wake_n;
158
reg                                           cfg_trn_pending_n;
159
 
160
initial begin
161
 
162
  cfg_err_cor_n <= 1'b1;
163
  cfg_err_ur_n <= 1'b1;
164
  cfg_err_ecrc_n <= 1'b1;
165
  cfg_err_cpl_timeout_n <= 1'b1;
166
  cfg_err_cpl_abort_n <= 1'b1;
167
  cfg_err_cpl_unexpect_n <= 1'b1;
168
  cfg_err_posted_n <= 1'b0;
169
  cfg_interrupt_n <= 1'b1;
170
  cfg_turnoff_ok_n <= 1'b1;
171
 
172
  cfg_dwaddr <= 0;
173
  cfg_err_tlp_cpl_header <= 0;
174
 
175
  cfg_di <= 0;
176
  cfg_byte_en_n <= 4'hf;
177
  cfg_wr_en_n <= 1;
178
  cfg_rd_en_n <= 1;
179
 
180
  cfg_pm_wake_n <= 1;
181
  cfg_trn_pending_n <= 1'b0;
182
 
183
end
184
 
185
/************************************************************
186
Task : TSK_READ_CFG_DW
187
Description : Read Configuration Space DW
188
*************************************************************/
189
 
190
task TSK_READ_CFG_DW;
191
 
192
input   [31:0]   addr_;
193
 
194
begin
195
 
196
  if (!trn_reset_n) begin
197
 
198
    $display("[%t] : trn_reset_n is asserted", $realtime);
199
    $finish(1);
200
 
201
  end
202
 
203
  wait ( cfg_rd_wr_done_n == 1'b1)
204
 
205
  @(posedge trn_clk);
206
  cfg_dwaddr <= #(Tcq) addr_;
207
  cfg_wr_en_n <= #(Tcq) 1'b1;
208
  cfg_rd_en_n <= #(Tcq) 1'b0;
209
 
210
  $display("[%t] : Reading Cfg Addr [0x%h]", $realtime, addr_);
211
  $fdisplay(board.RP.com_usrapp.tx_file_ptr,
212
            "\n[%t] : Local Configuration Read Access :",
213
            $realtime);
214
 
215
  @(posedge trn_clk);
216
  #(Tcq);
217
  wait ( cfg_rd_wr_done_n == 1'b0)
218
  #(Tcq);
219
 
220
  $fdisplay(board.RP.com_usrapp.tx_file_ptr,
221
            "\t\t\tCfg Addr [0x%h] -> Data [0x%h]\n",
222
            {addr_,2'b00}, cfg_do);
223
  cfg_rd_en_n <= #(Tcq) 1'b1;
224
 
225
end
226
 
227
endtask // TSK_READ_CFG_DW;
228
 
229
 
230
/************************************************************
231
Task : TSK_WRITE_CFG_DW
232
Description : Write Configuration Space DW
233
*************************************************************/
234
 
235
task TSK_WRITE_CFG_DW;
236
 
237
input   [31:0]   addr_;
238
input   [31:0]   data_;
239
input   [3:0]    ben_;
240
 
241
begin
242
 
243
  if (!trn_reset_n) begin
244
 
245
    $display("[%t] : trn_reset_n is asserted", $realtime);
246
    $finish(1);
247
 
248
  end
249
 
250
  wait ( cfg_rd_wr_done_n == 1'b1)
251
 
252
  @(posedge trn_clk);
253
  cfg_dwaddr <= #(Tcq) addr_;
254
  cfg_di      <= #(Tcq) data_;
255
  cfg_byte_en_n <= #(Tcq) ben_;
256
  cfg_wr_en_n <= #(Tcq) 1'b0;
257
  cfg_rd_en_n <= #(Tcq) 1'b1;
258
 
259
  $display("[%t] : Writing Cfg Addr [0x%h]", $realtime, addr_);
260
  $fdisplay(board.RP.com_usrapp.tx_file_ptr,
261
            "\n[%t] : Local Configuration Write Access :",
262
            $realtime);
263
 
264
  @(posedge trn_clk);
265
  #(Tcq);
266
  wait ( cfg_rd_wr_done_n == 1'b0)
267
  #(Tcq);
268
 
269
  cfg_wr_en_n <= #(Tcq) 1'b1;
270
 
271
end
272
 
273
endtask // TSK_WRITE_CFG_DW;
274
 
275
 
276
endmodule // pci_exp_usrapp_cfg
277
 

powered by: WebSVN 2.1.0

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