move crossbar to frontend, adapt core

This commit is contained in:
Florent Kermarrec 2016-04-29 16:48:35 +02:00
parent 41c76899d5
commit 47f2859091
8 changed files with 52 additions and 47 deletions

35
litedram/bus.py Normal file
View File

@ -0,0 +1,35 @@
from functools import reduce
from operator import or_
from litex.gen import *
from litex.gen.genlib.record import *
class Interface(Record):
def __init__(self, aw, dw, nbanks, req_queue_size, read_latency, write_latency):
self.aw = aw
self.dw = dw
self.nbanks = nbanks
self.req_queue_size = req_queue_size
self.read_latency = read_latency
self.write_latency = write_latency
bank_layout = [
("adr", aw, DIR_M_TO_S),
("we", 1, DIR_M_TO_S),
("stb", 1, DIR_M_TO_S),
("req_ack", 1, DIR_S_TO_M),
("dat_w_ack", 1, DIR_S_TO_M),
("dat_r_ack", 1, DIR_S_TO_M),
("lock", 1, DIR_S_TO_M)
]
if nbanks > 1:
layout = [("bank"+str(i), bank_layout) for i in range(nbanks)]
else:
layout = bank_layout
layout += [
("dat_w", dw, DIR_M_TO_S),
("dat_we", dw//8, DIR_M_TO_S),
("dat_r", dw, DIR_S_TO_M)
]
Record.__init__(self, layout)

View File

@ -1 +1 @@
from litedram.lasmicon.core import ControllerSettings, LASMIcon from litedram.core.controller import ControllerSettings, LiteDRAMController

View File

@ -3,7 +3,7 @@ from litex.gen.genlib.roundrobin import *
from litex.gen.genlib.fsm import FSM, NextState from litex.gen.genlib.fsm import FSM, NextState
from litex.gen.genlib.fifo import SyncFIFO from litex.gen.genlib.fifo import SyncFIFO
from litedram.lasmicon.multiplexer import * from litedram.core.multiplexer import *
class _AddressSlicer: class _AddressSlicer:

View File

@ -1,10 +1,10 @@
from litex.gen import * from litex.gen import *
from litedram.phy import dfi from litedram.phy import dfi
from litedram import lasmi_bus from litedram import bus
from litedram.lasmicon.refresher import * from litedram.core.refresher import *
from litedram.lasmicon.bankmachine import * from litedram.core.bankmachine import *
from litedram.lasmicon.multiplexer import * from litedram.core.multiplexer import *
class ControllerSettings: class ControllerSettings:
@ -15,7 +15,7 @@ class ControllerSettings:
self.with_bandwidth = with_bandwidth self.with_bandwidth = with_bandwidth
class LASMIcon(Module): class LiteDRAMController(Module):
def __init__(self, phy_settings, geom_settings, timing_settings, def __init__(self, phy_settings, geom_settings, timing_settings,
controller_settings=None): controller_settings=None):
if controller_settings is None: if controller_settings is None:
@ -30,7 +30,7 @@ class LASMIcon(Module):
geom_settings.bankbits, geom_settings.bankbits,
phy_settings.dfi_databits, phy_settings.dfi_databits,
phy_settings.nphases) phy_settings.nphases)
self.lasmic = lasmi_bus.Interface( self.lasmic = bus.Interface(
aw=geom_settings.rowbits + geom_settings.colbits - address_align, aw=geom_settings.rowbits + geom_settings.colbits - address_align,
dw=phy_settings.dfi_databits*phy_settings.nphases, dw=phy_settings.dfi_databits*phy_settings.nphases,
nbanks=2**geom_settings.bankbits, nbanks=2**geom_settings.bankbits,

View File

@ -5,7 +5,7 @@ from litex.gen import *
from litex.gen.genlib.roundrobin import * from litex.gen.genlib.roundrobin import *
from litex.gen.genlib.fsm import FSM, NextState from litex.gen.genlib.fsm import FSM, NextState
from litedram.lasmicon.perf import Bandwidth from litedram.core.perf import Bandwidth
from litex.soc.interconnect.csr import AutoCSR from litex.soc.interconnect.csr import AutoCSR

View File

@ -2,7 +2,7 @@ from litex.gen import *
from litex.gen.genlib.misc import timeline from litex.gen.genlib.misc import timeline
from litex.gen.genlib.fsm import FSM from litex.gen.genlib.fsm import FSM
from litedram.lasmicon.multiplexer import * from litedram.core.multiplexer import *
class Refresher(Module): class Refresher(Module):

View File

@ -3,38 +3,8 @@ from operator import or_
from litex.gen import * from litex.gen import *
from litex.gen.genlib import roundrobin from litex.gen.genlib import roundrobin
from litex.gen.genlib.record import *
class Interface(Record):
def __init__(self, aw, dw, nbanks, req_queue_size, read_latency, write_latency):
self.aw = aw
self.dw = dw
self.nbanks = nbanks
self.req_queue_size = req_queue_size
self.read_latency = read_latency
self.write_latency = write_latency
bank_layout = [
("adr", aw, DIR_M_TO_S),
("we", 1, DIR_M_TO_S),
("stb", 1, DIR_M_TO_S),
("req_ack", 1, DIR_S_TO_M),
("dat_w_ack", 1, DIR_S_TO_M),
("dat_r_ack", 1, DIR_S_TO_M),
("lock", 1, DIR_S_TO_M)
]
if nbanks > 1:
layout = [("bank"+str(i), bank_layout) for i in range(nbanks)]
else:
layout = bank_layout
layout += [
("dat_w", dw, DIR_M_TO_S),
("dat_we", dw//8, DIR_M_TO_S),
("dat_r", dw, DIR_S_TO_M)
]
Record.__init__(self, layout)
from litedram.bus import *
def _getattr_all(l, attr): def _getattr_all(l, attr):
it = iter(l) it = iter(l)
@ -45,7 +15,7 @@ def _getattr_all(l, attr):
return r return r
class LASMIxbar(Module): class LiteDRAMCrossbar(Module):
def __init__(self, controllers, cba_shift): def __init__(self, controllers, cba_shift):
self._controllers = controllers self._controllers = controllers
self._cba_shift = cba_shift self._cba_shift = cba_shift