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

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [trunk/] [Hardware/] [xilinx_internal_jtag/] [rtl/] [verilog/] [xilinx_internal_jtag.v] - Blame information for rev 14

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 nyawn
///////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  xilinx_internal_jtag.v                                      ////
4
////                                                              ////
5
////                                                              ////
6
////                                                              ////
7
////  Author(s):                                                  ////
8
////       Nathan Yawn (nathan.yawn@opencores.org)                ////
9
////                                                              ////
10
////                                                              ////
11
////                                                              ////
12
//////////////////////////////////////////////////////////////////////
13
////                                                              ////
14
//// Copyright (C) 2008 Authors                                   ////
15
////                                                              ////
16
//// This source file may be used and distributed without         ////
17
//// restriction provided that this copyright statement is not    ////
18
//// removed from the file and that any derivative work contains  ////
19
//// the original copyright notice and the associated disclaimer. ////
20
////                                                              ////
21
//// This source file is free software; you can redistribute it   ////
22
//// and/or modify it under the terms of the GNU Lesser General   ////
23
//// Public License as published by the Free Software Foundation; ////
24
//// either version 2.1 of the License, or (at your option) any   ////
25
//// later version.                                               ////
26
////                                                              ////
27
//// This source is distributed in the hope that it will be       ////
28
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
29
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
30
//// PURPOSE.  See the GNU Lesser General Public License for more ////
31
//// details.                                                     ////
32
////                                                              ////
33
//// You should have received a copy of the GNU Lesser General    ////
34
//// Public License along with this source; if not, download it   ////
35
//// from http://www.opencores.org/lgpl.shtml                     ////
36
////                                                              ////
37
//////////////////////////////////////////////////////////////////////
38
//                                                                  //
39
// This file is a wrapper for the various Xilinx internal BSCAN     //
40
// TAP devices.  It is designed to take the place of a separate TAP //
41
// controller in Xilinx systems, to allow a user to access a CPU    //
42
// debug module (such as that of the OR1200) through the FPGA's     //
43
// dedicated JTAG / configuration port.                             //
44
//                                                                  //
45
//////////////////////////////////////////////////////////////////////
46
//
47
// CVS Revision History
48
//
49
// $Log: xilinx_internal_jtag.v,v $
50 14 nyawn
// Revision 1.3  2009/06/16 02:54:23  Nathan
51
// Changed some signal names for better consistency between different hardware modules.
52
//
53 3 nyawn
// Revision 1.2  2009/05/17 20:54:16  Nathan
54
// Changed email address to opencores.org
55
//
56
// Revision 1.1  2008/07/18 20:07:32  Nathan
57
// Changed the directory structure to match existing projects.
58
//
59
// Revision 1.4  2008/07/11 08:26:10  Nathan
60
// Ran through dos2unix
61
//
62
// Revision 1.3  2008/07/11 08:25:52  Nathan
63
// Added logic to provide CAPTURE_DR signal when necessary, and to provide a TCK while UPDATE_DR is asserted.  Note that there is no TCK event between SHIFT_DR and UPDATE_DR, and no TCK event between UPDATE_DR and the next CAPTURE_DR; the Xilinx BSCAN devices do not provide it.  Tested successfully with the adv_dbg_if on Virtex-4.
64
//
65
// Revision 1.2  2008/06/09 19:34:14  Nathan
66
// Syntax and functional fixes made after compiling each type of BSCAN module using Xilinx tools.
67
//
68
// Revision 1.1  2008/05/22 19:54:07  Nathan
69
// Initial version
70
//
71
 
72
 
