common/PHYPadsReducer: make Cat optional (disabled by default).
This commit is contained in:
parent
543a94dd33
commit
3bab6f2024
|
@ -66,17 +66,20 @@ class PHYPadsReducer:
|
||||||
For testing purposes, we often need to use only some of the DRAM modules. PHYPadsReducer allows
|
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.
|
selecting specific modules and avoid re-definining dram pins in the Platform for this.
|
||||||
"""
|
"""
|
||||||
def __init__(self, pads, modules):
|
def __init__(self, pads, modules, with_cat=False):
|
||||||
self.pads = pads
|
self.pads = pads
|
||||||
self.modules = modules
|
self.modules = modules
|
||||||
|
self.with_cat = with_cat
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name in ["dq"]:
|
if name in ["dq"]:
|
||||||
return Cat(Array([getattr(self.pads, name)[8*i + j]
|
r = Array([getattr(self.pads, name)[8*i + j]
|
||||||
for i in self.modules
|
for i in self.modules
|
||||||
for j in range(8)]))
|
for j in range(8)])
|
||||||
|
return r if not self.with_cat else Cat(r)
|
||||||
if name in ["dm", "dqs", "dqs_p", "dqs_n"]:
|
if name in ["dm", "dqs", "dqs_p", "dqs_n"]:
|
||||||
return Cat(Array([getattr(self.pads, name)[i] for i in self.modules]))
|
r = Array([getattr(self.pads, name)[i] for i in self.modules])
|
||||||
|
return r if not self.with_cat else Cat(r)
|
||||||
else:
|
else:
|
||||||
return getattr(self.pads, name)
|
return getattr(self.pads, name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue