crossbar/LiteEthCrossbar: Allow dispatch_param to be a Signal to allow dynamic configuration from design.

This commit is contained in:
Florent Kermarrec 2022-01-26 10:51:03 +01:00
parent e340428384
commit e0124748aa
1 changed files with 2 additions and 4 deletions

View File

@ -30,8 +30,6 @@ class LiteEthCrossbar(Module):
# RX dispatch
sources = [port.source for port in self.users.values()]
self.submodules.dispatcher = Dispatcher(self.master.sink, sources, one_hot=True)
cases = {}
cases["default"] = self.dispatcher.sel.eq(0)
dispatch_sig = getattr(self.master.sink, self.dispatch_param)
for i, (k, v) in enumerate(self.users.items()):
cases[k] = self.dispatcher.sel.eq(2**i)
self.comb += Case(getattr(self.master.sink, self.dispatch_param), cases)
self.comb += If(dispatch_sig == k, self.dispatcher.sel.eq(2**i))