phy/gensdrphy: add assertions on length of pads.dq/pads.dq

Allow detecting platform file issues similar to #88, #89 earlier.
This commit is contained in:
Florent Kermarrec 2019-08-04 15:06:34 +02:00
parent 6c53996a70
commit 8573c22cc1
1 changed files with 2 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class GENSDRPHY(Module):
bankbits = len(pads.ba) bankbits = len(pads.ba)
nranks = 1 if not hasattr(pads, "cs_n") else len(pads.cs_n) nranks = 1 if not hasattr(pads, "cs_n") else len(pads.cs_n)
databits = len(pads.dq) databits = len(pads.dq)
assert databits%8 == 0
self.settings = PhySettings( self.settings = PhySettings(
memtype="SDR", memtype="SDR",
@ -68,6 +69,7 @@ class GENSDRPHY(Module):
self.sync += dq_o.eq(dfi.p0.wrdata) self.sync += dq_o.eq(dfi.p0.wrdata)
self.specials += Tristate(pads.dq, dq_o, dq_oe, dq_i) self.specials += Tristate(pads.dq, dq_o, dq_oe, dq_i)
if hasattr(pads, "dm"): if hasattr(pads, "dm"):
assert len(pads.dm)*8 == databits
self.sync += \ self.sync += \
If(dfi.p0.wrdata_en, If(dfi.p0.wrdata_en,
pads.dm.eq(dfi.p0.wrdata_mask) pads.dm.eq(dfi.p0.wrdata_mask)