Skip to content

Commit

Permalink
Add read memory test to TCL script.
Browse files Browse the repository at this point in the history
  • Loading branch information
rslawson committed Feb 20, 2025
1 parent dce5cc9 commit df7be18
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions bittide-instances/data/openocd/vexriscv-2chain.tcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# SPDX-FileCopyrightText: 2025 Google LLC
#
# SPDX-License-Identifier: Apache-2.0

echo "Scanning JTAG chain"
scan_chain
echo "Listing names of devices in JTAG chain"
foreach t [jtag names] {
puts [format "TAP: %s\n" $t]
}

set user_gdb_port_a [env DEV_A_GDB]
if { $user_gdb_port_a == "" } {
error "Required environment variable 'DEV_A_GDB' not set."
Expand Down Expand Up @@ -49,17 +57,26 @@ set _CHIPNAME vexrisc_ocd
jtag newtap $_CHIPNAME chain0 -expected-id $_CPUTAPID -irlen 4 -ircapture 0x1 -irmask 0x0F
jtag newtap $_CHIPNAME chain1 -expected-id $_CPUTAPID -irlen 4 -ircapture 0x1 -irmask 0x03

target create $_CHIPNAME.cpu1 vexriscv -endian $_ENDIAN -chain-position $_CHIPNAME.chain0 -gdb-port $user_gdb_port_b
tcl_port $user_tcl_port_b
telnet_port $user_tel_port_b
target create $_CHIPNAME.cpu0 vexriscv -endian $_ENDIAN -chain-position $_CHIPNAME.chain1 -gdb-port $user_gdb_port_a
vexriscv readWaitCycles 10
vexriscv cpuConfigFile [file join $git_top_level clash-vexriscv clash-vexriscv example-cpu ExampleCpu.yaml]

target create $_CHIPNAME.cpu0 vexriscv -endian $_ENDIAN -chain-position $_CHIPNAME.chain1 -gdb-port $user_gdb_port_a
set cpu0_read_test [mdb 0xE0000000 4]
puts [format "TEST 1: %08x" $cpu0_read_test]
set cpu0_read_test_phys [mdb phys 0xE0000000 4]
puts [format "TEST PHYS 1: %08x" $cpu0_read_test_phys]
tcl_port $user_tcl_port_a
telnet_port $user_tel_port_a


target create $_CHIPNAME.cpu1 vexriscv -endian $_ENDIAN -chain-position $_CHIPNAME.chain0 -gdb-port $user_gdb_port_b
vexriscv readWaitCycles 10
vexriscv cpuConfigFile [file join $git_top_level clash-vexriscv clash-vexriscv example-cpu ExampleCpu.yaml]
set cpu1_read_test [mdb 0xE0000000 4]
puts [format "TEST 2: %08x" $cpu1_read_test]
set cpu1_read_test_phys [mdb phys 0xE0000000 4]
puts [format "TEST PHYS 2: %08x" $cpu1_read_test_phys]
tcl_port $user_tcl_port_b
telnet_port $user_tel_port_b

poll_period 50

Expand Down

0 comments on commit df7be18

Please sign in to comment.