From ec7320f00395012befec096caa7b1823f6b174f6 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 2 Jul 2024 13:50:06 +0200 Subject: [PATCH] mac/wishbone: Fix ntxslots/nrxslots == 1 case. Previously, a common decoder was used for TX and RX slots, so there were at least two interfaces connected. With the TX/RX decoupling, we now only have on interface per decoder when ntxslots/nrxslots == 1. --- liteeth/mac/wishbone.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/liteeth/mac/wishbone.py b/liteeth/mac/wishbone.py index 1be58de..9970242 100644 --- a/liteeth/mac/wishbone.py +++ b/liteeth/mac/wishbone.py @@ -72,10 +72,10 @@ class LiteEthMACWishboneInterface(LiteXModule): wb_slaves = [] sram_depth = math.ceil(eth_mtu/(dw//8)) decoderoffset = log2_int(sram_depth, need_pow2=False) - decoderbits = log2_int(len(wb_sram_ifs)) + decoderbits = max(log2_int(len(wb_sram_ifs)), 1) for n, wb_sram_if in enumerate(wb_sram_ifs): def slave_filter(a, v=n): - return a[decoderoffset:decoderoffset+decoderbits] == v + return a[decoderoffset:decoderoffset + decoderbits] == v wb_slaves.append((slave_filter, wb_sram_if.bus)) self.submodules += wb_sram_if wb_con = wishbone.Decoder(bus, wb_slaves, register=True)