From 4bbb14a59cc7df8f8dc7db60d9419323256f3624 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 10 Jul 2023 09:53:45 +0200 Subject: [PATCH] crossbar: Switch to LiteXModule. --- liteeth/crossbar.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/liteeth/crossbar.py b/liteeth/crossbar.py index 7772749..2beda9c 100644 --- a/liteeth/crossbar.py +++ b/liteeth/crossbar.py @@ -1,18 +1,20 @@ # # This file is part of LiteEth. # -# Copyright (c) 2015 Florent Kermarrec +# Copyright (c) 2015-2023 Florent Kermarrec # SPDX-License-Identifier: BSD-2-Clause from collections import OrderedDict +from litex.gen import * + from liteeth.common import * from litex.soc.interconnect.packet import Arbiter, Dispatcher # Crossbar ----------------------------------------------------------------------------------------- -class LiteEthCrossbar(Module): +class LiteEthCrossbar(LiteXModule): def __init__(self, master_port, dispatch_param, dw=8): self.users = OrderedDict() self.master = master_port(dw) @@ -25,11 +27,11 @@ class LiteEthCrossbar(Module): def do_finalize(self): # TX arbitrate sinks = [port.sink for port in self.users.values()] - self.submodules.arbiter = Arbiter(sinks, self.master.source) + self.arbiter = Arbiter(sinks, self.master.source) # RX dispatch sources = [port.source for port in self.users.values()] - self.submodules.dispatcher = Dispatcher(self.master.sink, sources, one_hot=True) + self.dispatcher = Dispatcher(self.master.sink, sources, one_hot=True) dispatch_sig = getattr(self.master.sink, self.dispatch_param) for i, (k, v) in enumerate(self.users.items()): self.comb += If(dispatch_sig == k, self.dispatcher.sel.eq(2**i))