common: add PHYPadsReducer to only use specific DRAM modules.
For example on KC705, to only use the 4 first modules (bytes): from litedram.common import PHYPadsReducer ddram_pads = platform.request("ddram") ddram_pads = PHYPadsReducer(ddram_pads, modules=[0, 1, 2, 3]) self.submodules.ddrphy = s7ddrphy.K7DDRPHY(ddram_pads, [...] On Arty, to only use the second module (byte): from litedram.common import PHYPadsReducer ddram_pads = platform.request("ddram") ddram_pads = PHYPadsReducer(ddram_pads, modules=[1]) self.submodules.ddrphy = s7ddrphy.A7DDRPHY(ddram_pads, [...]
This commit is contained in:
parent
20a849c652
commit
9a2d3f0eb9
|
@ -55,6 +55,28 @@ def get_sys_phases(nphases, sys_latency, cas_latency):
|
||||||
|
|
||||||
# PHY Pads Transformers ----------------------------------------------------------------------------
|
# PHY Pads Transformers ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class PHYPadsReducer:
|
||||||
|
"""PHY Pads Reducer
|
||||||
|
|
||||||
|
Reduce DRAM pads to only use specific modules.
|
||||||
|
|
||||||
|
For testing purposes, we often need to use only some of the DRAM modules. PHYPadsReducer allows
|
||||||
|
selecting specific modules and avoid re-definining dram pins in the Platform for this.
|
||||||
|
"""
|
||||||
|
def __init__(self, pads, modules):
|
||||||
|
self.pads = pads
|
||||||
|
self.modules = modules
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
if name in ["dq"]:
|
||||||
|
return Array([getattr(self.pads, name)[8*i + j]
|
||||||
|
for i in self.modules
|
||||||
|
for j in range(8)])
|
||||||
|
if name in ["dm", "dqs", "dqs_p", "dqs_n"]:
|
||||||
|
return Array([getattr(self.pads, name)[i] for i in self.modules])
|
||||||
|
else:
|
||||||
|
return getattr(self.pads, name)
|
||||||
|
|
||||||
class PHYPadsCombiner:
|
class PHYPadsCombiner:
|
||||||
"""PHY Pads Combiner
|
"""PHY Pads Combiner
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue