Skip to content

Commit

Permalink
soc/cores/jtag: Add p_INIT/p_init workaround on ECP5JTAG to support D…
Browse files Browse the repository at this point in the history
…iamond and Trellis toolchains without manual changes.
  • Loading branch information
enjoy-digital committed Nov 4, 2024
1 parent 4368d5a commit 175e63a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion litex/soc/cores/jtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,17 @@ def __init__(self, tck_delay_luts=8):
i_JTDO1 = self.tdo, # FF(negedge TCK, JTDO1) if (IR==0x32 && FSM==Shift-DR)
)

# NextPnr/Diamond LUT4 p_INIT/p_init workaround.
from litex.build.lattice.diamond import LatticeDiamondToolchain
p_init_name = {False: "p_INIT", True: "p_init"}[isinstance(LiteXContext.toolchain, LatticeDiamondToolchain)]

# TDI/TCK are synchronous on JTAGG output (TDI being registered with TCK). Introduce a delay
# on TCK with multiple LUT4s to allow its use as the JTAG Clk.
for i in range(tck_delay_luts):
new_tck = Signal()
self.specials += Instance("LUT4",
attr = {"keep"},
p_INIT = 2,
**{f"p_{p_init_name}": 2}, # Use toolchain-specific INIT parameter name.
i_A = tck,
i_B = 0,
i_C = 0,
Expand Down

0 comments on commit 175e63a

Please sign in to comment.