From a79458910484147f011d0da2ddcbe5179019a3be Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 8 Oct 2020 13:21:36 +0100 Subject: [PATCH] split out jtag util functions to separate module --- src/soc/debug/jtagutils.py | 215 ++++++++++++++++++++++++ src/soc/debug/test/jtagremote.py | 112 +----------- src/soc/debug/test/test_jtag_tap_srv.py | 100 +---------- 3 files changed, 220 insertions(+), 207 deletions(-) create mode 100644 src/soc/debug/jtagutils.py diff --git a/src/soc/debug/jtagutils.py b/src/soc/debug/jtagutils.py new file mode 100644 index 00000000..1dee686c --- /dev/null +++ b/src/soc/debug/jtagutils.py @@ -0,0 +1,215 @@ +#The server code +import socket +from socket import close, AF_INET, SOCK_STREAM +import sys +import select +import time + + +def client_sync(dut): + tck = yield dut.cbus.tck + tms = yield dut.cbus.tms + tdi = yield dut.cbus.tdi + dut.c.jtagremote_client_send((tck, tms, tdi)) + #print ("about to client recv") + while True: + tdo = dut.c.jtagremote_client_recv(timeout=0) + if tdo is not None: + break + yield + yield dut.cbus.tdo.eq(tdo) + + +def tms_state_set(dut, bits): + for bit in bits: + yield dut.cbus.tck.eq(1) + yield dut.cbus.tms.eq(bit) + yield from client_sync(dut) + yield + yield dut.cbus.tck.eq(0) + yield from client_sync(dut) + yield + yield from client_sync(dut) + yield dut.cbus.tms.eq(0) + yield from client_sync(dut) + + +def tms_data_getset(dut, tms, d_len, d_in=0): + res = 0 + yield dut.cbus.tms.eq(tms) + for i in range(d_len): + tdi = 1 if (d_in & (1<