Skip to content

Commit

Permalink
soc/cores/hyperbus: Make DQ/RWDS input sync explicit to allow IO Reg.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Aug 20, 2024
1 parent 8b86b16 commit 1998c74
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions litex/soc/cores/hyperbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,20 @@ def __init__(self, pads, latency=6, latency_mode="variable", sys_clk_freq=10e6,
dq = self.add_tristate(pads.dq, register=False) if not hasattr(pads.dq, "oe") else pads.dq
rwds = self.add_tristate(pads.rwds, register=False) if not hasattr(pads.rwds, "oe") else pads.rwds
self.comb += [
# DQ.
# DQ O/OE.
dq.o.eq( dq_o),
dq.oe.eq(dq_oe),
dq_i.eq( dq.i),

# RWDS.
# RWDS O/OE.
rwds.o.eq( rwds_o),
rwds.oe.eq(rwds_oe),
rwds_i.eq( rwds.i),
]
self.sync += [
# DQ I.
dq_i.eq(dq.i),

# RWDS I.
rwds_i.eq(rwds.i)
]

# Drive Control Signals --------------------------------------------------------------------
Expand Down Expand Up @@ -151,20 +156,18 @@ def __init__(self, pads, latency=6, latency_mode="variable", sys_clk_freq=10e6,
self.comb += Case(clk_phase, cases)

# Data Shift-In Register -------------------------------------------------------------------
dqi = Signal(dw)
self.sync += dqi.eq(dq_i) # Sample on 90° and 270° Clk Phases.
self.comb += [
# Command/Address: On 8-bit, so 8-bit shift and no input.
If(ca_oe,
sr_next[8:].eq(sr),
# Data: On dw-bit, so dw-bit shift.
).Else(
sr_next[:dw].eq(dqi),
sr_next[:dw].eq(dq_i),
sr_next[dw:].eq(sr),

)
]
self.sync += If(clk_phase[0] == 0, sr.eq(sr_next)) # Shift on 0° and 180° Clk Phases.
self.sync += If(clk_phase[0] == 0, sr.eq(sr_next)) # Shift on 0°/180° (and sampled on 90°/270°).

# Data Shift-Out Register ------------------------------------------------------------------
self.comb += [
Expand Down

0 comments on commit 1998c74

Please sign in to comment.