From: Luke Kenneth Casson Leighton Date: Thu, 8 Oct 2020 12:21:36 +0000 (+0100) Subject: split out jtag util functions to separate module X-Git-Tag: 24jan2021_ls180~190 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a79458910484147f011d0da2ddcbe5179019a3be;p=soc.git split out jtag util functions to separate module --- 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<