litex/misoclib/mem/litesata/frontend/crossbar.py

30 lines
872 B
Python
Raw Normal View History

from misoclib.mem.litesata.common import *
from misoclib.mem.litesata.frontend.common import *
from misoclib.mem.litesata.frontend.arbiter import LiteSATAArbiter
2015-01-16 17:52:41 -05:00
2015-04-13 09:12:39 -04:00
2015-01-16 17:52:41 -05:00
class LiteSATACrossbar(Module):
def __init__(self, controller):
self.dw = flen(controller.sink.data)
self.users = []
self.master = LiteSATAMasterPort(self.dw)
self.comb += [
self.master.source.connect(controller.sink),
controller.source.connect(self.master.sink)
]
2015-01-16 17:52:41 -05:00
def get_port(self):
port = LiteSATAUserPort(self.dw)
self.users += [port]
return port
2015-01-16 17:52:41 -05:00
def get_ports(self, n):
ports = []
for i in range(n):
ports.append(self.get_port())
return ports
2015-01-16 17:52:41 -05:00
def do_finalize(self):
arbiter = LiteSATAArbiter(self.users, self.master)
2015-04-13 09:44:52 -04:00
self.submodules += arbiter