diff --git a/README.rst b/README.rst index 2455463..e40f6f2 100644 --- a/README.rst +++ b/README.rst @@ -68,6 +68,8 @@ reads from register at offset 0x0 which is the "Device identification" register. tilestate ========= +Requires 14.2.0 tools or newer. + The tilestate script defines functions that can be used to debug the state of xCORE hardware resources. Example usage:: @@ -122,3 +124,14 @@ all resources, then after sourcing the tilestate script do:: following flag after sourcing the script:: (gdb) set $res_print_details = 1 +watchstack +========== + +Requires 14.3.0 tools or newer. + +Can be run to print the stack usage of each core within a design:: + + gdb BIN < watchstack + +Note: It has to be run this way rather than the -x in order to ignore the errors when +checking whether there are multiple cores on a tile. diff --git a/tilestate b/tilestate index 20d944a..2d0ec00 100644 --- a/tilestate +++ b/tilestate @@ -166,6 +166,13 @@ define res_print_port resreg $tile $resourceId $PS_RDYSRC set $rdySrc = $resregval printf " clkSrc=0x%08x, rdySrc=0x%08x\n", $clkSrc, $rdySrc + + # VECTOR/EV + resreg $tile $resourceId $PS_VECTOR + set $vector = $resregval + resreg $tile $resourceId $PS_EV + set $ev = $resregval + printf " vector=0x%08x, ev=0x%08x\n", $vector, $ev end end @@ -222,6 +229,13 @@ define res_print_timer printf "EV=0x%x, ", $resregval end printf "tWaiting=%d, tNum=%d\n", $tWaiting, $tNum + + # VECTOR/EV + resreg $tile $resourceId $PS_VECTOR + set $vector = $resregval + resreg $tile $resourceId $PS_EV + set $ev = $resregval + printf " vector=0x%08x, ev=0x%08x\n", $vector, $ev end end @@ -260,7 +274,7 @@ define res_print_chanend printf "Chanend %d:\n", $chanend printf " inUse=%d, ieMode=", $inUse res_print_if $ieMode "I" "E" - printf ", ieEnabled=%d, ready=%d, cond=", $ieEnabled, $ready + printf ", ieEnabled=%d, ready=%d, cond=", $ieEnabled, $inReady res_print_cond $cond printf "\n " if $evValid @@ -275,6 +289,13 @@ define res_print_chanend set $dest = $resregval printf " dest=0x%08x\n", $dest + + # VECTOR/EV + resreg $tile $resourceId $PS_VECTOR + set $vector = $resregval + resreg $tile $resourceId $PS_EV + set $ev = $resregval + printf " vector=0x%08x, ev=0x%08x\n", $vector, $ev end end diff --git a/watchstack b/watchstack new file mode 100644 index 0000000..6440b15 --- /dev/null +++ b/watchstack @@ -0,0 +1,38 @@ +define install_breakpoints + # Check whether there are actually multiple cores + set $start_other_addr = &__start_other_cores + 62 + if ($start_other_addr) + break __start_core + commands + getthread + stackfor $r1 + set $nbytes = $nstackwords * 4 + set $base = $sp - $nbytes + set $mask = 0xff - (1 << $xcore_current_thread) + printf "%d:%d: watchrange 0x%x %d 0x%x\n", $xcore_current_tile, $xcore_current_thread, $base, $nbytes, $mask + continue + end + + # Address of the bla instruction + break *$start_other_addr + commands + getthread + stackfor $r11 + set $nbytes = $nstackwords * 4 + set $base = $sp - $nbytes + set $mask = 0xff - (1 << $xcore_current_thread) + printf "%d:%d: watchrange 0x%x %d 0x%x\n", $xcore_current_tile, $xcore_current_thread, $base, $nbytes, $mask + continue + end + end +end + +connect + +tile 0 +install_breakpoints + +tile 1 +install_breakpoints + +run