1 |
9 |
ash_riple |
##**************************************************************
|
2 |
|
|
## Module : virtual_jtag_console.tcl
|
3 |
|
|
## Platform : Windows xp sp2
|
4 |
|
|
## Author : Bibo Yang (ash_riple@hotmail.com)
|
5 |
|
|
## Organization : www.opencores.org
|
6 |
|
|
## Revision : 2.1
|
7 |
|
|
## Date : 2012/03/15
|
8 |
|
|
## Description : Tcl/Tk GUI for the up_monitor
|
9 |
|
|
##**************************************************************
|
10 |
|
|
|
11 |
|
|
proc reset_fifo {{jtag_index_0 0}} {
|
12 |
|
|
#device_lock -timeout 5
|
13 |
|
|
#device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 2 -no_captured_ir_value
|
14 |
|
|
#device_virtual_dr_shift -instance_index $jtag_index_0 -length 32 -dr_value 00000000 -value_in_hex -no_captured_dr_value
|
15 |
|
|
#device_unlock
|
16 |
|
|
global sim_started
|
17 |
|
|
if {$sim_started==0} {
|
18 |
|
|
global fifo_sim_act
|
19 |
|
|
global fifo_sim_num
|
20 |
|
|
global fifo_sim_len
|
21 |
|
|
append fifo_sim_act (0,1,2,[format "%X" 2]),
|
22 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
23 |
|
|
set fifo_sim_len [expr $fifo_sim_len+2]
|
24 |
|
|
append fifo_sim_act (0,2,0,[format "%X" 32]),
|
25 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
26 |
|
|
set fifo_sim_len [expr $fifo_sim_len+32]
|
27 |
|
|
} else {
|
28 |
|
|
force -freeze /up_monitor_tb/MON_LO/inst/u_virtual_jtag_adda_fifo/reset 1 -cancel 10ns
|
29 |
|
|
run 20ns
|
30 |
|
|
}
|
31 |
|
|
return 0
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
proc query_usedw {{jtag_index_0 0}} {
|
35 |
|
|
#global fifoUsedw
|
36 |
|
|
#device_lock -timeout 5
|
37 |
|
|
#device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 1 -no_captured_ir_value
|
38 |
|
|
#set usedw [device_virtual_dr_shift -instance_index $jtag_index_0 -length 9 -value_in_hex]
|
39 |
|
|
#device_unlock
|
40 |
|
|
# set tmp 0x
|
41 |
|
|
# append tmp $usedw
|
42 |
|
|
# set usedw [format "%i" $tmp]
|
43 |
|
|
#set fifoUsedw $usedw
|
44 |
|
|
global sim_started
|
45 |
|
|
if {$sim_started==0} {
|
46 |
|
|
global fifo_sim_act
|
47 |
|
|
global fifo_sim_num
|
48 |
|
|
global fifo_sim_len
|
49 |
|
|
append fifo_sim_act (0,1,1,[format "%X" 2]),
|
50 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
51 |
|
|
set fifo_sim_len [expr $fifo_sim_len+2]
|
52 |
|
|
append fifo_sim_act (0,2,0,[format "%X" 9]),
|
53 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
54 |
|
|
set fifo_sim_len [expr $fifo_sim_len+9]
|
55 |
|
|
} else {
|
56 |
|
|
global fifoUsedw
|
57 |
|
|
set usedw [format "%i" 0x[examine /up_monitor_tb/MON_LO/inst/u_virtual_jtag_adda_fifo/usedw]]
|
58 |
|
|
set fifoUsedw $usedw
|
59 |
|
|
}
|
60 |
|
|
return 0
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
proc read_fifo {{jtag_index_0 0}} {
|
64 |
|
|
#device_lock -timeout 5
|
65 |
|
|
#device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 1 -no_captured_ir_value
|
66 |
|
|
#device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 3 -no_captured_ir_value
|
67 |
12 |
ash_riple |
#set fifo_data [device_virtual_dr_shift -instance_index $jtag_index_0 -length 82 -value_in_hex]
|
68 |
9 |
ash_riple |
#device_unlock
|
69 |
|
|
global sim_started
|
70 |
|
|
if {$sim_started==0} {
|
71 |
|
|
global fifo_sim_act
|
72 |
|
|
global fifo_sim_num
|
73 |
|
|
global fifo_sim_len
|
74 |
|
|
append fifo_sim_act (0,1,1,[format "%X" 2]),
|
75 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
76 |
|
|
set fifo_sim_len [expr $fifo_sim_len+2]
|
77 |
|
|
append fifo_sim_act (0,1,3,[format "%X" 2]),
|
78 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
79 |
|
|
set fifo_sim_len [expr $fifo_sim_len+2]
|
80 |
12 |
ash_riple |
append fifo_sim_act (0,2,0,[format "%X" 82]),
|
81 |
9 |
ash_riple |
set fifo_sim_num [expr $fifo_sim_num+1]
|
82 |
12 |
ash_riple |
set fifo_sim_len [expr $fifo_sim_len+82]
|
83 |
|
|
return 000000000000000000000
|
84 |
9 |
ash_riple |
} else {
|
85 |
|
|
force -freeze /up_monitor_tb/MON_LO/inst/u_virtual_jtag_adda_fifo/rd_en 1 -cancel 10ns
|
86 |
|
|
run 20ns
|
87 |
|
|
#after 10
|
88 |
|
|
set fifo_data [examine /up_monitor_tb/MON_LO/inst/u_virtual_jtag_adda_fifo/data_out]
|
89 |
|
|
return $fifo_data
|
90 |
|
|
}
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
proc config_addr {{jtag_index_1 1} {mask 0100000000} {mask_id 1}} {
|
94 |
|
|
global log
|
95 |
|
|
set mask_leng [string length $mask]
|
96 |
|
|
if {$mask_leng!=10} {
|
97 |
|
|
$log insert end "\nError: Wrong address mask length @$mask_id: [expr $mask_leng-2]. Expects: 8.\n"
|
98 |
|
|
|
99 |
|
|
} else {
|
100 |
|
|
#device_lock -timeout 5
|
101 |
|
|
#device_virtual_ir_shift -instance_index $jtag_index_1 -ir_value 1 -no_captured_ir_value
|
102 |
|
|
#set addr_mask [device_virtual_dr_shift -instance_index $jtag_index_1 -dr_value $mask -length 40 -value_in_hex]
|
103 |
|
|
#device_unlock
|
104 |
|
|
global addr_sim_act
|
105 |
|
|
global addr_sim_num
|
106 |
|
|
global addr_sim_len
|
107 |
|
|
append addr_sim_act (0,1,1,[format "%X" 2]),
|
108 |
|
|
set addr_sim_num [expr $addr_sim_num+1]
|
109 |
|
|
set addr_sim_len [expr $addr_sim_len+2]
|
110 |
|
|
append addr_sim_act (0,2,$mask,[format "%X" 40]),
|
111 |
|
|
set addr_sim_num [expr $addr_sim_num+1]
|
112 |
|
|
set addr_sim_len [expr $addr_sim_len+40]
|
113 |
|
|
return 0
|
114 |
|
|
}
|
115 |
|
|
}
|
116 |
|
|
|
117 |
11 |
ash_riple |
proc config_trig {{jtag_index_2 2} {trig 00000000000000} {pnum 0}} {
|
118 |
9 |
ash_riple |
global log
|
119 |
|
|
set trig_leng [string length $trig]
|
120 |
|
|
if {$trig_leng!=14} {
|
121 |
|
|
$log insert end "\nError: Wrong trigger condition length: [expr $trig_leng-2]. Expects: 4+8.\n"
|
122 |
|
|
} else {
|
123 |
|
|
#device_lock -timeout 5
|
124 |
|
|
#device_virtual_ir_shift -instance_index $jtag_index_2 -ir_value 1 -no_captured_ir_value
|
125 |
|
|
#set addr_trig [device_virtual_dr_shift -instance_index $jtag_index_2 -dr_value $trig -length 56 -value_in_hex]
|
126 |
11 |
ash_riple |
#device_virtual_ir_shift -instance_index $jtag_index_2 -ir_value 2 -no_captured_ir_value
|
127 |
|
|
#set addr_trig [device_virtual_dr_shift -instance_index $jtag_index_2 -dr_value $pnum -length 10]
|
128 |
9 |
ash_riple |
#device_unlock
|
129 |
|
|
global trig_sim_act
|
130 |
|
|
global trig_sim_num
|
131 |
|
|
global trig_sim_len
|
132 |
|
|
append trig_sim_act (0,1,1,[format "%X" 2]),
|
133 |
|
|
set trig_sim_num [expr $trig_sim_num+1]
|
134 |
|
|
set trig_sim_len [expr $trig_sim_len+2]
|
135 |
|
|
append trig_sim_act (0,2,$trig,[format "%X" 56]),
|
136 |
|
|
set trig_sim_num [expr $trig_sim_num+1]
|
137 |
|
|
set trig_sim_len [expr $trig_sim_len+56]
|
138 |
11 |
ash_riple |
append trig_sim_act (0,1,2,[format "%X" 2]),
|
139 |
|
|
set trig_sim_num [expr $trig_sim_num+1]
|
140 |
|
|
set trig_sim_len [expr $trig_sim_len+2]
|
141 |
|
|
append trig_sim_act (0,2,[format "%X" $pnum],[format "%X" 10]),
|
142 |
|
|
set trig_sim_num [expr $trig_sim_num+1]
|
143 |
|
|
set trig_sim_len [expr $trig_sim_len+10]
|
144 |
9 |
ash_riple |
return 0
|
145 |
|
|
}
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
proc open_jtag_device {{test_cable "USB-Blaster [USB-0]"} {test_device "@2: EP2SGX90 (0x020E30DD)"}} {
|
149 |
|
|
open_device -hardware_name $test_cable -device_name $test_device
|
150 |
|
|
# Retrieve device id code.
|
151 |
|
|
device_lock -timeout 5
|
152 |
|
|
device_ir_shift -ir_value 6 -no_captured_ir_value
|
153 |
|
|
set idcode "0x[device_dr_shift -length 32 -value_in_hex]"
|
154 |
|
|
device_unlock
|
155 |
|
|
return $idcode
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
proc close_jtag_device {} {
|
159 |
|
|
close_device
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
proc scan_chain {} {
|
163 |
|
|
global log
|
164 |
|
|
$log insert end "JTAG Chain Scanning report:\n"
|
165 |
|
|
$log insert end "****************************************\n"
|
166 |
|
|
set blaster_cables [get_hardware_names]
|
167 |
|
|
set cable_num 0
|
168 |
|
|
foreach blaster_cable $blaster_cables {
|
169 |
|
|
incr cable_num
|
170 |
|
|
$log insert end "@$cable_num: $blaster_cable\n"
|
171 |
|
|
}
|
172 |
|
|
$log insert end "\n****************************************\n"
|
173 |
|
|
global device_list
|
174 |
|
|
set device_list ""
|
175 |
|
|
foreach blaster_cable $blaster_cables {
|
176 |
|
|
$log insert end "$blaster_cable:\n"
|
177 |
|
|
lappend device_list $blaster_cable
|
178 |
|
|
if [catch {get_device_names -hardware_name $blaster_cable} error_msg] {
|
179 |
|
|
$log insert end $error_msg
|
180 |
|
|
lappend device_list $error_msg
|
181 |
|
|
} else {
|
182 |
|
|
foreach test_device [get_device_names -hardware_name $blaster_cable] {
|
183 |
|
|
$log insert end "$test_device\n"
|
184 |
|
|
}
|
185 |
|
|
lappend device_list [get_device_names -hardware_name $blaster_cable]
|
186 |
|
|
}
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
proc select_device {{cableNum 1} {deviceNum 1}} {
|
191 |
|
|
global log
|
192 |
|
|
global device_list
|
193 |
|
|
$log insert end "\n****************************************\n"
|
194 |
|
|
set test_cable [lindex $device_list [expr 2*$cableNum-2]]
|
195 |
|
|
$log insert end "Selected Cable : $test_cable\n"
|
196 |
|
|
set test_device [lindex [lindex $device_list [expr 2*$cableNum-1]] [expr $deviceNum-1]]
|
197 |
|
|
$log insert end "Selected Device: $test_device\n"
|
198 |
|
|
set jtagIdCode [open_jtag_device $test_cable $test_device]
|
199 |
|
|
$log insert end "Device ID code : $jtagIdCode\n"
|
200 |
|
|
reset_fifo 0
|
201 |
|
|
query_usedw 0
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
proc updateAddrConfig {} {
|
205 |
|
|
global address_span1
|
206 |
|
|
global address_span2
|
207 |
|
|
global address_span3
|
208 |
|
|
global address_span4
|
209 |
|
|
global address_span5
|
210 |
|
|
global address_span6
|
211 |
|
|
global address_span7
|
212 |
|
|
global address_span8
|
213 |
|
|
global address_span9
|
214 |
|
|
global address_span10
|
215 |
|
|
global address_span11
|
216 |
|
|
global address_span12
|
217 |
|
|
global address_span13
|
218 |
|
|
global address_span14
|
219 |
|
|
global address_span15
|
220 |
|
|
global address_span16
|
221 |
|
|
global address_span_en1
|
222 |
|
|
global address_span_en2
|
223 |
|
|
global address_span_en3
|
224 |
|
|
global address_span_en4
|
225 |
|
|
global address_span_en5
|
226 |
|
|
global address_span_en6
|
227 |
|
|
global address_span_en7
|
228 |
|
|
global address_span_en8
|
229 |
|
|
global address_span_en9
|
230 |
|
|
global address_span_en10
|
231 |
|
|
global address_span_en11
|
232 |
|
|
global address_span_en12
|
233 |
|
|
global address_span_en13
|
234 |
|
|
global address_span_en14
|
235 |
|
|
global address_span_en15
|
236 |
|
|
global address_span_en16
|
237 |
|
|
global addr_wren
|
238 |
|
|
global addr_rden
|
239 |
|
|
for {set i 1} {$i<=16} {incr i} {
|
240 |
|
|
set mask [format "%1X" [expr $i-1]]
|
241 |
|
|
append mask [format "%1X" [expr $addr_wren*8+$addr_rden*4+[set address_span_en$i]]]
|
242 |
|
|
append mask [set address_span$i]
|
243 |
|
|
config_addr 1 $mask $i
|
244 |
|
|
}
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
proc initAddrConfig {} {
|
248 |
|
|
global log
|
249 |
|
|
global address_span1
|
250 |
|
|
global address_span2
|
251 |
|
|
global address_span3
|
252 |
|
|
global address_span4
|
253 |
|
|
global address_span5
|
254 |
|
|
global address_span6
|
255 |
|
|
global address_span7
|
256 |
|
|
global address_span8
|
257 |
|
|
global address_span9
|
258 |
|
|
global address_span10
|
259 |
|
|
global address_span11
|
260 |
|
|
global address_span12
|
261 |
|
|
global address_span13
|
262 |
|
|
global address_span14
|
263 |
|
|
global address_span15
|
264 |
|
|
global address_span16
|
265 |
|
|
for {set i 1} {$i<=8} {incr i} {
|
266 |
|
|
if {[set address_span$i]==""} {
|
267 |
|
|
set address_span$i ffff0000
|
268 |
|
|
}
|
269 |
|
|
}
|
270 |
|
|
for {set i 9} {$i<=16} {incr i} {
|
271 |
|
|
if {[set address_span$i]==""} {
|
272 |
|
|
set address_span$i 00000000
|
273 |
|
|
}
|
274 |
|
|
}
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
proc initTrigConfig {} {
|
278 |
|
|
global triggerAddr
|
279 |
|
|
global triggerData
|
280 |
11 |
ash_riple |
global triggerPnum
|
281 |
9 |
ash_riple |
if {[set triggerAddr]==""} {
|
282 |
|
|
set triggerAddr ffff
|
283 |
|
|
}
|
284 |
|
|
if {[set triggerData]==""} {
|
285 |
|
|
set triggerData a5a5a5a5
|
286 |
|
|
}
|
287 |
11 |
ash_riple |
if {[set triggerPnum]==""} {
|
288 |
|
|
set triggerPnum 0
|
289 |
|
|
}
|
290 |
9 |
ash_riple |
}
|
291 |
|
|
|
292 |
|
|
proc updateTrigger {{trigCmd 0}} {
|
293 |
|
|
global triggerAddr
|
294 |
|
|
global triggerData
|
295 |
11 |
ash_riple |
global triggerPnum
|
296 |
9 |
ash_riple |
global trig_wren
|
297 |
|
|
global trig_rden
|
298 |
|
|
global trig_aden
|
299 |
|
|
global trig_daen
|
300 |
|
|
set triggerValue [format "%1X" [expr $trig_aden*8+$trig_daen*4+0]]
|
301 |
|
|
append triggerValue [format "%1X" [expr $trig_wren*8+$trig_rden*4+$trigCmd]]
|
302 |
|
|
append triggerValue $triggerAddr
|
303 |
|
|
append triggerValue $triggerData
|
304 |
11 |
ash_riple |
config_trig 2 $triggerValue $triggerPnum
|
305 |
9 |
ash_riple |
}
|
306 |
|
|
|
307 |
|
|
proc startTrigger {} {
|
308 |
|
|
global trig_wren
|
309 |
|
|
global trig_rden
|
310 |
|
|
global trig_aden
|
311 |
|
|
global trig_daen
|
312 |
|
|
set trigEnable [expr $trig_wren+$trig_rden+$trig_aden+$trig_daen]
|
313 |
|
|
if {$trigEnable>0} {
|
314 |
|
|
updateTrigger 2
|
315 |
11 |
ash_riple |
reset_fifo 0
|
316 |
|
|
query_usedw 0
|
317 |
9 |
ash_riple |
updateTrigger 3
|
318 |
|
|
} else {
|
319 |
|
|
updateTrigger 0
|
320 |
|
|
}
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
proc reset_fifo_ptr {} {
|
324 |
|
|
reset_fifo 0
|
325 |
|
|
query_usedw 0
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
proc query_fifo_usedw {} {
|
329 |
|
|
query_usedw 0
|
330 |
|
|
}
|
331 |
|
|
|
332 |
|
|
proc read_fifo_content {} {
|
333 |
|
|
global log
|
334 |
|
|
global fifoUsedw
|
335 |
11 |
ash_riple |
$log insert end "\n****************************************\n"
|
336 |
9 |
ash_riple |
for {set i 0} {$i<$fifoUsedw} {incr i} {
|
337 |
|
|
set fifoContent [read_fifo 0]
|
338 |
|
|
set ok_trig [expr [format "%d" 0x[string index $fifoContent 0]]/2]
|
339 |
|
|
set wr_cptr [expr [format "%d" 0x[string index $fifoContent 0]]%2]
|
340 |
12 |
ash_riple |
set tm_cptr [format "%d" 0x[string range $fifoContent 1 8]]
|
341 |
|
|
set ad_cptr [string range $fifoContent 9 12]
|
342 |
|
|
set da_cptr [string range $fifoContent 13 20]
|
343 |
9 |
ash_riple |
if $ok_trig {
|
344 |
|
|
$log insert end "@@@@@@@@@@@@@@@@@@@@\n"
|
345 |
|
|
}
|
346 |
|
|
if $wr_cptr {
|
347 |
12 |
ash_riple |
$log insert end "wr $ad_cptr $da_cptr @$tm_cptr\n"
|
348 |
9 |
ash_riple |
} else {
|
349 |
12 |
ash_riple |
$log insert end "rd $ad_cptr $da_cptr @$tm_cptr\n"
|
350 |
9 |
ash_riple |
}
|
351 |
|
|
}
|
352 |
|
|
query_usedw 0
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
proc reset_stimulus {} {
|
356 |
|
|
global fifo_sim_act
|
357 |
|
|
global fifo_sim_num
|
358 |
|
|
global fifo_sim_len
|
359 |
|
|
global addr_sim_act
|
360 |
|
|
global addr_sim_num
|
361 |
|
|
global addr_sim_len
|
362 |
|
|
global trig_sim_act
|
363 |
|
|
global trig_sim_num
|
364 |
|
|
global trig_sim_len
|
365 |
|
|
set fifo_sim_act \"(
|
366 |
|
|
set fifo_sim_num 0
|
367 |
|
|
set fifo_sim_len 0
|
368 |
|
|
set addr_sim_act \"(
|
369 |
|
|
set addr_sim_num 0
|
370 |
|
|
set addr_sim_len 0
|
371 |
|
|
set trig_sim_act \"(
|
372 |
|
|
set trig_sim_num 0
|
373 |
|
|
set trig_sim_len 0
|
374 |
|
|
}
|
375 |
|
|
|
376 |
|
|
proc generate_stimulus {} {
|
377 |
|
|
global log
|
378 |
|
|
global fifo_sim_act
|
379 |
|
|
global fifo_sim_num
|
380 |
|
|
global fifo_sim_len
|
381 |
|
|
global addr_sim_act
|
382 |
|
|
global addr_sim_num
|
383 |
|
|
global addr_sim_len
|
384 |
|
|
global trig_sim_act
|
385 |
|
|
global trig_sim_num
|
386 |
|
|
global trig_sim_len
|
387 |
|
|
append fifo_sim_act (1,1,1,2))\"
|
388 |
|
|
set fifo_sim_num [expr $fifo_sim_num+1]
|
389 |
|
|
set fifo_sim_len [expr $fifo_sim_len+2]
|
390 |
|
|
append addr_sim_act (1,1,1,2))\"
|
391 |
|
|
set addr_sim_num [expr $addr_sim_num+1]
|
392 |
|
|
set addr_sim_len [expr $addr_sim_len+2]
|
393 |
|
|
append trig_sim_act (1,1,1,2))\"
|
394 |
|
|
set trig_sim_num [expr $trig_sim_num+1]
|
395 |
|
|
set trig_sim_len [expr $trig_sim_len+2]
|
396 |
|
|
$log delete 1.0 end
|
397 |
10 |
ash_riple |
$log insert end "`define USE_SIM_STIMULUS\n\n"
|
398 |
9 |
ash_riple |
$log insert end "`define FIFO_SLD_SIM_ACTION $fifo_sim_act\n"
|
399 |
|
|
$log insert end "`define FIFO_SLD_SIM_N_SCAN $fifo_sim_num\n"
|
400 |
|
|
$log insert end "`define FIFO_SLD_SIM_T_LENG $fifo_sim_len\n\n"
|
401 |
|
|
$log insert end "`define ADDR_SLD_SIM_ACTION $addr_sim_act\n"
|
402 |
|
|
$log insert end "`define ADDR_SLD_SIM_N_SCAN $addr_sim_num\n"
|
403 |
|
|
$log insert end "`define ADDR_SLD_SIM_T_LENG $addr_sim_len\n\n"
|
404 |
|
|
$log insert end "`define TRIG_SLD_SIM_ACTION $trig_sim_act\n"
|
405 |
|
|
$log insert end "`define TRIG_SLD_SIM_N_SCAN $trig_sim_num\n"
|
406 |
|
|
$log insert end "`define TRIG_SLD_SIM_T_LENG $trig_sim_len\n\n"
|
407 |
|
|
|
408 |
10 |
ash_riple |
set fileId [open ../../rtl/altera/jtag_sim_define.h w]
|
409 |
9 |
ash_riple |
puts $fileId [$log get 1.0 end]
|
410 |
|
|
close $fileId
|
411 |
|
|
}
|
412 |
|
|
|
413 |
|
|
proc quit_console {} {
|
414 |
|
|
global exit_console
|
415 |
|
|
destroy .console
|
416 |
|
|
set exit_console 1
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
proc back_sim {} {
|
420 |
|
|
global exit_console
|
421 |
|
|
#destroy .console
|
422 |
|
|
set exit_console 1
|
423 |
|
|
}
|
424 |
|
|
|
425 |
|
|
proc start_sim {} {
|
426 |
|
|
do sim.do
|
427 |
|
|
}
|
428 |
|
|
|
429 |
|
|
proc pause_sim {} {
|
430 |
|
|
vsim_break
|
431 |
|
|
}
|
432 |
|
|
|
433 |
|
|
# initialize
|
434 |
|
|
set exit_console 0
|
435 |
|
|
reset_stimulus
|
436 |
|
|
destroy .console
|
437 |
|
|
|
438 |
|
|
# set the main window
|
439 |
|
|
toplevel .console
|
440 |
|
|
wm title .console "www.OpenCores.org: uP Transaction Monitor: Simulation Console"
|
441 |
|
|
pack propagate .console true
|
442 |
|
|
|
443 |
|
|
# set the www.OpenCores.org logo
|
444 |
|
|
frame .console.fig -bg white
|
445 |
|
|
pack .console.fig -expand true -fill both
|
446 |
|
|
image create photo logo -format gif -file "../../cmd/common/OpenCores.gif"
|
447 |
|
|
label .console.fig.logo -image logo -bg white
|
448 |
|
|
pack .console.fig.logo
|
449 |
|
|
|
450 |
|
|
# set the inclusive address entries
|
451 |
|
|
frame .console.f1 -relief groove -borderwidth 5
|
452 |
|
|
pack .console.f1
|
453 |
|
|
label .console.f1.incl_addr -text {Inclusive Addr:}
|
454 |
|
|
entry .console.f1.address_span1 -textvariable address_span1 -width 8
|
455 |
|
|
entry .console.f1.address_span2 -textvariable address_span2 -width 8
|
456 |
|
|
entry .console.f1.address_span3 -textvariable address_span3 -width 8
|
457 |
|
|
entry .console.f1.address_span4 -textvariable address_span4 -width 8
|
458 |
|
|
entry .console.f1.address_span5 -textvariable address_span5 -width 8
|
459 |
|
|
entry .console.f1.address_span6 -textvariable address_span6 -width 8
|
460 |
|
|
entry .console.f1.address_span7 -textvariable address_span7 -width 8
|
461 |
|
|
entry .console.f1.address_span8 -textvariable address_span8 -width 8
|
462 |
|
|
checkbutton .console.f1.address_span_en1 -variable address_span_en1
|
463 |
|
|
checkbutton .console.f1.address_span_en2 -variable address_span_en2
|
464 |
|
|
checkbutton .console.f1.address_span_en3 -variable address_span_en3
|
465 |
|
|
checkbutton .console.f1.address_span_en4 -variable address_span_en4
|
466 |
|
|
checkbutton .console.f1.address_span_en5 -variable address_span_en5
|
467 |
|
|
checkbutton .console.f1.address_span_en6 -variable address_span_en6
|
468 |
|
|
checkbutton .console.f1.address_span_en7 -variable address_span_en7
|
469 |
|
|
checkbutton .console.f1.address_span_en8 -variable address_span_en8
|
470 |
|
|
pack .console.f1.incl_addr \
|
471 |
|
|
.console.f1.address_span_en1 .console.f1.address_span1 \
|
472 |
|
|
.console.f1.address_span_en2 .console.f1.address_span2 \
|
473 |
|
|
.console.f1.address_span_en3 .console.f1.address_span3 \
|
474 |
|
|
.console.f1.address_span_en4 .console.f1.address_span4 \
|
475 |
|
|
.console.f1.address_span_en5 .console.f1.address_span5 \
|
476 |
|
|
.console.f1.address_span_en6 .console.f1.address_span6 \
|
477 |
|
|
.console.f1.address_span_en7 .console.f1.address_span7 \
|
478 |
|
|
.console.f1.address_span_en8 .console.f1.address_span8 \
|
479 |
|
|
-side left -ipadx 0
|
480 |
|
|
|
481 |
|
|
# set the exclusive address entries
|
482 |
|
|
frame .console.f2 -relief groove -borderwidth 5
|
483 |
|
|
pack .console.f2
|
484 |
|
|
label .console.f2.excl_addr -text {Exclusive Addr:}
|
485 |
|
|
entry .console.f2.address_span9 -textvariable address_span9 -width 8
|
486 |
|
|
entry .console.f2.address_span10 -textvariable address_span10 -width 8
|
487 |
|
|
entry .console.f2.address_span11 -textvariable address_span11 -width 8
|
488 |
|
|
entry .console.f2.address_span12 -textvariable address_span12 -width 8
|
489 |
|
|
entry .console.f2.address_span13 -textvariable address_span13 -width 8
|
490 |
|
|
entry .console.f2.address_span14 -textvariable address_span14 -width 8
|
491 |
|
|
entry .console.f2.address_span15 -textvariable address_span15 -width 8
|
492 |
|
|
entry .console.f2.address_span16 -textvariable address_span16 -width 8
|
493 |
|
|
checkbutton .console.f2.address_span_en9 -variable address_span_en9
|
494 |
|
|
checkbutton .console.f2.address_span_en10 -variable address_span_en10
|
495 |
|
|
checkbutton .console.f2.address_span_en11 -variable address_span_en11
|
496 |
|
|
checkbutton .console.f2.address_span_en12 -variable address_span_en12
|
497 |
|
|
checkbutton .console.f2.address_span_en13 -variable address_span_en13
|
498 |
|
|
checkbutton .console.f2.address_span_en14 -variable address_span_en14
|
499 |
|
|
checkbutton .console.f2.address_span_en15 -variable address_span_en15
|
500 |
|
|
checkbutton .console.f2.address_span_en16 -variable address_span_en16
|
501 |
|
|
pack .console.f2.excl_addr \
|
502 |
|
|
.console.f2.address_span_en9 .console.f2.address_span9 \
|
503 |
|
|
.console.f2.address_span_en10 .console.f2.address_span10 \
|
504 |
|
|
.console.f2.address_span_en11 .console.f2.address_span11 \
|
505 |
|
|
.console.f2.address_span_en12 .console.f2.address_span12 \
|
506 |
|
|
.console.f2.address_span_en13 .console.f2.address_span13 \
|
507 |
|
|
.console.f2.address_span_en14 .console.f2.address_span14 \
|
508 |
|
|
.console.f2.address_span_en15 .console.f2.address_span15 \
|
509 |
|
|
.console.f2.address_span_en16 .console.f2.address_span16 \
|
510 |
|
|
-side left -ipadx 0
|
511 |
|
|
initAddrConfig
|
512 |
|
|
|
513 |
|
|
# set the address configuration buttons
|
514 |
|
|
frame .console.addr_cnfg -relief groove -borderwidth 5
|
515 |
|
|
pack .console.addr_cnfg
|
516 |
|
|
checkbutton .console.addr_cnfg.wren -text {WR} -variable addr_wren
|
517 |
|
|
checkbutton .console.addr_cnfg.rden -text {RD} -variable addr_rden
|
518 |
|
|
button .console.addr_cnfg.config -text {Apply Address Filter} -command {updateAddrConfig}
|
519 |
|
|
pack .console.addr_cnfg.wren .console.addr_cnfg.rden .console.addr_cnfg.config \
|
520 |
|
|
-side left -ipadx 0
|
521 |
|
|
|
522 |
|
|
# set the transaction trigger controls
|
523 |
|
|
frame .console.trig -relief groove -borderwidth 5
|
524 |
|
|
pack .console.trig
|
525 |
|
|
button .console.trig.starttrig -text {Apply Trigger Condition} -command {startTrigger}
|
526 |
|
|
entry .console.trig.trigvalue_addr -textvar triggerAddr -width 4
|
527 |
|
|
entry .console.trig.trigvalue_data -textvar triggerData -width 8
|
528 |
|
|
checkbutton .console.trig.trigaddr -text {@Addr:} -variable trig_aden
|
529 |
|
|
checkbutton .console.trig.trigdata -text {@Data:} -variable trig_daen
|
530 |
|
|
checkbutton .console.trig.wren -text {@WR} -variable trig_wren
|
531 |
|
|
checkbutton .console.trig.rden -text {@RD} -variable trig_rden
|
532 |
11 |
ash_riple |
label .console.trig.pnum -text {Pre-Capture:}
|
533 |
|
|
entry .console.trig.trigvalue_pnum -textvar triggerPnum -width 4
|
534 |
|
|
pack .console.trig.pnum .console.trig.trigvalue_pnum \
|
535 |
|
|
.console.trig.wren .console.trig.rden \
|
536 |
9 |
ash_riple |
.console.trig.trigaddr .console.trig.trigvalue_addr \
|
537 |
|
|
.console.trig.trigdata .console.trig.trigvalue_data \
|
538 |
|
|
.console.trig.starttrig \
|
539 |
|
|
-side left -ipadx 0
|
540 |
|
|
initTrigConfig
|
541 |
|
|
|
542 |
|
|
# set the control buttons
|
543 |
|
|
frame .console.fifo -relief groove -borderwidth 5
|
544 |
|
|
pack .console.fifo
|
545 |
|
|
button .console.fifo.reset -text {Reset FIFO} -command {reset_fifo_ptr}
|
546 |
|
|
button .console.fifo.loop -text {Query Used Word} -command {query_fifo_usedw}
|
547 |
|
|
label .console.fifo.usedw -textvariable fifoUsedw -relief sunken -width 4
|
548 |
|
|
button .console.fifo.read -text {Read FIFO} -command {read_fifo_content}
|
549 |
|
|
pack .console.fifo.reset .console.fifo.loop .console.fifo.usedw .console.fifo.read \
|
550 |
|
|
-side left -ipadx 0
|
551 |
|
|
|
552 |
|
|
# set the control buttons
|
553 |
|
|
frame .console.sim -relief groove -borderwidth 5
|
554 |
|
|
pack .console.sim
|
555 |
|
|
button .console.sim.reset -text {Reset Stimulus} -command {reset_stimulus}
|
556 |
|
|
button .console.sim.generate -text {Generate Stimulus} -command {generate_stimulus}
|
557 |
|
|
button .console.sim.start -text {Start Simulation} -command {start_sim}
|
558 |
|
|
button .console.sim.pause -text {Pause Simulation} -command {pause_sim}
|
559 |
|
|
button .console.sim.back -text {Back to Simulation} -command {back_sim}
|
560 |
|
|
button .console.sim.quit -text {Quit} -command {quit_console}
|
561 |
|
|
pack .console.sim.reset .console.sim.generate .console.sim.back .console.sim.quit \
|
562 |
|
|
-side left -ipadx 0
|
563 |
|
|
|
564 |
|
|
# set the log window
|
565 |
|
|
frame .console.log -relief groove -borderwidth 5
|
566 |
|
|
set log [text .console.log.text -width 80 -height 25 \
|
567 |
|
|
-borderwidth 2 -relief sunken -setgrid true \
|
568 |
|
|
-yscrollcommand {.console.log.scroll set}]
|
569 |
|
|
scrollbar .console.log.scroll -command {.console.log.text yview}
|
570 |
|
|
pack .console.log.scroll -side right -fill y
|
571 |
|
|
pack .console.log.text -side left -fill both -expand true
|
572 |
|
|
pack .console.log -side top -fill both -expand true
|
573 |
|
|
|
574 |
|
|
# make the program wait for exit signal
|
575 |
|
|
vwait exit_console
|
576 |
|
|
|