2015-02-28 04:53:51 -05:00
|
|
|
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):
|
2015-04-13 08:55:26 -04:00
|
|
|
def __init__(self, core):
|
|
|
|
self.users = []
|
|
|
|
self.master = LiteSATAMasterPort(32)
|
|
|
|
self.comb += [
|
|
|
|
self.master.source.connect(core.sink),
|
|
|
|
core.source.connect(self.master.sink)
|
|
|
|
]
|
2015-01-16 17:52:41 -05:00
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
def get_port(self):
|
|
|
|
port = LiteSATAUserPort(32)
|
|
|
|
self.users += [port]
|
|
|
|
return port
|
2015-01-16 17:52:41 -05:00
|
|
|
|
2015-04-13 08:55:26 -04: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
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
def do_finalize(self):
|
|
|
|
arbiter = LiteSATAArbiter(self.users, self.master)
|
|
|
|
self.submodules += arbiter
|