From f805c657efd58e9b3e2e9857e9fecd14abe41f92 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 26 Sep 2020 16:06:42 +0100 Subject: [PATCH] get openocd svf test running, replicating jtag test --- src/soc/debug/test/idcode_test2.svf | 46 +++++++++++++++++++++++++ src/soc/debug/test/openocd.cfg | 15 ++++++++ src/soc/debug/test/test_jtag_tap_srv.py | 12 +++---- src/soc/litex/florent/idcode_test2.svf | 6 ++-- 4 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 src/soc/debug/test/idcode_test2.svf create mode 100644 src/soc/debug/test/openocd.cfg diff --git a/src/soc/debug/test/idcode_test2.svf b/src/soc/debug/test/idcode_test2.svf new file mode 100644 index 00000000..a7545e01 --- /dev/null +++ b/src/soc/debug/test/idcode_test2.svf @@ -0,0 +1,46 @@ +STATE RESET IDLE; +TIR 0 ; +HIR 5 TDI (1f) SMASK (1f) ; +//HDR 1 TDI (00) SMASK (01) ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 4 TDI (1) SMASK (f) ; +//SDR 32 TDI (00000000) SMASK (ffffffff) TDO (00000c7f) SMASK (ffffffff) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (000018ff) MASK (ffffffff) ; +// + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "ctrl" address (0) +SDR 8 TDI (0) SMASK (ff) ; +// set to DMI "data read" +SIR 4 TDI (9) SMASK (f) ; +// read 64 bit +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (0000000000000004) MASK (ffffffffffffffff) ; + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "ctrl" address (0) +SDR 8 TDI (0) SMASK (ff) ; +// set to DMI "data write-read" +SIR 4 TDI (a) SMASK (f) ; +// write-read 64 bit +SDR 64 TDI (0000000000000002) SMASK (ffffffffffffffff) TDO (0000000000000004) MASK (ffffffffffffffff) ; + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "ctrl" address (0) +SDR 8 TDI (0) SMASK (ff) ; +// set to DMI "data read" +SIR 4 TDI (9) SMASK (f) ; +// read 64 bit +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (0000000000000002) MASK (ffffffffffffffff) ; + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "MSR" address (3) +SDR 8 TDI (3) SMASK (ff) ; +// set to DMI "data read" +SIR 4 TDI (9) SMASK (f) ; +// read 64 bit +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (00000000deadbeef) MASK (ffffffffffffffff) ; diff --git a/src/soc/debug/test/openocd.cfg b/src/soc/debug/test/openocd.cfg new file mode 100644 index 00000000..a3c7084a --- /dev/null +++ b/src/soc/debug/test/openocd.cfg @@ -0,0 +1,15 @@ + +interface remote_bitbang +remote_bitbang_port 44853 +remote_bitbang_host localhost + +# this should be irlen=4 +jtag newtap libresoc tap -irlen 4 -irmask 0xf -ircapture 0xf -expected-id 0x000018ff + +#set _TARGETNAME libresoc.tap +#target create $_TARGETNAME.0 ppc64 -chain-position $_TARGETNAME -rtos hwthread + +# Configure work area in on-chip SRAM +#$_TARGETNAME.0 configure -work-area-phys 0x80000000 \ +# -work-area-size 1000 -work-area-backup 0 + diff --git a/src/soc/debug/test/test_jtag_tap_srv.py b/src/soc/debug/test/test_jtag_tap_srv.py index e8d31bae..74df1c51 100644 --- a/src/soc/debug/test/test_jtag_tap_srv.py +++ b/src/soc/debug/test/test_jtag_tap_srv.py @@ -96,14 +96,14 @@ def jtag_read_write_reg(dut, addr, d_len, d_in=0): # JTAG-ircodes for accessing DMI -DMI_ADDR = 5 -DMI_READ = 6 -DMI_WRRD = 7 +DMI_ADDR = 8 +DMI_READ = 9 +DMI_WRRD = 10 # JTAG-ircodes for accessing Wishbone -WB_ADDR = 8 -WB_READ = 9 -WB_WRRD = 10 +WB_ADDR = 5 +WB_READ = 6 +WB_WRRD = 7 def jtag_srv(dut): diff --git a/src/soc/litex/florent/idcode_test2.svf b/src/soc/litex/florent/idcode_test2.svf index d2112fc0..a21eb261 100644 --- a/src/soc/litex/florent/idcode_test2.svf +++ b/src/soc/litex/florent/idcode_test2.svf @@ -4,17 +4,17 @@ HIR 5 TDI (1f) SMASK (1f) ; //HDR 1 TDI (00) SMASK (01) ; TDR 0 ; //Loading device with 'idcode' instruction. -SIR 4 TDI (1) SMASK (1) ; +SIR 4 TDI (1) SMASK (f) ; //SDR 32 TDI (00000000) SMASK (ffffffff) TDO (00000c7f) SMASK (ffffffff) ; SDR 32 TDI (00000000) SMASK (ffffffff) TDO (000018ff) MASK (ffffffff) ; // // set to DMI "address" SIR 4 TDI (8) SMASK (f) ; // set DMI "ctrl" address (0) -SDR 8 TDI (2) SMASK (ff) ; +SDR 8 TDI (0) SMASK (ff) ; // set to DMI "data read" SIR 4 TDI (9) SMASK (f) ; // read 64 bit //SDR 32 TDI (00000000) SMASK (ffffffff) TDO (000018ff) MASK (ffffffff) ; //SDR 32 TDI (00000000) SMASK (00000000) TDO (00000000) MASK (ffffffff) ; -SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (0000000000000000) MASK (ffffffffffffffff) ; +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (0000000000000004) MASK (ffffffffffffffff) ; -- 2.30.2