Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- How do I: - Scan for all available jtag2avalon master? --- Quote End --- This code should do it
foreach m {
array set info
puts "Found master at $info(FULL_HPATH)"
} --- Quote Start --- - How do I assign a tcl variable MASTER, to the board that has the switch to one? So that I can use that MASTER in my other procedures for doing master_functions. For example "lit led 0 if you are a master board" - And the same question for the slave. --- Quote End --- I assume you have a PIO slave which can read the value of the switch, and that this slave is mastered by an altera_jtag_avalon_master or altera_usb_debug_master. Maybe something like this (I think I got the brackets right but please check):
foreach m {
array set info
if {$info(FULL_HPATH) == "my|expected|hpath"} {
set mm
set v
if {$v == 1} {
set master_on_master_board $m
} else {
set master_on_slave_board $m
}
close_service master $mm
}
} --- Quote Start --- Situation 2: This should be dynamic. When I have this running, I want to be able to switch both boards in the other mode. Meaning, the master becomes slave, and the slave becomes master. I would like to run the same script without modifying it, and detect the new master and new slave board. Is that possible? --- Quote End --- Yes, this is possible, you'll need to keep reading from the PIO slaves and arrange to swap your masters over when the roles change. The Tcl after (http://www.tcl.tk/man/tcl8.5/tclcmd/after.htm) command can be used to do this sort of thing (but make sure you have a way to cancel the after). --- Quote Start --- Situation 3: Now I start debugging, and add sometimes a NIOS with a jtag_uart, sometimes signaltap, sometimes both and sometimes none. Can this script then still identify the jtag2avalon master and detect the master board and the slave board? I assume that the nios has certain "jtag_identifier_code", and the signaltap as well. --- Quote End --- Each debug node has an identifier code which is used by the tools to work out which drivers need to be used to control it. SignalTap, JTAG UART, Nios II processor, JTAG debug link etc all have different IDs.