--- /dev/null
+#The server code
+import socket
+from socket import close, AF_INET, SOCK_STREAM
+import sys
+import select
+import time
+
+from jtagutils import JTAGServer, JTAGClient
+
+
+def test_clientserver_jtagremote():
+ s = JTAGServer()
+ c = JTAGClient()
+ s.get_connection()
+
+ c.jtagremote_client_send((1, 0, 1))
+ while True:
+ resp = s.jtagremote_server_recv(1)
+ if resp is not None:
+ print ("response", resp)
+ break
+
+ while True:
+ resp = s.jtagremote_server_recv(1)
+ if resp is not None:
+ print ("response", resp)
+ break
+
+ tdo = c.jtagremote_client_recv()
+ print ("client recv", tdo)
+
+ s.close()
+ c.close()
+
+
+def test_clientserver():
+ s = JTAGServer()
+ c = JTAGClient()
+ s.get_connection()
+
+ c.send(str.encode("h"))
+ while True:
+ resp = s.get_data()
+ if resp is not None:
+ print ("response", resp)
+ break
+ s.close()
+ c.close()
+
+
+if __name__ == '__main__':
+ #test_clientserver()
+ test_clientserver_jtagremote()
+
-"""DMI 2 JTAG test
+"""JTAG test copied from soc/debug/test/test_jtag_tap_srv.py
+Trying to avoid using soc modules here
based on Staf Verhaegen (Chips4Makers) wishbone TAP
"""
from c4m.nmigen.jtag.bus import Interface as JTAGInterface
#from soc.debug.dmi import DMIInterface, DBGCore
#from soc.debug.test.dmi_sim import dmi_sim
-from soc.debug.jtag import JTAG
-from soc.debug.test.jtagremote import JTAGServer, JTAGClient
+from jtag import JTAG, resiotypes
+from jtagremote import JTAGServer, JTAGClient
#from soc.bus.sram import SRAM
from nmigen import Memory, Signal, Module
-from nmigen.back.pysim import Simulator, Delay, Settle, Tick
+from nmigen.sim import Simulator, Delay, Settle, Tick
from nmutil.util import wrap
-from soc.debug.jtagutils import (jtag_read_write_reg,
- jtag_srv, jtag_set_reset,
- jtag_set_ir, jtag_set_get_dr)
+from jtagutils import (jtag_read_write_reg,
+ jtag_srv, jtag_set_reset,
+ jtag_set_ir, jtag_set_get_dr)
def test_pinset():
return {
if __name__ == '__main__':
- dut = JTAG(test_pinset(), wb_data_wid=64)
+ # Not sure if need to specify wb_data width here
+ dut = JTAG(test_pinset(), "sync") # , wb_data_wid=64)
dut.stop = False
# rather than the client access the JTAG bus directly
cdut._ir_width = dut._ir_width
cdut.scan_len = dut.scan_len
- memory = Memory(width=64, depth=16)
- sram = SRAM(memory=memory, bus=dut.wb)
+ #memory = Memory(width=64, depth=16)
+ #sram = SRAM(memory=memory, bus=dut.wb)
m = Module()
m.submodules.ast = dut
- m.submodules.sram = sram
+ #m.submodules.sram = sram
sim = Simulator(m)
sim.add_clock(1e-6, domain="sync") # standard clock