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 # RX dispatch
sources = [port.source for port in self.users.values()] sources = [port.source for port in self.users.values()]
self.submodules.dispatcher = Dispatcher(self.master.sink, sources, one_hot=True) self.submodules.dispatcher = Dispatcher(self.master.sink, sources, one_hot=True)
cases = {} dispatch_sig = getattr(self.master.sink, self.dispatch_param)
cases["default"] = self.dispatcher.sel.eq(0)
for i, (k, v) in enumerate(self.users.items()): for i, (k, v) in enumerate(self.users.items()):
cases[k] = self.dispatcher.sel.eq(2**i) self.comb += If(dispatch_sig == k, self.dispatcher.sel.eq(2**i))
self.comb += Case(getattr(self.master.sink, self.dispatch_param), cases)