Line 7... |
Line 7... |
## Date : 2014/02/08
|
## Date : 2014/02/08
|
## Description : Tcl/Tk GUI for the up_monitor
|
## Description : Tcl/Tk GUI for the up_monitor
|
##**************************************************************
|
##**************************************************************
|
|
|
proc reset_fifo {{jtag_index_0 0}} {
|
proc reset_fifo {{jtag_index_0 0}} {
|
|
global test_cable
|
|
global test_device
|
|
open_device -hardware_name $test_cable -device_name $test_device
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 2 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 2 -no_captured_ir_value
|
device_virtual_dr_shift -instance_index $jtag_index_0 -length 32 -dr_value 00000000 -value_in_hex -no_captured_dr_value
|
device_virtual_dr_shift -instance_index $jtag_index_0 -length 32 -dr_value 00000000 -value_in_hex -no_captured_dr_value
|
device_unlock
|
device_unlock
|
|
close_device
|
return 0
|
return 0
|
}
|
}
|
|
|
proc query_usedw {{jtag_index_0 0}} {
|
proc query_usedw {{jtag_index_0 0}} {
|
|
global test_cable
|
|
global test_device
|
|
open_device -hardware_name $test_cable -device_name $test_device
|
global fifoUsedw
|
global fifoUsedw
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 1 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 1 -no_captured_ir_value
|
set usedw [device_virtual_dr_shift -instance_index $jtag_index_0 -length 9 -value_in_hex]
|
set usedw [device_virtual_dr_shift -instance_index $jtag_index_0 -length 9 -value_in_hex]
|
device_unlock
|
device_unlock
|
set tmp 0x
|
set tmp 0x
|
append tmp $usedw
|
append tmp $usedw
|
set usedw [format "%i" $tmp]
|
set usedw [format "%i" $tmp]
|
set fifoUsedw $usedw
|
set fifoUsedw $usedw
|
|
close_device
|
return $usedw
|
return $usedw
|
}
|
}
|
|
|
proc read_fifo {{jtag_index_0 0}} {
|
proc read_fifo {{jtag_index_0 0}} {
|
|
global test_cable
|
|
global test_device
|
|
open_device -hardware_name $test_cable -device_name $test_device
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 1 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 1 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 3 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_0 -ir_value 3 -no_captured_ir_value
|
set fifo_data [device_virtual_dr_shift -instance_index $jtag_index_0 -length 82 -value_in_hex]
|
set fifo_data [device_virtual_dr_shift -instance_index $jtag_index_0 -length 98 -value_in_hex]
|
device_unlock
|
device_unlock
|
|
close_device
|
return $fifo_data
|
return $fifo_data
|
}
|
}
|
|
|
proc config_addr {{jtag_index_1 1} {mask 0100000000} {mask_id 1}} {
|
proc config_addr {{jtag_index_1 1} {mask 0100000000} {mask_id 1}} {
|
|
global test_cable
|
|
global test_device
|
|
open_device -hardware_name $test_cable -device_name $test_device
|
global log
|
global log
|
set mask_leng [string length $mask]
|
set mask_leng [string length $mask]
|
if {$mask_leng!=10} {
|
if {$mask_leng!=10} {
|
$log insert end "\nError: Wrong address mask length @$mask_id: [expr $mask_leng-2]. Expects: 8.\n"
|
$log insert end "\nError: Wrong address mask length @$mask_id: [expr $mask_leng-2]. Expects: 8.\n"
|
|
set addr_mask 0000000000
|
} else {
|
} else {
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_virtual_ir_shift -instance_index $jtag_index_1 -ir_value 1 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_1 -ir_value 1 -no_captured_ir_value
|
set addr_mask [device_virtual_dr_shift -instance_index $jtag_index_1 -dr_value $mask -length 40 -value_in_hex]
|
set addr_mask [device_virtual_dr_shift -instance_index $jtag_index_1 -dr_value $mask -length 40 -value_in_hex]
|
device_unlock
|
device_unlock
|
return $addr_mask
|
|
}
|
}
|
|
close_device
|
|
return $addr_mask
|
}
|
}
|
|
|
proc config_trig {{jtag_index_2 2} {trig 00000000000000} {pnum 000}} {
|
proc config_trig {{jtag_index_2 2} {trig 00000000000000} {pnum 000}} {
|
|
global test_cable
|
|
global test_device
|
|
open_device -hardware_name $test_cable -device_name $test_device
|
global log
|
global log
|
set trig_leng [string length $trig]
|
set trig_leng [string length $trig]
|
if {$trig_leng!=14} {
|
if {$trig_leng!=18} {
|
$log insert end "\nError: Wrong trigger condition length: [expr $trig_leng-2]. Expects: 4+8.\n"
|
$log insert end "\nError: Wrong trigger condition length: [expr $trig_leng-2]. Expects: 8+8.\n"
|
} else {
|
} else {
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_virtual_ir_shift -instance_index $jtag_index_2 -ir_value 1 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_2 -ir_value 1 -no_captured_ir_value
|
set addr_trig [device_virtual_dr_shift -instance_index $jtag_index_2 -dr_value $trig -length 56 -value_in_hex]
|
set addr_trig [device_virtual_dr_shift -instance_index $jtag_index_2 -dr_value $trig -length 72 -value_in_hex]
|
device_unlock
|
device_unlock
|
}
|
}
|
if {[format "%d" 0x$pnum]>=511} {
|
if {[format "%d" 0x$pnum]>=511} {
|
$log insert end "\nError: Wrong trigger pre-capture value: [format "%d" 0x$pnum]. Expects: 0~510.\n"
|
$log insert end "\nError: Wrong trigger pre-capture value: [format "%d" 0x$pnum]. Expects: 0~510.\n"
|
} else {
|
} else {
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_virtual_ir_shift -instance_index $jtag_index_2 -ir_value 2 -no_captured_ir_value
|
device_virtual_ir_shift -instance_index $jtag_index_2 -ir_value 2 -no_captured_ir_value
|
set pnum_trig [device_virtual_dr_shift -instance_index $jtag_index_2 -dr_value $pnum -length 10 -value_in_hex]
|
set pnum_trig [device_virtual_dr_shift -instance_index $jtag_index_2 -dr_value $pnum -length 10 -value_in_hex]
|
device_unlock
|
device_unlock
|
}
|
}
|
|
close_device
|
return $addr_trig
|
return $addr_trig
|
}
|
}
|
|
|
proc open_jtag_device {{test_cable "USB-Blaster [USB-0]"} {test_device "@2: EP2SGX90 (0x020E30DD)"}} {
|
proc open_jtag_device {{test_cable "USB-Blaster [USB-0]"} {test_device "@2: EP2SGX90 (0x020E30DD)"}} {
|
open_device -hardware_name $test_cable -device_name $test_device
|
open_device -hardware_name $test_cable -device_name $test_device
|
# Retrieve device id code.
|
# Retrieve device id code.
|
device_lock -timeout 5
|
device_lock -timeout 5
|
device_ir_shift -ir_value 6 -no_captured_ir_value
|
device_ir_shift -ir_value 6 -no_captured_ir_value
|
set idcode "0x[device_dr_shift -length 32 -value_in_hex]"
|
set idcode "0x[device_dr_shift -length 32 -value_in_hex]"
|
device_unlock
|
device_unlock
|
|
close_device
|
return $idcode
|
return $idcode
|
}
|
}
|
|
|
proc close_jtag_device {} {
|
proc close_jtag_device {} {
|
close_device
|
close_device
|
Line 118... |
Line 139... |
}
|
}
|
|
|
proc select_device {{cableNum 1} {deviceNum 1}} {
|
proc select_device {{cableNum 1} {deviceNum 1}} {
|
global log
|
global log
|
global device_list
|
global device_list
|
|
global test_cable
|
|
global test_device
|
$log insert end "\n****************************************\n"
|
$log insert end "\n****************************************\n"
|
set test_cable [lindex $device_list [expr 2*$cableNum-2]]
|
set test_cable [lindex $device_list [expr 2*$cableNum-2]]
|
$log insert end "Selected Cable : $test_cable\n"
|
$log insert end "Selected Cable : $test_cable\n"
|
set test_device [lindex [lindex $device_list [expr 2*$cableNum-1]] [expr $deviceNum-1]]
|
set test_device [lindex [lindex $device_list [expr 2*$cableNum-1]] [expr $deviceNum-1]]
|
$log insert end "Selected Device: $test_device\n"
|
$log insert end "Selected Device: $test_device\n"
|
set jtagIdCode [open_jtag_device $test_cable $test_device]
|
set jtagIdCode [open_jtag_device $test_cable $test_device]
|
$log insert end "Device ID code : $jtagIdCode\n"
|
$log insert end "Device ID code : $jtagIdCode\n"
|
|
|
reset_fifo 0
|
reset_fifo 0
|
query_usedw 0
|
query_usedw 0
|
}
|
}
|
|
|
proc updateAddrConfig {} {
|
proc updateAddrConfig {} {
|