73
`include "xilinx_internal_jtag_options.v"
74
 
75
// Note that the SPARTAN BSCAN controllers have more than one channel.
76
// This implementation always uses channel 1, this is not configurable.
77
// If you want to use another channel, then it is probably because you
78
// want to attach multiple devices to the BSCAN device, which means
79
// you'll be making changes to this file anyway.
80
// Virtex BSCAN devices are instantiated separately for each channel.
81
// To select something other than the default (1), change the parameter
82
// "virtex_jtag_chain".
83
 
84
 
85
module xilinx_internal_jtag (
86
        tck_o,
87 14 nyawn
        debug_tdo_i,
88
        tdi_o,
89 3 nyawn
        test_logic_reset_o,
90
        run_test_idle_o,
91
        shift_dr_o,
92
        capture_dr_o,
93
        pause_dr_o,
94
        update_dr_o,
95
        debug_select_o
96
);
97
 
98
// May be 1, 2, 3, or 4
99
// Only used for Virtex 4/5 devices
100
parameter virtex_jtag_chain = 1;
101
 
102 14 nyawn
input debug_tdo_i;
103 3 nyawn
output tck_o;
104 14 nyawn
output tdi_o;
105 3 nyawn
output test_logic_reset_o;
106
output run_test_idle_o;
107
output shift_dr_o;
108
output capture_dr_o;
109
output pause_dr_o;
110
output update_dr_o;
111
output debug_select_o;
112
 
113 14 nyawn
wire debug_tdo_i;
114 3 nyawn
wire tck_o;
115
wire drck;
116 14 nyawn
wire tdi_o;
117 3 nyawn
wire test_logic_reset_o;
118
wire run_test_idle_o;
119
wire shift_dr_o;
120
wire pause_dr_o;
121
wire update_dr_o;
122
wire debug_select_o;
123
 
124
 
125
 
126
`ifdef SPARTAN2
127
 
128
// Note that this version is missing three outputs.
129
// It also does not have a real TCK...DRCK1 is only active when USER1 is selected
130
// AND the TAP is in SHIFT_DR or CAPTURE_DR states...except there's no
131
// capture_dr output. 
132
 
133
reg capture_dr_o;
134
wire update_bscan;
135
reg update_out;
136
 
