phy/ecp5ddrphy: improve presentation/readability
This commit is contained in:
parent
bb1b431184
commit
e0966e2ed3
|
@ -1,5 +1,5 @@
|
|||
# This file is Copyright (c) 2019 David Shah <dave@ds0.me>
|
||||
# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||
# This file is Copyright (c) 2019-2020 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||
# License: BSD
|
||||
|
||||
# 1:2 frequency-ratio DDR3 PHY for Lattice's ECP5
|
||||
|
@ -141,8 +141,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
# Clock ------------------------------------------------------------------------------------
|
||||
for i in range(len(pads.clk_p)):
|
||||
sd_clk_se = Signal()
|
||||
self.specials += [
|
||||
Instance("ODDRX2F",
|
||||
self.specials += Instance("ODDRX2F",
|
||||
i_D0 = 0,
|
||||
i_D1 = 1,
|
||||
i_D2 = 0,
|
||||
|
@ -151,13 +150,11 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
i_SCLK = ClockSignal(),
|
||||
i_RST = ResetSignal("sys2x"),
|
||||
o_Q = pads.clk_p[i]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
# Addresses and Commands -------------------------------------------------------------------
|
||||
for i in range(addressbits):
|
||||
self.specials += \
|
||||
Instance("ODDRX2F",
|
||||
self.specials += Instance("ODDRX2F",
|
||||
i_D0 = dfi.phases[0].address[i],
|
||||
i_D1 = dfi.phases[0].address[i],
|
||||
i_D2 = dfi.phases[1].address[i],
|
||||
|
@ -168,8 +165,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
o_Q = pads.a[i]
|
||||
)
|
||||
for i in range(bankbits):
|
||||
self.specials += \
|
||||
Instance("ODDRX2F",
|
||||
self.specials += Instance("ODDRX2F",
|
||||
i_D0 = dfi.phases[0].bank[i],
|
||||
i_D1 = dfi.phases[0].bank[i],
|
||||
i_D2 = dfi.phases[1].bank[i],
|
||||
|
@ -186,8 +182,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
controls.append("cs_n")
|
||||
for name in controls:
|
||||
for i in range(len(getattr(pads, name))):
|
||||
self.specials += \
|
||||
Instance("ODDRX2F",
|
||||
self.specials += Instance("ODDRX2F",
|
||||
i_D0 = getattr(dfi.phases[0], name)[i],
|
||||
i_D1 = getattr(dfi.phases[0], name)[i],
|
||||
i_D2 = getattr(dfi.phases[1], name)[i],
|
||||
|
@ -293,8 +288,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
).Else(
|
||||
dm_o_data_muxed.eq(dm_o_data[:4])
|
||||
)
|
||||
self.specials += \
|
||||
Instance("ODDRX2DQA",
|
||||
self.specials += Instance("ODDRX2DQA",
|
||||
i_D0 = dm_o_data_muxed[0],
|
||||
i_D1 = dm_o_data_muxed[1],
|
||||
i_D2 = dm_o_data_muxed[2],
|
||||
|
@ -308,7 +302,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
|
||||
dqs = Signal()
|
||||
dqs_oe_n = Signal()
|
||||
self.specials += \
|
||||
self.specials += [
|
||||
Instance("ODDRX2DQSB",
|
||||
i_D0 = dqs_serdes_pattern[0],
|
||||
i_D1 = dqs_serdes_pattern[1],
|
||||
|
@ -319,8 +313,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
i_ECLK = ClockSignal("sys2x"),
|
||||
i_SCLK = ClockSignal(),
|
||||
o_Q = dqs
|
||||
)
|
||||
self.specials += \
|
||||
),
|
||||
Instance("TSHX2DQSA",
|
||||
i_T0 = ~(oe_dqs|dqs_postamble),
|
||||
i_T1 = ~(oe_dqs|dqs_preamble),
|
||||
|
@ -329,8 +322,9 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
i_DQSW = dqsw,
|
||||
i_RST = ResetSignal("sys2x"),
|
||||
o_Q = dqs_oe_n,
|
||||
)
|
||||
self.specials += Tristate(pads.dqs_p[i], dqs, ~dqs_oe_n, dqs_i)
|
||||
),
|
||||
Tristate(pads.dqs_p[i], dqs, ~dqs_oe_n, dqs_i)
|
||||
]
|
||||
|
||||
for j in range(8*i, 8*(i+1)):
|
||||
dq_o = Signal()
|
||||
|
@ -354,7 +348,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
).Else(
|
||||
dq_o_data_muxed.eq(dq_o_data[:4])
|
||||
)
|
||||
self.specials += \
|
||||
self.specials += [
|
||||
Instance("ODDRX2DQA",
|
||||
i_D0 = dq_o_data_muxed[0],
|
||||
i_D1 = dq_o_data_muxed[1],
|
||||
|
@ -365,8 +359,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
i_ECLK = ClockSignal("sys2x"),
|
||||
i_SCLK = ClockSignal(),
|
||||
o_Q = dq_o
|
||||
)
|
||||
self.specials += \
|
||||
),
|
||||
Instance("DELAYF",
|
||||
i_A = dq_i,
|
||||
i_LOADN = 1,
|
||||
|
@ -374,8 +367,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
i_DIRECTION = 0,
|
||||
o_Z = dq_i_delayed,
|
||||
p_DEL_MODE = "DQS_ALIGNED_X2"
|
||||
)
|
||||
self.specials += \
|
||||
),
|
||||
Instance("IDDRX2DQA",
|
||||
i_D = dq_i_delayed,
|
||||
i_RST = ResetSignal("sys2x"),
|
||||
|
@ -393,6 +385,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
o_Q2 = dq_i_data[2],
|
||||
o_Q3 = dq_i_data[3],
|
||||
)
|
||||
]
|
||||
dq_bitslip = BitSlip(4)
|
||||
self.comb += dq_bitslip.i.eq(dq_i_data)
|
||||
self.sync += \
|
||||
|
@ -412,7 +405,7 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
dfi.phases[1].rddata[0*databits+j].eq(dq_bitslip.o[0]), dfi.phases[1].rddata[1*databits+j].eq(dq_bitslip.o[1]),
|
||||
dfi.phases[1].rddata[2*databits+j].eq(dq_bitslip.o[2]), dfi.phases[1].rddata[3*databits+j].eq(dq_bitslip.o[3]),
|
||||
]
|
||||
self.specials += \
|
||||
self.specials += [
|
||||
Instance("TSHX2DQA",
|
||||
i_T0 = ~oe_dq,
|
||||
i_T1 = ~oe_dq,
|
||||
|
@ -421,8 +414,9 @@ class ECP5DDRPHY(Module, AutoCSR):
|
|||
i_DQSW270 = dqsw270,
|
||||
i_RST = ResetSignal("sys2x"),
|
||||
o_Q = dq_oe_n,
|
||||
)
|
||||
self.specials += Tristate(pads.dq[j], dq_o, ~dq_oe_n, dq_i)
|
||||
),
|
||||
Tristate(pads.dq[j], dq_o, ~dq_oe_n, dq_i)
|
||||
]
|
||||
|
||||
# Flow control -----------------------------------------------------------------------------
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue