1 |
18 |
ash_riple |
##**************************************************************
|
2 |
|
|
## Module : chipscope_vio_console.tcl
|
3 |
|
|
## Platform : Windows xp sp2
|
4 |
|
|
## Author : Bibo Yang (ash_riple@hotmail.com)
|
5 |
|
|
## Organization : www.opencores.org
|
6 |
20 |
ash_riple |
## Revision : 2.5
|
7 |
|
|
## Date : 2014/02/08
|
8 |
18 |
ash_riple |
## Description : Tcl/Tk GUI for the up_monitor
|
9 |
|
|
##**************************************************************
|
10 |
|
|
|
11 |
|
|
############################
|
12 |
|
|
## include the XILINX procs
|
13 |
|
|
############################
|
14 |
|
|
# Get the Cse DLL's and globals
|
15 |
|
|
if {[info exists env(XIL_CSE_TCL)]} {
|
16 |
|
|
if {[string length $env(XIL_CSE_TCL)] > 0} {
|
17 |
|
|
puts "Sourcing from XIL_CSE_TCL: $env(XIL_CSE_TCL) ..."
|
18 |
|
|
source $env(XIL_CSE_TCL)/csejtag.tcl
|
19 |
|
|
source $env(XIL_CSE_TCL)/csefpga.tcl
|
20 |
|
|
source $env(XIL_CSE_TCL)/csecore.tcl
|
21 |
|
|
source $env(XIL_CSE_TCL)/csevio.tcl
|
22 |
|
|
} else {
|
23 |
|
|
puts "Sourcing from XILINX: $env(XILINX)/cse/tcl ..."
|
24 |
|
|
source $env(XILINX)/cse/tcl/csejtag.tcl
|
25 |
|
|
source $env(XILINX)/cse/tcl/csefpga.tcl
|
26 |
|
|
source $env(XILINX)/cse/tcl/csecore.tcl
|
27 |
|
|
source $env(XILINX)/cse/tcl/csevio.tcl
|
28 |
|
|
}
|
29 |
|
|
} else {
|
30 |
|
|
puts "Sourcing from XILINX: $env(XILINX)/cse/tcl ..."
|
31 |
|
|
source $env(XILINX)/cse/tcl/csejtag.tcl
|
32 |
|
|
source $env(XILINX)/cse/tcl/csefpga.tcl
|
33 |
|
|
source $env(XILINX)/cse/tcl/csecore.tcl
|
34 |
|
|
source $env(XILINX)/cse/tcl/csevio.tcl
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
namespace import ::chipscope::*
|
38 |
|
|
|
39 |
|
|
###########################
|
40 |
|
|
## define cable parameters
|
41 |
|
|
###########################
|
42 |
|
|
# Create global variables
|
43 |
|
|
set ILA_STATUS_WORD_BIT_LEN 512
|
44 |
|
|
|
45 |
|
|
# Parallel IV Cable
|
46 |
|
|
set PARALLEL_CABLE_ARGS [list "port=LPT1" "frequency=2500000"]
|
47 |
|
|
# "frequency=5000000 | 2500000 | 1250000 | 625000 | 200000"
|
48 |
|
|
|
49 |
|
|
# Platform USB Cable
|
50 |
|
|
set PLATFORM_USB_CABLE_ARGS [list "port=USB2" "frequency=3000000"]
|
51 |
|
|
# frequency="12000000 | 6000000 | 3000000 | 1500000 | 750000"
|
52 |
|
|
|
53 |
|
|
# Digilent Cable
|
54 |
|
|
# Digilent Cables have default arguments, if there is only one cable connected it will automatically connect to it.
|
55 |
|
|
set DIGILENT_CABLE_ARGS {}
|
56 |
|
|
|
57 |
|
|
###########################
|
58 |
|
|
## setup the chain
|
59 |
|
|
###########################
|
60 |
|
|
proc scan_chain {} {
|
61 |
|
|
global PLATFORM_USB_CABLE_ARGS
|
62 |
|
|
global CSEJTAG_TARGET_PLATFORMUSB
|
63 |
|
|
global PARALLEL_CABLE_ARGS
|
64 |
|
|
global CSEJTAG_TARGET_PARALLEL
|
65 |
|
|
global DIGILENT_CABLE_ARGS
|
66 |
|
|
global CSEJTAG_TARGET_DIGILENT
|
67 |
|
|
global CSEJTAG_SCAN_DEFAULT
|
68 |
|
|
global CSEJTAG_LOCKED_ME
|
69 |
|
|
global CSEJTAG_TEST_LOGIC_RESET
|
70 |
|
|
global CSEJTAG_SHIFT_READ
|
71 |
|
|
global CSEJTAG_RUN_TEST_IDLE
|
72 |
|
|
|
73 |
|
|
global log
|
74 |
|
|
$log insert end "JTAG Chain Scanning report:\n"
|
75 |
|
|
$log insert end "****************************************\n"
|
76 |
|
|
global blaster_cables
|
77 |
|
|
set blaster_cables [list -usb -par -dig]
|
78 |
|
|
set cable_num 0
|
79 |
|
|
foreach blaster_cable $blaster_cables {
|
80 |
|
|
incr cable_num
|
81 |
|
|
if {[string equal "-usb" $blaster_cable]} {
|
82 |
|
|
set blaster_cable_name "Platform USB Cable"
|
83 |
|
|
} elseif {[string equal "-par" $blaster_cable]} {
|
84 |
|
|
set blaster_cable_name "Parallel Cable"
|
85 |
|
|
} elseif {[string equal "-dig" $blaster_cable]} {
|
86 |
|
|
set blaster_cable_name "Digilent Cable"
|
87 |
|
|
}
|
88 |
|
|
$log insert end "@$cable_num: $blaster_cable_name\n"
|
89 |
|
|
}
|
90 |
|
|
$log insert end "\n****************************************\n"
|
91 |
|
|
|
92 |
|
|
global device_list
|
93 |
|
|
set device_list ""
|
94 |
|
|
foreach blaster_cable $blaster_cables {
|
95 |
|
|
if {[string equal "-usb" $blaster_cable]} {
|
96 |
|
|
set blaster_cable_name "Platform USB Cable"
|
97 |
|
|
set CABLE_NAME $CSEJTAG_TARGET_PLATFORMUSB
|
98 |
|
|
set CABLE_ARGS $PLATFORM_USB_CABLE_ARGS
|
99 |
|
|
} elseif {[string equal "-par" $blaster_cable]} {
|
100 |
|
|
set blaster_cable_name "Parallel Cable"
|
101 |
|
|
set CABLE_NAME $CSEJTAG_TARGET_PARALLEL
|
102 |
|
|
set CABLE_ARGS $PARALLEL_CABLE_ARGS
|
103 |
|
|
} elseif {[string equal "-dig" $blaster_cable]} {
|
104 |
|
|
set blaster_cable_name "Digilent Cable"
|
105 |
|
|
set CABLE_NAME $CSEJTAG_TARGET_DIGILENT
|
106 |
|
|
set CABLE_ARGS $DIGILENT_CABLE_ARGS
|
107 |
|
|
}
|
108 |
|
|
$log insert end "$blaster_cable_name:\n"
|
109 |
|
|
lappend device_list $blaster_cable_name
|
110 |
|
|
|
111 |
|
|
if {[catch {
|
112 |
|
|
# start chipscope session
|
113 |
|
|
set handle [csejtag_session create 0 $blaster_cable]
|
114 |
|
|
# open cable
|
115 |
|
|
csejtag_target open $handle $CABLE_NAME 0 $CABLE_ARGS
|
116 |
|
|
# lock cable
|
117 |
|
|
set cablelock [csejtag_target lock $handle 5000]
|
118 |
|
|
|
119 |
|
|
csejtag_tap autodetect_chain $handle $CSEJTAG_SCAN_DEFAULT
|
120 |
|
|
set deviceCount [csejtag_tap get_device_count $handle]
|
121 |
|
|
csejtag_tap navigate $handle $CSEJTAG_TEST_LOGIC_RESET 0 0
|
122 |
|
|
for {set deviceIndex 0} {$deviceIndex < $deviceCount} {incr deviceIndex} {
|
123 |
|
|
set idcodeBuffer [csejtag_tap get_device_idcode $handle $deviceIndex]
|
124 |
|
|
set deviceName [csejtag_db get_device_name_for_idcode $handle $idcodeBuffer]
|
125 |
|
|
set idcode [format "%x" [binaryStringToInt $idcodeBuffer]]
|
126 |
|
|
$log insert end "@[expr $deviceIndex+1]: $deviceName (0x$idcode)\n"
|
127 |
|
|
lappend device_list $deviceName
|
128 |
|
|
}
|
129 |
|
|
|
130 |
|
|
#altera #lappend device_list $blaster_cable
|
131 |
|
|
#if [catch {get_device_names -hardware_name $blaster_cable} error_msg] {
|
132 |
|
|
# $log insert end $error_msg
|
133 |
|
|
# lappend device_list $error_msg
|
134 |
|
|
#} else {
|
135 |
|
|
# foreach test_device [get_device_names -hardware_name $blaster_cable] {
|
136 |
|
|
# $log insert end "$test_device\n"
|
137 |
|
|
# }
|
138 |
|
|
# lappend device_list [get_device_names -hardware_name $blaster_cable]
|
139 |
|
|
#}
|
140 |
|
|
|
141 |
|
|
# unlock cable
|
142 |
|
|
csejtag_target unlock $handle
|
143 |
|
|
# close device
|
144 |
|
|
csejtag_target close $handle
|
145 |
|
|
# end chipscope session
|
146 |
|
|
csejtag_session destroy $handle
|
147 |
|
|
} result]} {
|
148 |
|
|
lappend device_list $result
|
149 |
|
|
$log insert end "$result\n"
|
150 |
|
|
}
|
151 |
|
|
}
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
proc open_jtag_device {{blaster_cable "-dig"}} {
|
155 |
|
|
global handle
|
156 |
|
|
global CABLE_NAME
|
157 |
|
|
global CABLE_ARGS
|
158 |
|
|
global CSEJTAG_SCAN_DEFAULT
|
159 |
|
|
|
160 |
|
|
if {[info exist handle]} { close_jtag_device }
|
161 |
|
|
set handle [csejtag_session create 0 $blaster_cable]
|
162 |
|
|
csejtag_target open $handle $CABLE_NAME 0 $CABLE_ARGS
|
163 |
|
|
set cablelock [csejtag_target lock $handle 5000]
|
164 |
|
|
csejtag_tap autodetect_chain $handle $CSEJTAG_SCAN_DEFAULT
|
165 |
|
|
|
166 |
|
|
#altera #open_device -hardware_name $test_cable -device_name $test_device
|
167 |
|
|
## Retrieve device id code.
|
168 |
|
|
#device_lock -timeout 5
|
169 |
|
|
#device_ir_shift -ir_value 6 -no_captured_ir_value
|
170 |
|
|
#set idcode "0x[device_dr_shift -length 32 -value_in_hex]"
|
171 |
|
|
#device_unlock
|
172 |
|
|
return 0
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
proc close_jtag_device {} {
|
176 |
|
|
global handle
|
177 |
|
|
if {[info exist handle]} {
|
178 |
|
|
catch {csejtag_target unlock $handle}
|
179 |
|
|
catch {csejtag_target close $handle}
|
180 |
|
|
catch {csejtag_session destroy $handle}
|
181 |
|
|
unset handle
|
182 |
|
|
}
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
proc select_device {{cableNum 3} {deviceNum 2}} {
|
186 |
|
|
global log
|
187 |
|
|
global device_list
|
188 |
|
|
global blaster_cables
|
189 |
|
|
global handle
|
190 |
|
|
global PLATFORM_USB_CABLE_ARGS
|
191 |
|
|
global CSEJTAG_TARGET_PLATFORMUSB
|
192 |
|
|
global PARALLEL_CABLE_ARGS
|
193 |
|
|
global CSEJTAG_TARGET_PARALLEL
|
194 |
|
|
global DIGILENT_CABLE_ARGS
|
195 |
|
|
global CSEJTAG_TARGET_DIGILENT
|
196 |
|
|
global CABLE_NAME
|
197 |
|
|
global CABLE_ARGS
|
198 |
|
|
|
199 |
|
|
$log insert end "\n****************************************\n"
|
200 |
|
|
set test_cable [lindex $device_list [expr 2*$cableNum-2]]
|
201 |
|
|
$log insert end "Selected Cable : $test_cable\n"
|
202 |
|
|
set test_device [lindex $device_list [expr 2*$cableNum-2+($deviceNum)]]
|
203 |
|
|
$log insert end "Selected Device: $test_device\n"
|
204 |
|
|
|
205 |
|
|
set blaster_cable [lindex $blaster_cables [expr $cableNum-1]]
|
206 |
|
|
if {[string equal "-usb" $blaster_cable]} {
|
207 |
|
|
set blaster_cable_name "Platform USB Cable"
|
208 |
|
|
set CABLE_NAME $CSEJTAG_TARGET_PLATFORMUSB
|
209 |
|
|
set CABLE_ARGS $PLATFORM_USB_CABLE_ARGS
|
210 |
|
|
} elseif {[string equal "-par" $blaster_cable]} {
|
211 |
|
|
set blaster_cable_name "Parallel Cable"
|
212 |
|
|
set CABLE_NAME $CSEJTAG_TARGET_PARALLEL
|
213 |
|
|
set CABLE_ARGS $PARALLEL_CABLE_ARGS
|
214 |
|
|
} elseif {[string equal "-dig" $blaster_cable]} {
|
215 |
|
|
set blaster_cable_name "Digilent Cable"
|
216 |
|
|
set CABLE_NAME $CSEJTAG_TARGET_DIGILENT
|
217 |
|
|
set CABLE_ARGS $DIGILENT_CABLE_ARGS
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
open_jtag_device $blaster_cable
|
221 |
|
|
|
222 |
|
|
global deviceIndex
|
223 |
|
|
set deviceIndex [expr $deviceNum-1]
|
224 |
|
|
|
225 |
|
|
#set test_cable [lindex $device_list [expr 2*$cableNum-2]]
|
226 |
|
|
#$log insert end "Selected Cable : $test_cable\n"
|
227 |
|
|
#set test_device [lindex [lindex $device_list [expr 2*$cableNum-1]] [expr $deviceNum-1]]
|
228 |
|
|
#$log insert end "Selected Device: $test_device\n"
|
229 |
|
|
#altera #set jtagIdCode [open_jtag_device $test_cable $test_device]
|
230 |
|
|
#$log insert end "Device ID code : $jtagIdCode\n"
|
231 |
|
|
|
232 |
|
|
reset_fifo
|
233 |
|
|
query_usedw
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
########################
|
237 |
|
|
## operate the VIO core
|
238 |
|
|
########################
|
239 |
|
|
proc reset_fifo {} {
|
240 |
|
|
global handle
|
241 |
|
|
global deviceIndex
|
242 |
|
|
global CSEVIO_SYNC_INPUT
|
243 |
|
|
global CSEVIO_SYNC_OUTPUT
|
244 |
|
|
|
245 |
|
|
set userRegNumber 1
|
246 |
|
|
set coreIndex 0
|
247 |
|
|
set coreRef [list $deviceIndex $userRegNumber $coreIndex]
|
248 |
|
|
|
249 |
|
|
csevio_init_core $handle $coreRef
|
250 |
|
|
csevio_define_signal $handle $coreRef "reset" $CSEVIO_SYNC_OUTPUT 1
|
251 |
|
|
set outputTclArray(reset) 1
|
252 |
|
|
csevio_write_values $handle $coreRef outputTclArray
|
253 |
|
|
set outputTclArray(reset) 0
|
254 |
|
|
csevio_write_values $handle $coreRef outputTclArray
|
255 |
|
|
csevio_terminate_core $handle $coreRef
|
256 |
|
|
|
257 |
|
|
return 0
|
258 |
|
|
}
|
259 |
|
|
|
260 |
|
|
proc query_usedw {} {
|
261 |
|
|
global fifoUsedw
|
262 |
|
|
global handle
|
263 |
|
|
global deviceIndex
|
264 |
|
|
global CSEVIO_SYNC_INPUT
|
265 |
|
|
global CSEVIO_SYNC_OUTPUT
|
266 |
|
|
|
267 |
|
|
set userRegNumber 1
|
268 |
|
|
set coreIndex 0
|
269 |
|
|
set coreRef [list $deviceIndex $userRegNumber $coreIndex]
|
270 |
|
|
|
271 |
|
|
csevio_init_core $handle $coreRef
|
272 |
20 |
ash_riple |
csevio_define_bus $handle $coreRef "usedWord" $CSEVIO_SYNC_INPUT [list 98 99 100 101 102 103 104 105 106 107]
|
273 |
18 |
ash_riple |
csevio_read_values $handle $coreRef inputTclArray
|
274 |
|
|
set usedw $inputTclArray(usedWord)
|
275 |
|
|
csevio_terminate_core $handle $coreRef
|
276 |
|
|
|
277 |
|
|
set tmp 0x
|
278 |
|
|
append tmp $usedw
|
279 |
|
|
set usedw [format "%i" $tmp]
|
280 |
|
|
set fifoUsedw $usedw
|
281 |
|
|
return $usedw
|
282 |
|
|
}
|
283 |
|
|
|
284 |
|
|
proc read_fifo {} {
|
285 |
|
|
global handle
|
286 |
|
|
global deviceIndex
|
287 |
|
|
global CSEVIO_SYNC_INPUT
|
288 |
|
|
global CSEVIO_SYNC_OUTPUT
|
289 |
|
|
|
290 |
|
|
set userRegNumber 1
|
291 |
|
|
set coreIndex 0
|
292 |
|
|
set coreRef [list $deviceIndex $userRegNumber $coreIndex]
|
293 |
|
|
|
294 |
|
|
csevio_init_core $handle $coreRef
|
295 |
|
|
csevio_define_signal $handle $coreRef "readen" $CSEVIO_SYNC_OUTPUT 0
|
296 |
|
|
set outputTclArray(readen) 1
|
297 |
|
|
csevio_write_values $handle $coreRef outputTclArray
|
298 |
|
|
set outputTclArray(readen) 0
|
299 |
|
|
csevio_write_values $handle $coreRef outputTclArray
|
300 |
|
|
csevio_terminate_core $handle $coreRef
|
301 |
|
|
|
302 |
|
|
csevio_init_core $handle $coreRef
|
303 |
|
|
csevio_define_bus $handle $coreRef "fifoContent" $CSEVIO_SYNC_INPUT [list 0 1 2 3 4 5 6 7 8 9\
|
304 |
|
|
10 11 12 13 14 15 16 17 18 19\
|
305 |
|
|
20 21 22 23 24 25 26 27 28 29\
|
306 |
|
|
30 31 32 33 34 35 36 37 38 39\
|
307 |
|
|
40 41 42 43 44 45 46 47 48 49\
|
308 |
|
|
50 51 52 53 54 55 56 57 58 59\
|
309 |
|
|
60 61 62 63 64 65 66 67 68 69\
|
310 |
|
|
70 71 72 73 74 75 76 77 78 79\
|
311 |
20 |
ash_riple |
80 81 82 83 84 85 86 87 88 89\
|
312 |
|
|
90 91 92 93 94 95 96 97]
|
313 |
18 |
ash_riple |
csevio_read_values $handle $coreRef inputTclArray
|
314 |
|
|
set fifo_data $inputTclArray(fifoContent)
|
315 |
|
|
csevio_terminate_core $handle $coreRef
|
316 |
|
|
|
317 |
|
|
return $fifo_data
|
318 |
|
|
}
|
319 |
|
|
|
320 |
|
|
proc config_addr {{mask 0100000000} {mask_id 1}} {
|
321 |
|
|
global log
|
322 |
|
|
global handle
|
323 |
|
|
global deviceIndex
|
324 |
|
|
global CSEVIO_SYNC_INPUT
|
325 |
|
|
global CSEVIO_SYNC_OUTPUT
|
326 |
|
|
|
327 |
|
|
set userRegNumber 1
|
328 |
|
|
set coreIndex 1
|
329 |
|
|
set coreRef [list $deviceIndex $userRegNumber $coreIndex]
|
330 |
|
|
|
331 |
|
|
set mask_leng [string length $mask]
|
332 |
|
|
if {$mask_leng!=10} {
|
333 |
|
|
$log insert end "\nError: Wrong address mask length @$mask_id: [expr $mask_leng-2]. Expects: 8.\n"
|
334 |
|
|
|
335 |
|
|
} else {
|
336 |
|
|
csevio_init_core $handle $coreRef
|
337 |
|
|
csevio_define_bus $handle $coreRef "addr" $CSEVIO_SYNC_OUTPUT [list 0 1 2 3 4 5 6 7 8 9\
|
338 |
|
|
10 11 12 13 14 15 16 17 18 19\
|
339 |
|
|
20 21 22 23 24 25 26 27 28 29\
|
340 |
|
|
30 31 32 33 34 35 36 37 38 39]
|
341 |
|
|
set outputTclArray(addr) $mask
|
342 |
|
|
csevio_write_values $handle $coreRef outputTclArray
|
343 |
|
|
csevio_terminate_core $handle $coreRef
|
344 |
|
|
}
|
345 |
|
|
return 0
|
346 |
|
|
}
|
347 |
|
|
|
348 |
|
|
proc config_trig {{trig 00000000000000} {pnum 000}} {
|
349 |
|
|
global log
|
350 |
|
|
global handle
|
351 |
|
|
global deviceIndex
|
352 |
|
|
global CSEVIO_SYNC_INPUT
|
353 |
|
|
global CSEVIO_SYNC_OUTPUT
|
354 |
|
|
|
355 |
|
|
set userRegNumber 1
|
356 |
|
|
set coreIndex 2
|
357 |
|
|
set coreRef [list $deviceIndex $userRegNumber $coreIndex]
|
358 |
|
|
|
359 |
|
|
set trig_leng [string length $trig]
|
360 |
20 |
ash_riple |
if {$trig_leng!=18} {
|
361 |
|
|
$log insert end "\nError: Wrong trigger condition length: [expr $trig_leng-2]. Expects: 8+8.\n"
|
362 |
18 |
ash_riple |
} else {
|
363 |
|
|
if {[format "%d" 0x$pnum]>=511} {
|
364 |
|
|
$log insert end "\nError: Wrong trigger pre-capture value: [format "%d" 0x$pnum]. Expects: 0~510.\n"
|
365 |
|
|
} else {
|
366 |
|
|
csevio_init_core $handle $coreRef
|
367 |
|
|
csevio_define_bus $handle $coreRef "trig" $CSEVIO_SYNC_OUTPUT [list 0 1 2 3 4 5 6 7 8 9\
|
368 |
|
|
10 11 12 13 14 15 16 17 18 19\
|
369 |
|
|
20 21 22 23 24 25 26 27 28 29\
|
370 |
|
|
30 31 32 33 34 35 36 37 38 39\
|
371 |
|
|
40 41 42 43 44 45 46 47 48 49\
|
372 |
|
|
50 51 52 53 54 55 56 57 58 59\
|
373 |
20 |
ash_riple |
60 61 62 63 64 65 66 67 68 69\
|
374 |
|
|
70 71 72 73 74 75 76 77 78 79\
|
375 |
|
|
80 81]
|
376 |
18 |
ash_riple |
set outputTclArray(trig) [append pnum $trig]
|
377 |
|
|
csevio_write_values $handle $coreRef outputTclArray
|
378 |
|
|
csevio_terminate_core $handle $coreRef
|
379 |
|
|
}
|
380 |
|
|
}
|
381 |
|
|
return 0
|
382 |
|
|
}
|
383 |
|
|
|
384 |
|
|
##########################
|
385 |
|
|
## upper level operations
|
386 |
|
|
##########################
|
387 |
|
|
proc updateAddrConfig {} {
|
388 |
|
|
global address_span1
|
389 |
|
|
global address_span2
|
390 |
|
|
global address_span3
|
391 |
|
|
global address_span4
|
392 |
|
|
global address_span5
|
393 |
|
|
global address_span6
|
394 |
|
|
global address_span7
|
395 |
|
|
global address_span8
|
396 |
|
|
global address_span9
|
397 |
|
|
global address_span10
|
398 |
|
|
global address_span11
|
399 |
|
|
global address_span12
|
400 |
|
|
global address_span13
|
401 |
|
|
global address_span14
|
402 |
|
|
global address_span15
|
403 |
|
|
global address_span16
|
404 |
|
|
global address_span_en1
|
405 |
|
|
global address_span_en2
|
406 |
|
|
global address_span_en3
|
407 |
|
|
global address_span_en4
|
408 |
|
|
global address_span_en5
|
409 |
|
|
global address_span_en6
|
410 |
|
|
global address_span_en7
|
411 |
|
|
global address_span_en8
|
412 |
|
|
global address_span_en9
|
413 |
|
|
global address_span_en10
|
414 |
|
|
global address_span_en11
|
415 |
|
|
global address_span_en12
|
416 |
|
|
global address_span_en13
|
417 |
|
|
global address_span_en14
|
418 |
|
|
global address_span_en15
|
419 |
|
|
global address_span_en16
|
420 |
|
|
global addr_wren
|
421 |
|
|
global addr_rden
|
422 |
|
|
for {set i 1} {$i<=16} {incr i} {
|
423 |
|
|
set mask [format "%1X" [expr $i-1]]
|
424 |
|
|
append mask [format "%1X" [expr $addr_wren*8+$addr_rden*4+[set address_span_en$i]]]
|
425 |
|
|
append mask [set address_span$i]
|
426 |
|
|
config_addr $mask $i
|
427 |
|
|
}
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
proc initAddrConfig {} {
|
431 |
|
|
global log
|
432 |
|
|
global address_span1
|
433 |
|
|
global address_span2
|
434 |
|
|
global address_span3
|
435 |
|
|
global address_span4
|
436 |
|
|
global address_span5
|
437 |
|
|
global address_span6
|
438 |
|
|
global address_span7
|
439 |
|
|
global address_span8
|
440 |
|
|
global address_span9
|
441 |
|
|
global address_span10
|
442 |
|
|
global address_span11
|
443 |
|
|
global address_span12
|
444 |
|
|
global address_span13
|
445 |
|
|
global address_span14
|
446 |
|
|
global address_span15
|
447 |
|
|
global address_span16
|
448 |
20 |
ash_riple |
for {set i 1} {$i<=8} {set i [expr $i+2]} {
|
449 |
18 |
ash_riple |
if {[set address_span$i]==""} {
|
450 |
20 |
ash_riple |
set address_span$i fffffffc
|
451 |
18 |
ash_riple |
}
|
452 |
20 |
ash_riple |
}
|
453 |
|
|
for {set i 2} {$i<=8} {set i [expr $i+2]} {
|
454 |
|
|
if {[set address_span$i]==""} {
|
455 |
|
|
set address_span$i 00000000
|
456 |
18 |
ash_riple |
}
|
457 |
20 |
ash_riple |
}
|
458 |
18 |
ash_riple |
for {set i 9} {$i<=16} {incr i} {
|
459 |
|
|
if {[set address_span$i]==""} {
|
460 |
20 |
ash_riple |
set address_span$i ffffffff
|
461 |
18 |
ash_riple |
}
|
462 |
20 |
ash_riple |
}
|
463 |
18 |
ash_riple |
}
|
464 |
|
|
|
465 |
|
|
proc initTrigConfig {} {
|
466 |
|
|
global triggerAddr
|
467 |
|
|
global triggerData
|
468 |
|
|
global triggerPnum
|
469 |
|
|
if {[set triggerAddr]==""} {
|
470 |
20 |
ash_riple |
set triggerAddr 00000000
|
471 |
18 |
ash_riple |
}
|
472 |
|
|
if {[set triggerData]==""} {
|
473 |
|
|
set triggerData a5a5a5a5
|
474 |
|
|
}
|
475 |
|
|
if {[set triggerPnum]==""} {
|
476 |
|
|
set triggerPnum 0
|
477 |
|
|
}
|
478 |
|
|
}
|
479 |
|
|
|
480 |
|
|
proc updateTrigger {{trigCmd 0}} {
|
481 |
|
|
global triggerAddr
|
482 |
|
|
global triggerData
|
483 |
|
|
global triggerPnum
|
484 |
|
|
global trig_wren
|
485 |
|
|
global trig_rden
|
486 |
|
|
global trig_aden
|
487 |
|
|
global trig_daen
|
488 |
|
|
set triggerValue [format "%1X" [expr $trig_aden*8+$trig_daen*4+0]]
|
489 |
|
|
append triggerValue [format "%1X" [expr $trig_wren*8+$trig_rden*4+$trigCmd]]
|
490 |
|
|
append triggerValue $triggerAddr
|
491 |
|
|
append triggerValue $triggerData
|
492 |
|
|
config_trig $triggerValue [format "%03X" $triggerPnum]
|
493 |
|
|
}
|
494 |
|
|
|
495 |
|
|
proc startTrigger {} {
|
496 |
|
|
global trig_wren
|
497 |
|
|
global trig_rden
|
498 |
|
|
global trig_aden
|
499 |
|
|
global trig_daen
|
500 |
|
|
global log
|
501 |
|
|
if {[expr $trig_wren+$trig_rden]==2} {
|
502 |
|
|
$log insert end "\nWarning: @WR & @RD, unreachable trigger condition.\n"
|
503 |
|
|
}
|
504 |
|
|
set trigEnable [expr $trig_wren+$trig_rden+$trig_aden+$trig_daen]
|
505 |
|
|
if {$trigEnable>0} {
|
506 |
|
|
updateTrigger 2
|
507 |
|
|
reset_fifo
|
508 |
|
|
query_usedw
|
509 |
|
|
updateTrigger 3
|
510 |
|
|
} else {
|
511 |
|
|
updateTrigger 0
|
512 |
|
|
}
|
513 |
|
|
}
|
514 |
|
|
|
515 |
|
|
proc reset_fifo_ptr {} {
|
516 |
|
|
reset_fifo
|
517 |
|
|
query_usedw
|
518 |
|
|
}
|
519 |
|
|
|
520 |
|
|
proc query_fifo_usedw {} {
|
521 |
|
|
query_usedw
|
522 |
|
|
}
|
523 |
|
|
|
524 |
|
|
proc read_fifo_content {} {
|
525 |
|
|
global log
|
526 |
|
|
global fifoUsedw
|
527 |
|
|
$log insert end "\n****************************************\n"
|
528 |
|
|
for {set i 0} {$i<$fifoUsedw} {incr i} {
|
529 |
|
|
set fifoContent [read_fifo]
|
530 |
|
|
set ok_trig [expr [format "%d" 0x[string index $fifoContent 0]]/2]
|
531 |
|
|
set wr_cptr [expr [format "%d" 0x[string index $fifoContent 0]]%2]
|
532 |
|
|
set tm_cptr [format "%d" 0x[string range $fifoContent 1 8]]
|
533 |
20 |
ash_riple |
set ad_cptr [string range $fifoContent 9 16]
|
534 |
|
|
set da_cptr [string range $fifoContent 17 24]
|
535 |
18 |
ash_riple |
if $ok_trig {
|
536 |
|
|
$log insert end "@@@@@@@@@@@@@@@@@@@@\n"
|
537 |
|
|
}
|
538 |
|
|
if $wr_cptr {
|
539 |
20 |
ash_riple |
$log insert end "wr 0x$ad_cptr 0x$da_cptr @$tm_cptr\n"
|
540 |
18 |
ash_riple |
} else {
|
541 |
20 |
ash_riple |
$log insert end "rd 0x$ad_cptr 0x$da_cptr @$tm_cptr\n"
|
542 |
18 |
ash_riple |
}
|
543 |
|
|
}
|
544 |
|
|
query_usedw
|
545 |
|
|
}
|
546 |
|
|
|
547 |
|
|
proc clear_log {} {
|
548 |
|
|
global log
|
549 |
|
|
$log delete insert end
|
550 |
|
|
}
|
551 |
|
|
|
552 |
|
|
proc quit {} {
|
553 |
|
|
global exit_console
|
554 |
|
|
close_jtag_device
|
555 |
|
|
destroy .mainframe
|
556 |
|
|
destroy .
|
557 |
|
|
set exit_console 1
|
558 |
|
|
}
|
559 |
|
|
|
560 |
|
|
##############################
|
561 |
|
|
## Miscellence functions
|
562 |
|
|
##############################
|
563 |
|
|
proc binaryStringToInt {binarystring} {
|
564 |
|
|
set len [string length $binarystring]
|
565 |
|
|
set retval 0
|
566 |
|
|
for {set i 0} {$i < $len} {incr i} {
|
567 |
|
|
set retval [expr $retval << 1]
|
568 |
|
|
if {[string index $binarystring $i] == "1"} {
|
569 |
|
|
set retval [expr $retval | 1]
|
570 |
|
|
}
|
571 |
|
|
}
|
572 |
|
|
return $retval
|
573 |
|
|
}
|
574 |
|
|
|
575 |
|
|
##############################
|
576 |
|
|
## Main to setup GUI
|
577 |
|
|
##############################
|
578 |
|
|
# set the varialble to keep Tk GUI
|
579 |
|
|
set exit_console 0
|
580 |
|
|
|
581 |
|
|
# set the main window
|
582 |
|
|
wm withdraw .
|
583 |
|
|
toplevel .mainframe
|
584 |
|
|
wm title .mainframe "www.OpenCores.org: uP Transaction Monitor"
|
585 |
|
|
pack propagate .mainframe true
|
586 |
|
|
|
587 |
|
|
# set the www.OpenCores.org logo
|
588 |
|
|
frame .mainframe.fig -bg white
|
589 |
|
|
pack .mainframe.fig -expand true -fill both
|
590 |
19 |
ash_riple |
image create photo logo -format gif -file "../common/OpenCores.gif"
|
591 |
18 |
ash_riple |
label .mainframe.fig.logo -image logo -bg white
|
592 |
|
|
pack .mainframe.fig.logo
|
593 |
|
|
|
594 |
|
|
# set the JTAG utility
|
595 |
|
|
frame .mainframe.jtag -relief groove -borderwidth 5
|
596 |
|
|
pack .mainframe.jtag
|
597 |
|
|
button .mainframe.jtag.scan -text {Scan JTAG Chain} -command {scan_chain}
|
598 |
|
|
button .mainframe.jtag.select -text {Select JTAG Device :} -command {select_device $cableNum $deviceNum}
|
599 |
|
|
button .mainframe.jtag.deselect -text {DeSelect JTAG Device} -command {close_jtag_device}
|
600 |
|
|
label .mainframe.jtag.cable -text {Cable @}
|
601 |
|
|
label .mainframe.jtag.devic -text {Device @}
|
602 |
|
|
entry .mainframe.jtag.cable_num -textvariable cableNum -width 5
|
603 |
|
|
entry .mainframe.jtag.devic_num -textvariable deviceNum -width 5
|
604 |
|
|
pack .mainframe.jtag.scan .mainframe.jtag.select \
|
605 |
|
|
.mainframe.jtag.cable .mainframe.jtag.cable_num \
|
606 |
|
|
.mainframe.jtag.devic .mainframe.jtag.devic_num \
|
607 |
|
|
.mainframe.jtag.deselect \
|
608 |
|
|
-side left -ipadx 0
|
609 |
|
|
|
610 |
|
|
# set the inclusive address entries
|
611 |
|
|
frame .mainframe.f1 -relief groove -borderwidth 5
|
612 |
|
|
pack .mainframe.f1
|
613 |
|
|
label .mainframe.f1.incl_addr -text {Inclusive Addr:}
|
614 |
|
|
entry .mainframe.f1.address_span1 -textvariable address_span1 -width 8
|
615 |
|
|
entry .mainframe.f1.address_span2 -textvariable address_span2 -width 8
|
616 |
|
|
entry .mainframe.f1.address_span3 -textvariable address_span3 -width 8
|
617 |
|
|
entry .mainframe.f1.address_span4 -textvariable address_span4 -width 8
|
618 |
|
|
entry .mainframe.f1.address_span5 -textvariable address_span5 -width 8
|
619 |
|
|
entry .mainframe.f1.address_span6 -textvariable address_span6 -width 8
|
620 |
|
|
entry .mainframe.f1.address_span7 -textvariable address_span7 -width 8
|
621 |
|
|
entry .mainframe.f1.address_span8 -textvariable address_span8 -width 8
|
622 |
|
|
checkbutton .mainframe.f1.address_span_en1 -variable address_span_en1
|
623 |
|
|
checkbutton .mainframe.f1.address_span_en2 -variable address_span_en2
|
624 |
|
|
checkbutton .mainframe.f1.address_span_en3 -variable address_span_en3
|
625 |
|
|
checkbutton .mainframe.f1.address_span_en4 -variable address_span_en4
|
626 |
|
|
checkbutton .mainframe.f1.address_span_en5 -variable address_span_en5
|
627 |
|
|
checkbutton .mainframe.f1.address_span_en6 -variable address_span_en6
|
628 |
|
|
checkbutton .mainframe.f1.address_span_en7 -variable address_span_en7
|
629 |
|
|
checkbutton .mainframe.f1.address_span_en8 -variable address_span_en8
|
630 |
20 |
ash_riple |
label .mainframe.f1.address_span_text1 -text {H:}
|
631 |
|
|
label .mainframe.f1.address_span_text2 -text {L:}
|
632 |
|
|
label .mainframe.f1.address_span_text3 -text {H:}
|
633 |
|
|
label .mainframe.f1.address_span_text4 -text {L:}
|
634 |
|
|
label .mainframe.f1.address_span_text5 -text {H:}
|
635 |
|
|
label .mainframe.f1.address_span_text6 -text {L:}
|
636 |
|
|
label .mainframe.f1.address_span_text7 -text {H:}
|
637 |
|
|
label .mainframe.f1.address_span_text8 -text {L:}
|
638 |
18 |
ash_riple |
pack .mainframe.f1.incl_addr \
|
639 |
20 |
ash_riple |
.mainframe.f1.address_span_en1 .mainframe.f1.address_span_text1 .mainframe.f1.address_span1 .mainframe.f1.address_span_text2 .mainframe.f1.address_span2 \
|
640 |
|
|
.mainframe.f1.address_span_en3 .mainframe.f1.address_span_text3 .mainframe.f1.address_span3 .mainframe.f1.address_span_text4 .mainframe.f1.address_span4 \
|
641 |
|
|
.mainframe.f1.address_span_en5 .mainframe.f1.address_span_text5 .mainframe.f1.address_span5 .mainframe.f1.address_span_text6 .mainframe.f1.address_span6 \
|
642 |
|
|
.mainframe.f1.address_span_en7 .mainframe.f1.address_span_text7 .mainframe.f1.address_span7 .mainframe.f1.address_span_text8 .mainframe.f1.address_span8 \
|
643 |
18 |
ash_riple |
-side left -ipadx 0
|
644 |
|
|
|
645 |
|
|
# set the exclusive address entries
|
646 |
|
|
frame .mainframe.f2 -relief groove -borderwidth 5
|
647 |
|
|
pack .mainframe.f2
|
648 |
|
|
label .mainframe.f2.excl_addr -text {Exclusive Addr:}
|
649 |
|
|
entry .mainframe.f2.address_span9 -textvariable address_span9 -width 8
|
650 |
|
|
entry .mainframe.f2.address_span10 -textvariable address_span10 -width 8
|
651 |
|
|
entry .mainframe.f2.address_span11 -textvariable address_span11 -width 8
|
652 |
|
|
entry .mainframe.f2.address_span12 -textvariable address_span12 -width 8
|
653 |
|
|
entry .mainframe.f2.address_span13 -textvariable address_span13 -width 8
|
654 |
|
|
entry .mainframe.f2.address_span14 -textvariable address_span14 -width 8
|
655 |
|
|
entry .mainframe.f2.address_span15 -textvariable address_span15 -width 8
|
656 |
|
|
entry .mainframe.f2.address_span16 -textvariable address_span16 -width 8
|
657 |
|
|
checkbutton .mainframe.f2.address_span_en9 -variable address_span_en9
|
658 |
|
|
checkbutton .mainframe.f2.address_span_en10 -variable address_span_en10
|
659 |
|
|
checkbutton .mainframe.f2.address_span_en11 -variable address_span_en11
|
660 |
|
|
checkbutton .mainframe.f2.address_span_en12 -variable address_span_en12
|
661 |
|
|
checkbutton .mainframe.f2.address_span_en13 -variable address_span_en13
|
662 |
|
|
checkbutton .mainframe.f2.address_span_en14 -variable address_span_en14
|
663 |
|
|
checkbutton .mainframe.f2.address_span_en15 -variable address_span_en15
|
664 |
|
|
checkbutton .mainframe.f2.address_span_en16 -variable address_span_en16
|
665 |
20 |
ash_riple |
label .mainframe.f2.address_span_text1 -text {H:}
|
666 |
|
|
label .mainframe.f2.address_span_text2 -text {L:}
|
667 |
|
|
label .mainframe.f2.address_span_text3 -text {H:}
|
668 |
|
|
label .mainframe.f2.address_span_text4 -text {L:}
|
669 |
|
|
label .mainframe.f2.address_span_text5 -text {H:}
|
670 |
|
|
label .mainframe.f2.address_span_text6 -text {L:}
|
671 |
|
|
label .mainframe.f2.address_span_text7 -text {H:}
|
672 |
|
|
label .mainframe.f2.address_span_text8 -text {L:}
|
673 |
18 |
ash_riple |
pack .mainframe.f2.excl_addr \
|
674 |
20 |
ash_riple |
.mainframe.f2.address_span_en9 .mainframe.f2.address_span_text1 .mainframe.f2.address_span9 .mainframe.f2.address_span_text2 .mainframe.f2.address_span10 \
|
675 |
|
|
.mainframe.f2.address_span_en11 .mainframe.f2.address_span_text3 .mainframe.f2.address_span11 .mainframe.f2.address_span_text4 .mainframe.f2.address_span12 \
|
676 |
|
|
.mainframe.f2.address_span_en13 .mainframe.f2.address_span_text5 .mainframe.f2.address_span13 .mainframe.f2.address_span_text6 .mainframe.f2.address_span14 \
|
677 |
|
|
.mainframe.f2.address_span_en15 .mainframe.f2.address_span_text7 .mainframe.f2.address_span15 .mainframe.f2.address_span_text8 .mainframe.f2.address_span16 \
|
678 |
18 |
ash_riple |
-side left -ipadx 0
|
679 |
|
|
initAddrConfig
|
680 |
|
|
|
681 |
|
|
# set the address configuration buttons
|
682 |
|
|
frame .mainframe.addr_cnfg -relief groove -borderwidth 5
|
683 |
|
|
pack .mainframe.addr_cnfg
|
684 |
|
|
checkbutton .mainframe.addr_cnfg.wren -text {WR} -variable addr_wren
|
685 |
|
|
checkbutton .mainframe.addr_cnfg.rden -text {RD} -variable addr_rden
|
686 |
|
|
button .mainframe.addr_cnfg.config -text {Apply Address Filter} -command {updateAddrConfig}
|
687 |
|
|
pack .mainframe.addr_cnfg.wren .mainframe.addr_cnfg.rden .mainframe.addr_cnfg.config \
|
688 |
|
|
-side left -ipadx 0
|
689 |
|
|
|
690 |
|
|
# set the transaction trigger controls
|
691 |
|
|
frame .mainframe.trig -relief groove -borderwidth 5
|
692 |
|
|
pack .mainframe.trig
|
693 |
|
|
button .mainframe.trig.starttrig -text {Apply Trigger Condition} -command {startTrigger}
|
694 |
20 |
ash_riple |
entry .mainframe.trig.trigvalue_addr -textvar triggerAddr -width 8
|
695 |
18 |
ash_riple |
entry .mainframe.trig.trigvalue_data -textvar triggerData -width 8
|
696 |
|
|
checkbutton .mainframe.trig.trigaddr -text {@Addr:} -variable trig_aden
|
697 |
|
|
checkbutton .mainframe.trig.trigdata -text {@Data:} -variable trig_daen
|
698 |
|
|
checkbutton .mainframe.trig.wren -text {@WR} -variable trig_wren
|
699 |
|
|
checkbutton .mainframe.trig.rden -text {@RD} -variable trig_rden
|
700 |
|
|
label .mainframe.trig.pnum -text {Pre-Capture:}
|
701 |
|
|
entry .mainframe.trig.trigvalue_pnum -textvar triggerPnum -width 4
|
702 |
|
|
pack .mainframe.trig.pnum .mainframe.trig.trigvalue_pnum \
|
703 |
|
|
.mainframe.trig.wren .mainframe.trig.rden \
|
704 |
|
|
.mainframe.trig.trigaddr .mainframe.trig.trigvalue_addr \
|
705 |
|
|
.mainframe.trig.trigdata .mainframe.trig.trigvalue_data \
|
706 |
|
|
.mainframe.trig.starttrig \
|
707 |
|
|
-side left -ipadx 0
|
708 |
|
|
initTrigConfig
|
709 |
|
|
|
710 |
|
|
# set the control buttons
|
711 |
|
|
frame .mainframe.fifo -relief groove -borderwidth 5
|
712 |
|
|
pack .mainframe.fifo
|
713 |
|
|
button .mainframe.fifo.reset -text {Reset FIFO} -command {reset_fifo_ptr}
|
714 |
|
|
button .mainframe.fifo.loop -text {Query Used Word} -command {query_fifo_usedw}
|
715 |
|
|
label .mainframe.fifo.usedw -textvariable fifoUsedw -relief sunken -width 4
|
716 |
|
|
button .mainframe.fifo.read -text {Read FIFO} -command {read_fifo_content}
|
717 |
|
|
button .mainframe.fifo.clear -text {Clear Log} -command {clear_log}
|
718 |
|
|
button .mainframe.fifo.quit -text {Quit} -command {quit}
|
719 |
|
|
pack .mainframe.fifo.reset .mainframe.fifo.loop .mainframe.fifo.usedw .mainframe.fifo.read .mainframe.fifo.clear .mainframe.fifo.quit \
|
720 |
|
|
-side left -ipadx 0
|
721 |
|
|
|
722 |
|
|
# set the log window
|
723 |
|
|
frame .mainframe.log -relief groove -borderwidth 5
|
724 |
|
|
set log [text .mainframe.log.text -width 80 -height 25 \
|
725 |
|
|
-borderwidth 2 -relief sunken -setgrid true \
|
726 |
|
|
-yscrollcommand {.mainframe.log.scroll set}]
|
727 |
|
|
scrollbar .mainframe.log.scroll -command {.mainframe.log.text yview}
|
728 |
|
|
pack .mainframe.log.scroll -side right -fill y
|
729 |
|
|
pack .mainframe.log.text -side left -fill both -expand true
|
730 |
|
|
pack .mainframe.log -side top -fill both -expand true
|
731 |
|
|
|
732 |
|
|
# make the program wait for exit signal
|
733 |
|
|
vwait exit_console
|
734 |
|
|
|