137
BSCAN_SPARTAN2 BSCAN_SPARTAN2_inst (
138
.DRCK1(drck), // Data register output for USER1 functions
139
.DRCK2(), // Data register output for USER2 functions
140
.RESET(test_logic_reset_o), // Reset output from TAP controller
141
.SEL1(debug_select_o), // USER1 active output
142
.SEL2(), // USER2 active output
143
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
144 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
145 3 nyawn
.UPDATE(update_bscan), // UPDATE output from TAP controller
146 14 nyawn
.TDO1(debug_tdo_i), // Data input for USER1 function
147 3 nyawn
.TDO2( 1'b0 ) // Data input for USER2 function
148
);
149
 
150
assign pause_dr_o = 1'b0;
151
assign run_test_idle_o = 1'b0;
152
assign capture_dr_o = 1'b0;
153
 
154
// We get one TCK during capture_dr state (low,high,SHIFT goes high on next DRCK high)
155
// On that negative edge, set capture_dr, and it will get registered on the rising
156
// edge.
157
always @ (negedge tck_o)
158
begin
159
        if(debug_select_o && !shift_dr_o)
160
                capture_dr_o <= 1'b1;
161
        else
162
                capture_dr_o <= 1'b0;
163
end
164
 
165
// The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
166
// The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
167
// This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
168
assign tck_o = (drck & debug_select_o & !update_bscan);
169
 
170
// This will hold the update_dr output so it can be registered on the rising edge
171
// of the clock created above.
172
always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
173
begin
174
        if(update_bscan) update_out <= 1'b1;
175
        else if(capture_dr_o) update_out <= 1'b0;
176
        else if(!debug_select_o) update_out <= 1'b0;
177
end
178
 
179
assign update_dr_o = update_out;
180
 
181
`else
182
`ifdef SPARTAN3
183
// Note that this version is missing two outputs.
184
// It also does not have a real TCK...DRCK1 is only active when USER1 is selected.
185
 
186
wire capture_dr_o;
187
wire update_bscan;
188
reg update_out;
189
 
190
BSCAN_SPARTAN3 BSCAN_SPARTAN3_inst (
191
.CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
192
.DRCK1(drck), // Data register output for USER1 functions
193
.DRCK2(), // Data register output for USER2 functions
194
.RESET(test_logic_reset_o), // Reset output from TAP controller
195
.SEL1(debug_select_o), // USER1 active output
196
.SEL2(), // USER2 active output
197
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
198 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
199 3 nyawn
.UPDATE(update_bscan), // UPDATE output from TAP controller
200 14 nyawn
.TDO1(debug_tdo_i), // Data input for USER1 function
201 3 nyawn
.TDO2(1'b0) // Data input for USER2 function
202
);
203
 
204
assign pause_dr_o = 1'b0;
205
assign run_test_idle_o = 1'b0;
206
 
207
// The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
208
// The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
209
// This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
210
assign tck_o = (drck & debug_select_o & !update_bscan);
211
 
212
// This will hold the update_dr output so it can be registered on the rising edge
213
// of the clock created above.
214
always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
215
begin
216
        if(update_bscan) update_out <= 1'b1;
217
        else if(capture_dr_o) update_out <= 1'b0;
218
        else if(!debug_select_o) update_out <= 1'b0;
219
end
220
 
221
assign update_dr_o = update_out;
222
 
223
`else
224
`ifdef SPARTAN3A
225
// Note that this version is missing two outputs.
226
// At least it has a real TCK.
227
 
228
wire capture_dr_o;
229
 
230
BSCAN_SPARTAN3A BSCAN_SPARTAN3A_inst (
231
.CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
232
.DRCK1(), // Data register output for USER1 functions
233
.DRCK2(), // Data register output for USER2 functions
234
.RESET(test_logic_reset_o), // Reset output from TAP controller
235
.SEL1(debug_select_o), // USER1 active output
236
.SEL2(), // USER2 active output
237
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
238
.TCK(tck_o), // TCK output from TAP controller
239 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
240 3 nyawn
.TMS(), // TMS output from TAP controller
241
.UPDATE(update_dr_o), // UPDATE output from TAP controller
242 14 nyawn
.TDO1(debug_tdo_i), // Data input for USER1 function
243 3 nyawn
.TDO2( 1'b0) // Data input for USER2 function
244
);
245
 
246
assign pause_dr_o = 1'b0;
247
assign run_test_idle_o = 1'b0;
248
 
249
`else
250
`ifdef VIRTEX
251
 
252
// Note that this version is missing three outputs.
253
// It also does not have a real TCK...DRCK1 is only active when USER1 is selected.
254
 
255
reg capture_dr_o;
256
wire update_bscan;
257
reg update_out;
258
 
259
BSCAN_VIRTEX BSCAN_VIRTEX_inst (
260
.DRCK1(drck), // Data register output for USER1 functions
261
.DRCK2(), // Data register output for USER2 functions
262
.RESET(test_logic_reset_o), // Reset output from TAP controller
263
.SEL1(debug_select_o), // USER1 active output
264
.SEL2(), // USER2 active output
265
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
266 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
267 3 nyawn
.UPDATE(update_bscan), // UPDATE output from TAP controller
268 14 nyawn
.TDO1(debug_tdo_i), // Data input for USER1 function
269 3 nyawn
.TDO2( 1'b0) // Data input for USER2 function
270
);
271
 
272
assign pause_dr_o = 1'b0;
273
assign run_test_idle_o = 1'b0;
274
 
275
// We get one TCK during capture_dr state (low,high,SHIFT goes high on next DRCK low)
276
// On that negative edge, set capture_dr, and it will get registered on the rising
277
// edge, then de-asserted on the same edge that SHIFT goes high.
278
always @ (negedge tck_o)
279
begin
280
        if(debug_select_o && !shift_dr_o)
281
                capture_dr_o <= 1'b1;
282
        else
283
                capture_dr_o <= 1'b0;
284
end
285
 
286
// The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
287
// The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
288
// This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
289
assign tck_o = (drck & debug_select_o & !update_bscan);
290
 
291
// This will hold the update_dr output so it can be registered on the rising edge
292
// of the clock created above.
293
always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
294
begin
295
        if(update_bscan) update_out <= 1'b1;
296
        else if(capture_dr_o) update_out <= 1'b0;
297
        else if(!debug_select_o) update_out <= 1'b0;
298
end
299
 
300
assign update_dr_o = update_out;
301
 
302
`else
303
`ifdef VIRTEX2
304
 
305
// Note that this version is missing two outputs.
306
// It also does not have a real TCK...DRCK1 is only active when USER1 is selected.
307
 
308
wire capture_dr_o;
309
wire update_bscan;
310
reg update_out;
311
 
312
BSCAN_VIRTEX2 BSCAN_VIRTEX2_inst (
313
.CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
314
.DRCK1(drck), // Data register output for USER1 functions
315
.DRCK2(), // Data register output for USER2 functions
316
.RESET(test_logic_reset_o), // Reset output from TAP controller
317
.SEL1(debug_select_o), // USER1 active output
318
.SEL2(), // USER2 active output
319
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
320 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
321 3 nyawn
.UPDATE(update_bscan), // UPDATE output from TAP controller
322 14 nyawn
.TDO1(debug_tdo_i), // Data input for USER1 function
323 3 nyawn
.TDO2( 1'b0 ) // Data input for USER2 function
324
);
325
 
326
assign pause_dr_o = 1'b0;
327
assign run_test_idle_o = 1'b0;
328
 
329
// The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
330
// The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
331
// This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
332
assign tck_o = (drck & debug_select_o & !update_bscan);
333
 
334
// This will hold the update_dr output so it can be registered on the rising edge
335
// of the clock created above.
336
always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
337
begin
338
        if(update_bscan) update_out <= 1'b1;
339
        else if(capture_dr_o) update_out <= 1'b0;
340
        else if(!debug_select_o) update_out <= 1'b0;
341
end
342
 
343
assign update_dr_o = update_out;
344
 
345
`else
346
`ifdef VIRTEX4
347
// Note that this version is missing two outputs.
348
// It also does not have a real TCK...DRCK is only active when USERn is selected.
349
 
350
wire capture_dr_o;
351
wire update_bscan;
352
reg update_out;
353
 
354
BSCAN_VIRTEX4 #(
355
.JTAG_CHAIN(virtex_jtag_chain)
356
) BSCAN_VIRTEX4_inst (
357
.CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
358
.DRCK(drck), // Data register output for USER function
359
.RESET(test_logic_reset_o), // Reset output from TAP controller
360
.SEL(debug_select_o), // USER active output
361
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
362 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
363 3 nyawn
.UPDATE(update_bscan), // UPDATE output from TAP controller
364 14 nyawn
.TDO( debug_tdo_i ) // Data input for USER function
365 3 nyawn
);
366
 
367
assign pause_dr_o = 1'b0;
368
assign run_test_idle_o = 1'b0;
369
 
370
// The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
371
// The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
372
// This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
373
assign tck_o = (drck & debug_select_o & !update_bscan);
374
 
375
// This will hold the update_dr output so it can be registered on the rising edge
376
// of the clock created above.
377
always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
378
begin
379
        if(update_bscan) update_out <= 1'b1;
380
        else if(capture_dr_o) update_out <= 1'b0;
381
        else if(!debug_select_o) update_out <= 1'b0;
382
end
383
 
384
assign update_dr_o = update_out;
385
 
386
`else
387
`ifdef VIRTEX5
388
// Note that this version is missing two outputs.
389
// It also does not have a real TCK...DRCK is only active when USERn is selected.
390
 
391
wire capture_dr_o;
392
wire update_bscan;
393
reg update_out;
394
 
395
BSCAN_VIRTEX5 #(
396
.JTAG_CHAIN(virtex_jtag_chain)
397
) BSCAN_VIRTEX5_inst (
398
.CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
399
.DRCK(drck), // Data register output for USER function
400
.RESET(test_logic_reset), // Reset output from TAP controller
401
.SEL(debug_select_o), // USER active output
402
.SHIFT(shift_dr_o), // SHIFT output from TAP controller
403 14 nyawn
.TDI(tdi_o), // TDI output from TAP controller
404 3 nyawn
.UPDATE(update_bscan), // UPDATE output from TAP controller
405 14 nyawn
.TDO(debug_tdo_i) // Data input for USER function
406 3 nyawn
);
407
 
408
assign pause_dr_o = 1'b0;
409
assign run_test_idle_o = 1'b0;
410
 
411
// The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
412
// The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
413
// This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
414
assign tck_o = (drck & debug_select_o & !update_bscan);
415
 
416
// This will hold the update_dr output so it can be registered on the rising edge
417
// of the clock created above.
418
always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
419
begin
420
        if(update_bscan) update_out <= 1'b1;
421
        else if(capture_dr_o) update_out <= 1'b0;
422
        else if(!debug_select_o) update_out <= 1'b0;
423
end
424
 
425
assign update_dr_o = update_out;
426
 
427
 
428
`endif
429
`endif
430
`endif
431
`endif
432
`endif
433
`endif
434
`endif
435
 
436
endmodule

powered by: WebSVN 2.1.0

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