phys: improve handling of required/optional command pads and make cke/odt optional on all phys.
This commit is contained in:
parent
5a114be7e5
commit
2f5784432d
|
@ -200,18 +200,23 @@ class ECP5DDRPHY(Module, AutoCSR):
|
||||||
|
|
||||||
# Commands -----------------------------------------------------------------------------
|
# Commands -----------------------------------------------------------------------------
|
||||||
commands = {
|
commands = {
|
||||||
"a" : "address",
|
# Pad name: (DFI name, Pad type (required or optional))
|
||||||
"ba" : "bank" ,
|
"reset_n" : ("reset_n", "optional"),
|
||||||
"ras_n": "ras_n" ,
|
"cs_n" : ("cs_n", "optional"),
|
||||||
"cas_n": "cas_n" ,
|
"a" : ("address", "required"),
|
||||||
"we_n" : "we_n" ,
|
"ba" : ("bank" , "required"),
|
||||||
"cke" : "cke" ,
|
"ras_n" : ("ras_n" , "required"),
|
||||||
"odt" : "odt" ,
|
"cas_n" : ("cas_n" , "required"),
|
||||||
|
"we_n" : ("we_n" , "required"),
|
||||||
|
"cke" : ("cke" , "optional"),
|
||||||
|
"odt" : ("odt" , "optional"),
|
||||||
}
|
}
|
||||||
if hasattr(pads, "reset_n"): commands.update({"reset_n" : "reset_n"})
|
for pad_name, (dfi_name, pad_type) in commands.items():
|
||||||
if hasattr(pads, "cs_n") : commands.update({"cs_n" : "cs_n"})
|
pad = getattr(pads, pad_name, None)
|
||||||
for pad_name, dfi_name in commands.items():
|
if (pad is None):
|
||||||
pad = getattr(pads, pad_name)
|
if (pad_type == "required"):
|
||||||
|
raise ValueError(f"DRAM pad {pad_name} required but not found in pads.")
|
||||||
|
continue
|
||||||
for i in range(len(pad)):
|
for i in range(len(pad)):
|
||||||
pad_oddrx2f = Signal()
|
pad_oddrx2f = Signal()
|
||||||
self.specials += Instance("ODDRX2F",
|
self.specials += Instance("ODDRX2F",
|
||||||
|
|
|
@ -52,18 +52,24 @@ class GENSDRPHY(Module):
|
||||||
for pads_group in range(len(pads.groups)):
|
for pads_group in range(len(pads.groups)):
|
||||||
pads.sel_group(pads_group)
|
pads.sel_group(pads_group)
|
||||||
|
|
||||||
|
|
||||||
# Commands -----------------------------------------------------------------------------
|
# Commands -----------------------------------------------------------------------------
|
||||||
commands = {
|
commands = {
|
||||||
"a" : "address",
|
# Pad name: (DFI name, Pad type (required or optional))
|
||||||
"ba" : "bank" ,
|
"cs_n" : ("cs_n", "optional"),
|
||||||
"ras_n": "ras_n" ,
|
"a" : ("address", "required"),
|
||||||
"cas_n": "cas_n" ,
|
"ba" : ("bank" , "required"),
|
||||||
"we_n" : "we_n" ,
|
"ras_n" : ("ras_n" , "required"),
|
||||||
|
"cas_n" : ("cas_n" , "required"),
|
||||||
|
"we_n" : ("we_n" , "required"),
|
||||||
|
"cke" : ("cke" , "optional"),
|
||||||
}
|
}
|
||||||
if hasattr(pads, "cke") : commands.update({"cke" : "cke"})
|
for pad_name, (dfi_name, pad_type) in commands.items():
|
||||||
if hasattr(pads, "cs_n"): commands.update({"cs_n" : "cs_n"})
|
pad = getattr(pads, pad_name, None)
|
||||||
for pad_name, dfi_name in commands.items():
|
if (pad is None):
|
||||||
pad = getattr(pads, pad_name)
|
if (pad_type == "required"):
|
||||||
|
raise ValueError(f"DRAM pad {pad_name} required but not found in pads.")
|
||||||
|
continue
|
||||||
for i in range(len(pad)):
|
for i in range(len(pad)):
|
||||||
self.specials += SDROutput(i=getattr(dfi.p0, dfi_name)[i], o=pad[i])
|
self.specials += SDROutput(i=getattr(dfi.p0, dfi_name)[i], o=pad[i])
|
||||||
|
|
||||||
|
|
|
@ -162,18 +162,23 @@ class S7DDRPHY(Module, AutoCSR):
|
||||||
|
|
||||||
# Commands -----------------------------------------------------------------------------
|
# Commands -----------------------------------------------------------------------------
|
||||||
commands = {
|
commands = {
|
||||||
"a" : "address",
|
# Pad name: (DFI name, Pad type (required or optional))
|
||||||
"ba" : "bank" ,
|
"reset_n" : ("reset_n", "optional"),
|
||||||
"ras_n": "ras_n" ,
|
"cs_n" : ("cs_n", "optional"),
|
||||||
"cas_n": "cas_n" ,
|
"a" : ("address", "required"),
|
||||||
"we_n" : "we_n" ,
|
"ba" : ("bank" , "required"),
|
||||||
"cke" : "cke" ,
|
"ras_n" : ("ras_n" , "required"),
|
||||||
"odt" : "odt" ,
|
"cas_n" : ("cas_n" , "required"),
|
||||||
|
"we_n" : ("we_n" , "required"),
|
||||||
|
"cke" : ("cke" , "optional"),
|
||||||
|
"odt" : ("odt" , "optional"),
|
||||||
}
|
}
|
||||||
if hasattr(pads, "reset_n"): commands.update({"reset_n" : "reset_n"})
|
for pad_name, (dfi_name, pad_type) in commands.items():
|
||||||
if hasattr(pads, "cs_n") : commands.update({"cs_n" : "cs_n"})
|
pad = getattr(pads, pad_name, None)
|
||||||
for pad_name, dfi_name in commands.items():
|
if (pad is None):
|
||||||
pad = getattr(pads, pad_name)
|
if (pad_type == "required"):
|
||||||
|
raise ValueError(f"DRAM pad {pad_name} required but not found in pads.")
|
||||||
|
continue
|
||||||
for i in range(len(pad)):
|
for i in range(len(pad)):
|
||||||
oq = Signal()
|
oq = Signal()
|
||||||
self.specials += Instance("OSERDESE2",
|
self.specials += Instance("OSERDESE2",
|
||||||
|
|
|
@ -186,19 +186,24 @@ class USDDRPHY(Module, AutoCSR):
|
||||||
# Commands -----------------------------------------------------------------------------
|
# Commands -----------------------------------------------------------------------------
|
||||||
pads_ba = Signal(bankbits)
|
pads_ba = Signal(bankbits)
|
||||||
commands = {
|
commands = {
|
||||||
"a" : "address",
|
# Pad name: (DFI name, Pad type (required or optional))
|
||||||
pads_ba : "bank",
|
"reset_n" : ("reset_n", "optional"),
|
||||||
"ras_n" : "ras_n" ,
|
"cs_n" : ("cs_n", "optional"),
|
||||||
"cas_n" : "cas_n" ,
|
"a" : ("address", "required"),
|
||||||
"we_n" : "we_n" ,
|
pads_ba : ("bank" , "required"),
|
||||||
"cke" : "cke" ,
|
"ras_n" : ("ras_n" , "required"),
|
||||||
"odt" : "odt" ,
|
"cas_n" : ("cas_n" , "required"),
|
||||||
|
"we_n" : ("we_n" , "required"),
|
||||||
|
"cke" : ("cke" , "optional"),
|
||||||
|
"odt" : ("odt" , "optional"),
|
||||||
|
"act_n" : ("act_n", "optional"),
|
||||||
}
|
}
|
||||||
if hasattr(pads, "reset_n"): commands.update({"reset_n" : "reset_n"})
|
for pad_name, (dfi_name, pad_type) in commands.items():
|
||||||
if hasattr(pads, "cs_n") : commands.update({"cs_n" : "cs_n"})
|
pad = pad_name if isinstance(pad_name, Signal) else getattr(pads, pad_name, None)
|
||||||
if hasattr(pads, "act_n") : commands.update({"act_n" : "act_n"})
|
if (pad is None):
|
||||||
for pad_name, dfi_name in commands.items():
|
if (pad_type == "required"):
|
||||||
pad = pad_name if isinstance(pad_name, Signal) else getattr(pads, pad_name)
|
raise ValueError(f"DRAM pad {pad_name} required but not found in pads.")
|
||||||
|
continue
|
||||||
for i in range(len(pad)):
|
for i in range(len(pad)):
|
||||||
o_nodelay = Signal()
|
o_nodelay = Signal()
|
||||||
self.specials += [
|
self.specials += [
|
||||||
|
|
Loading…
Reference in New Issue