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

27 lines
686 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
class LiteSATACrossbar(Module):
def __init__(self, core):
2015-01-22 04:45:11 -05:00
self.users = []
2015-01-16 17:52:41 -05:00
self.master = LiteSATAMasterPort(32)
self.comb += [
self.master.source.connect(core.sink),
core.source.connect(self.master.sink)
]
def get_port(self):
2015-01-22 04:45:11 -05:00
port = LiteSATAUserPort(32)
self.users += [port]
return port
2015-01-16 17:52:41 -05:00
def get_ports(self, n):
2015-01-22 04:45:11 -05:00
ports = []
2015-01-16 17:52:41 -05:00
for i in range(n):
2015-01-22 04:45:11 -05:00
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)
self.submodules += arbiter