phy/usddrphy: simplify/cleanup write control path/dqs postamble/preamble control path.

This commit is contained in:
Florent Kermarrec 2020-04-16 15:20:22 +02:00
parent 57b16c231c
commit 8d0e7f6e6a
1 changed files with 12 additions and 22 deletions

View File

@ -581,30 +581,20 @@ class S7DDRPHY(Module, AutoCSR):
self.sync += [phase.rddata_valid.eq(rddata_en[-1] | self._wlevel_en.storage) for phase in dfi.phases] self.sync += [phase.rddata_valid.eq(rddata_en[-1] | self._wlevel_en.storage) for phase in dfi.phases]
# Write Control Path ----------------------------------------------------------------------- # Write Control Path -----------------------------------------------------------------------
oe = Signal() # Creates a shift register of write commands coming from the DFI interface. This shift register
last_wrdata_en = Signal(cwl_sys_latency + 2) # is used to control DQ/DQS tristates. The DQ/DQS tristates are controlled for 3 sys_clk cycles:
wrphase = dfi.phases[self.settings.wrphase] # Write (1) + Pre/Postamble (2).
self.sync += last_wrdata_en.eq(Cat(wrphase.wrdata_en, last_wrdata_en)) wrdata_en = Signal(cwl_sys_latency + 3)
self.comb += oe.eq( wrdata_en_last = Signal.like(wrdata_en)
last_wrdata_en[cwl_sys_latency + -1] | self.comb += wrdata_en.eq(Cat(dfi.phases[self.settings.wrphase].wrdata_en, wrdata_en_last))
last_wrdata_en[cwl_sys_latency + 0] | self.sync += wrdata_en_last.eq(wrdata_en)
last_wrdata_en[cwl_sys_latency + 1]) self.sync += oe_dq.eq(wrdata_en[cwl_sys_latency:] != 0b000)
self.sync += [ self.comb += If(self._wlevel_en.storage, oe_dqs.eq(1)).Else(oe_dqs.eq(oe_dq))
If(self._wlevel_en.storage,
oe_dqs.eq(1), oe_dq.eq(0)
).Else(
oe_dqs.eq(oe), oe_dq.eq(oe)
)
]
# Write DQS Postamble/Preamble Control Path ------------------------------------------------ # Write DQS Postamble/Preamble Control Path ------------------------------------------------
if memtype == "DDR2": self.sync += [
dqs_sys_latency = cwl_sys_latency - 1 dqs_preamble.eq( wrdata_en[cwl_sys_latency:-1] == 0b10),
elif memtype == "DDR3": dqs_postamble.eq(wrdata_en[cwl_sys_latency+1:] == 0b01),
dqs_sys_latency = cwl_sys_latency - 1 if with_odelay else cwl_sys_latency
self.comb += [
dqs_preamble.eq(last_wrdata_en[dqs_sys_latency - 1] & ~last_wrdata_en[dqs_sys_latency]),
dqs_postamble.eq(last_wrdata_en[dqs_sys_latency + 1] & ~last_wrdata_en[dqs_sys_latency]),
] ]
# Xilinx Virtex7 (S7DDRPHY with odelay) ------------------------------------------------------------ # Xilinx Virtex7 (S7DDRPHY with odelay) ------------------------------------------------------------