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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [synthesys/] [targets/] [doc/] [Xilinx/] [xilinx_internal_jtag.v] - Blame information for rev 130

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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