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