soc/cores/cpu: Implement add_jtag method

Implement add_jtag method for naxriscv, vexiiriscv and vexriscv_smp,
which is the de facto way to add JTAG ports to pads on other CPUs.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
This commit is contained in:
Jiaxun Yang 2024-06-18 14:14:52 +01:00
parent 63d72a87e6
commit a8b3f36592
No known key found for this signature in database
GPG Key ID: 43710C7DD77729C3
3 changed files with 24 additions and 0 deletions

View File

@ -462,6 +462,14 @@ class NaxRiscv(CPU):
self.soc_bus = soc.bus # FIXME: Save SoC Bus instance to retrieve the final mem layout on finalization.
def add_jtag(self, pads):
self.comb += [
self.jtag_tms.eq(pads.tms),
self.jtag_clk.eq(pads.tck),
self.jtag_tdi.eq(pads.tdi),
pads.tdo.eq(self.jtag_tdo),
]
def add_memory_buses(self, address_width, data_width):
NaxRiscv.litedram_width = data_width
nax_data_width = 64

View File

@ -527,6 +527,14 @@ class VexiiRiscv(CPU):
i_mBus_rlast = mbus.r.last,
)
def add_jtag(self, pads):
self.comb += [
self.jtag_tms.eq(pads.tms),
self.jtag_clk.eq(pads.tck),
self.jtag_tdi.eq(pads.tdi),
pads.tdo.eq(self.jtag_tdo),
]
def do_finalize(self):
assert hasattr(self, "reset_address")

View File

@ -463,6 +463,14 @@ class VexRiscvSMP(CPU):
add_synthesis_define(cluster_filename)
platform.add_source(cluster_filename, "verilog")
def add_jtag(self, pads):
self.comb += [
self.jtag_tms.eq(pads.tms),
self.jtag_clk.eq(pads.tck),
self.jtag_tdi.eq(pads.tdi),
pads.tdo.eq(self.jtag_tdo),
]
def add_soc_components(self, soc):
if self.variant == "linux":
# Set UART/Timer0 CSRs to the ones used by OpenSBI.