self.we_i = Signal() # DMI write-enable
self.ack_o = Signal() # DMI ack request
+ def connect_to(self, other):
+ return [self.addr_i.eq(other.addr_i),
+ self.req_i.eq(other.req_i),
+ self.we_i.eq(other.we_i),
+ self.din.eq(other.din),
+ other.ack_o.eq(self.ack_o),
+ other.dout.eq(self.dout),
+ ]
class DbgReg(RecordObject):
def __init__(self, name):
dmi.we_i.eq(ds.ongoing("WRRD")),
]
+ def external_ports(self):
+ return [self.bus.tdo, self.bus.tdi, self.bus.tms, self.bus.tck]
+
if __name__ == '__main__':
dut = DMITAP(ir_width=4)
# create and connect wishbone
self.wb = self.add_wishbone(ircodes=[5, 6, 7],
- address_width=29, data_width=64)
+ address_width=29, data_width=64,
+ name="jtag_wb")
# create DMI2JTAG (goes through to dmi_sim())
self.dmi = self.add_dmi(ircodes=[8, 9, 10])
def elaborate(self, platform):
return super().elaborate(platform)
+ def external_ports(self):
+ ports = super().external_ports()
+ ports += list(self.wb.fields.values())
+ return ports
+
if __name__ == '__main__':
dut = JTAG()
from soc.config.ifetch import ConfigFetchUnit
from soc.decoder.power_enums import MicrOp
from soc.debug.dmi import CoreDebug, DMIInterface
+from soc.debug.jtag import JTAG
from soc.config.state import CoreState
from soc.interrupts.xics import XICS_ICP, XICS_ICS
from soc.bus.simple_gpio import SimpleGPIO
# DMI interface
self.dbg = CoreDebug()
+ # JTAG interface
+ self.jtag_en = hasattr(pspec, "debug") and pspec.debug == 'jtag'
+ if self.jtag_en:
+ self.jtag = JTAG()
+
# instruction go/monitor
self.pc_o = Signal(64, reset_less=True)
self.pc_i = Data(64, "pc_i") # set "ok" to indicate "please change me"
m.submodules.core = core = DomainRenamer("coresync")(self.core)
m.submodules.imem = imem = self.imem
m.submodules.dbg = dbg = self.dbg
+ if self.jtag_en:
+ m.submodules.jtag = jtag = self.jtag
+ comb += dbg.dmi.connect_to(jtag.dmi)
cur_state = self.cur_state
ports += [self.pc_o, self.memerr_o, self.core_bigendian_i, self.busy_o,
ClockSignal(), ResetSignal(),
]
- ports += list(self.dbg.dmi.ports())
+
+ if self.jtag_en:
+ ports += list(self.jtag.external_ports())
+ else:
+ # don't add DMI if JTAG is enabled
+ ports += list(self.dbg.dmi.ports())
+
ports += list(self.imem.ibus.fields.values())
ports += list(self.core.l0.cmpi.lsmem.lsi.slavebus.fields.values())
#wb_data_wid=32,
xics=True,
gpio=False, # for test purposes
+ debug="jtag", # set to jtag or dmi
units=units)
dut = TestIssuer(pspec)