soc/interconnect/packet: Add **kwargs to Arbiter/Dispatcher to allow specifying keep/omit parameters for connection.

This commit is contained in:
Florent Kermarrec 2024-02-28 13:04:48 +01:00
parent fea3a7ebc6
commit 42c1046323
1 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# #
# This file is part of LiteX. # This file is part of LiteX.
# #
# Copyright (c) 2015-2019 Florent Kermarrec <florent@enjoy-digital.fr> # Copyright (c) 2015-2024 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2019 Vamsi K Vytla <vkvytla@lbl.gov> # Copyright (c) 2019 Vamsi K Vytla <vkvytla@lbl.gov>
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
@ -37,12 +37,12 @@ class Status(LiteXModule):
# Arbiter ------------------------------------------------------------------------------------------ # Arbiter ------------------------------------------------------------------------------------------
class Arbiter(LiteXModule): class Arbiter(LiteXModule):
def __init__(self, masters, slave): def __init__(self, masters, slave, **kwargs):
if len(masters) == 0: if len(masters) == 0:
pass pass
elif len(masters) == 1: elif len(masters) == 1:
self.grant = Signal() self.grant = Signal()
self.comb += masters.pop().connect(slave) self.comb += masters.pop().connect(slave, **kwargs)
else: else:
self.rr = RoundRobin(len(masters)) self.rr = RoundRobin(len(masters))
self.grant = self.rr.grant self.grant = self.rr.grant
@ -57,11 +57,11 @@ class Arbiter(LiteXModule):
# Dispatcher --------------------------------------------------------------------------------------- # Dispatcher ---------------------------------------------------------------------------------------
class Dispatcher(LiteXModule): class Dispatcher(LiteXModule):
def __init__(self, master, slaves, one_hot=False): def __init__(self, master, slaves, one_hot=False, **kwargs):
if len(slaves) == 0: if len(slaves) == 0:
self.sel = Signal() self.sel = Signal()
elif len(slaves) == 1 and not one_hot: elif len(slaves) == 1 and not one_hot:
self.comb += master.connect(slaves.pop()) self.comb += master.connect(slaves.pop(), **kwargs)
self.sel = Signal() self.sel = Signal()
else: else:
if one_hot: if one_hot: