From: Luke Kenneth Casson Leighton Date: Mon, 21 Sep 2020 15:37:20 +0000 (+0100) Subject: add DMI JTAG test X-Git-Tag: 24jan2021_ls180~366 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93d363b8ce543230ac3f2df9859337ce0f2691e3;p=soc.git add DMI JTAG test --- diff --git a/src/soc/debug/dmi2jtag.py b/src/soc/debug/dmi2jtag.py index 2d2d2ce9..85847ad7 100644 --- a/src/soc/debug/dmi2jtag.py +++ b/src/soc/debug/dmi2jtag.py @@ -6,7 +6,7 @@ based on Staf Verhaegen (Chips4Makers) wishbone TAP from nmigen import (Module, Signal, Elaboratable, Const) from nmigen.cli import rtlil from c4m.nmigen.jtag.tap import TAP, IOType -from soc.debug.dmi import DMIInterface +from soc.debug.dmi import DMIInterface, DBGCore from nmigen.back.pysim import Simulator, Delay, Settle, Tick from nmutil.util import wrap @@ -88,7 +88,7 @@ class DMITAP(TAP): cd = m.d[domain] m.d.comb += sr_addr.i.eq(dmi.addr_i) - with m.FSM(domain=domain) as fsm: + with m.FSM(domain=domain) as ds: # detect mode based on whether jtag addr or data read/written with m.State("IDLE"): @@ -100,7 +100,7 @@ class DMITAP(TAP): cd += dmi.addr_i.eq(dmi.addr_i + 1) m.next = "READ" with m.Elif(sr_data.oe[1]): # DMIWRITE code - cd += dmi.dout.eq(sr_data.o) + cd += dmi.din.eq(sr_data.o) m.next = "WRITE" # req_i raises for 1 clock @@ -109,9 +109,9 @@ class DMITAP(TAP): # wait for read ack with m.State("READACK"): - with m.If(dmi.ack): + with m.If(dmi.ack_o): # Store read data in sr_data.i hold till next read - cd += sr_data.i.eq(dmi.din) + cd += sr_data.i.eq(dmi.dout) m.next = "IDLE" # req_i raises for 1 clock @@ -120,14 +120,15 @@ class DMITAP(TAP): # wait for write ack with m.State("WRITEACK"): - with m.If(dmi.ack): + with m.If(dmi.ack_o): cd += dmi.addr_i.eq(dmi.addr_i + 1) + m.next = "IDLE" #m.next = "READ" - for readwrite # set DMI req and write-enable based on ongoing FSM states m.d.comb += [ - dmi.req_i.eq(fsm.ongoing("READ") | fsm.ongoing("WRITE")), - dmi.we_i.eq(fsm.ongoing("WRITE")), + dmi.req_i.eq(ds.ongoing("READ") | ds.ongoing("WRITE")), + dmi.we_i.eq(ds.ongoing("WRITE")), ] @@ -147,9 +148,9 @@ def tms_data_getset(dut, tms, d_len, d_in=0): for i in range(d_len): tdi = 1 if (d_in & (1<