def PhySettings(memtype, dfi_databits, nphases, rdphase, wrphase, rdcmdphase, wrcmdphase, cl, read_latency, write_latency, cwl=0):
return PhySettingsT(memtype, dfi_databits, nphases, rdphase, wrphase, rdcmdphase, wrcmdphase, cl, cwl, read_latency, write_latency)
-GeomSettingsT = namedtuple("_GeomSettings", "databits bankbits rowbits colbits addressbits")
-def GeomSettings(databits, bankbits, rowbits, colbits):
- return GeomSettingsT(databits, bankbits, rowbits, colbits, max(rowbits, colbits))
+GeomSettingsT = namedtuple("_GeomSettings", "bankbits rowbits colbits addressbits")
+def GeomSettings(bankbits, rowbits, colbits):
+ return GeomSettingsT(bankbits, rowbits, colbits, max(rowbits, colbits))
TimingSettings = namedtuple("TimingSettings", "tRP tRCD tWR tWTR tREFI tRFC")
self.clk_freq = clk_freq
self.memtype = memtype
self.geom_settings = sdram.GeomSettings(
- databits=geom_settings["nbits"],
bankbits=log2_int(geom_settings["nbanks"]),
rowbits=log2_int(geom_settings["nrows"]),
colbits=log2_int(geom_settings["ncols"]),
# SDR
class IS42S16160(SDRAMModule):
geom_settings = {
- "nbits": 16,
"nbanks": 4,
"nrows": 8192,
"ncols": 512
class MT48LC4M16(SDRAMModule):
geom_settings = {
- "nbits": 16,
"nbanks": 4,
"nrows": 4096,
"ncols": 256
class AS4C16M16(SDRAMModule):
geom_settings = {
- "nbits": 16,
"nbanks": 4,
"nrows": 8192,
"ncols": 512
# DDR
class MT46V32M16(SDRAMModule):
geom_settings = {
- "nbits": 16,
"nbanks": 4,
"nrows": 8192,
"ncols": 1024
# LPDDR
class MT46H32M16(SDRAMModule):
geom_settings = {
- "nbits": 16,
"nbanks": 4,
"nrows": 8192,
"ncols": 1024
# DDR2
class MT47H128M8(SDRAMModule):
geom_settings = {
- "nbits": 8,
"nbanks": 8,
"nrows": 16384,
"ncols": 1024
# DDR3
class MT8JTF12864(SDRAMModule):
geom_settings = {
- "nbits": 8,
"nbanks": 8,
"nrows": 65536,
"ncols": 1024
]
class SDRAMPHYSim(Module):
- def __init__(self, module, nmodules=1):
+ def __init__(self, module, data_width):
addressbits = module.geom_settings.addressbits
- databits = module.geom_settings.databits
bankbits = module.geom_settings.bankbits
rowbits = module.geom_settings.rowbits
colbits = module.geom_settings.colbits
# XXX expose this to user
self.settings = sdram.PhySettings(
memtype=module.memtype,
- dfi_databits=databits,
+ dfi_databits=data_width,
nphases=1,
rdphase=0,
wrphase=0,
)
self.module = module
- self.dfi = Interface(addressbits, bankbits, databits)
+ self.dfi = Interface(addressbits, bankbits, data_width)
###
nbanks = 2**bankbits
nrows = 2**rowbits
ncols = 2**colbits
- data_width = databits*nmodules
# DFI phases
phases = [DFIPhase(self.dfi, n) for n in range(self.settings.nphases)]