litex/misoc/cores/lasmicon/core.py

61 lines
2.5 KiB
Python
Raw Normal View History

2015-09-22 12:36:47 -04:00
from migen import *
2013-06-11 08:18:16 -04:00
2015-09-25 06:43:20 -04:00
from misoc.interconnect import dfi, lasmi_bus
from misoc.cores.lasmicon.refresher import *
from misoc.cores.lasmicon.bankmachine import *
from misoc.cores.lasmicon.multiplexer import *
2013-06-11 08:18:16 -04:00
2015-04-13 10:47:22 -04:00
class LASMIconSettings:
def __init__(self, req_queue_size=8,
read_time=32, write_time=16,
l2_size=8192,
with_bandwidth=False,
2015-09-24 04:01:08 -04:00
with_memtest=False):
self.req_queue_size = req_queue_size
self.read_time = read_time
self.write_time = write_time
self.l2_size = l2_size
if with_memtest:
self.with_bandwidth = True
else:
self.with_bandwidth = with_bandwidth
self.with_memtest = with_memtest
2015-04-13 10:47:22 -04:00
2013-06-11 08:18:16 -04:00
class LASMIcon(Module):
def __init__(self, phy_settings, geom_settings, timing_settings, controller_settings, **kwargs):
if phy_settings.memtype in ["SDR"]:
2015-04-13 11:16:12 -04:00
burst_length = phy_settings.nphases*1 # command multiplication*SDR
elif phy_settings.memtype in ["DDR", "LPDDR", "DDR2", "DDR3"]:
2015-04-13 11:16:12 -04:00
burst_length = phy_settings.nphases*2 # command multiplication*DDR
address_align = log2_int(burst_length)
2013-06-11 08:18:16 -04:00
self.dfi = dfi.Interface(geom_settings.addressbits,
geom_settings.bankbits,
phy_settings.dfi_databits,
phy_settings.nphases)
2015-09-25 06:43:20 -04:00
self.lasmic = lasmi_bus.Interface(
aw=geom_settings.rowbits + geom_settings.colbits - address_align,
dw=phy_settings.dfi_databits*phy_settings.nphases,
nbanks=2**geom_settings.bankbits,
req_queue_size=controller_settings.req_queue_size,
read_latency=phy_settings.read_latency+1,
write_latency=phy_settings.write_latency+1)
self.nrowbits = geom_settings.colbits - address_align
2014-10-17 05:14:35 -04:00
###
2013-06-11 08:18:16 -04:00
self.submodules.refresher = Refresher(geom_settings.addressbits, geom_settings.bankbits,
2015-09-24 04:01:08 -04:00
timing_settings.tRP, timing_settings.tREFI, timing_settings.tRFC)
self.submodules.bank_machines = [BankMachine(geom_settings, timing_settings, controller_settings, address_align, i,
getattr(self.lasmic, "bank"+str(i)))
for i in range(2**geom_settings.bankbits)]
self.submodules.multiplexer = Multiplexer(phy_settings, geom_settings, timing_settings, controller_settings,
self.bank_machines, self.refresher,
self.dfi, self.lasmic,
**kwargs)
2013-06-15 06:51:11 -04:00
def get_csrs(self):
return self.multiplexer.get_csrs()