From: Sebastien Bourdeauducq Date: Mon, 15 Jul 2013 19:45:07 +0000 (+0200) Subject: lasmibus: fix master locking X-Git-Tag: 24jan2021_ls180~2099^2~524 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b016a60b853918fab3d2c1538b7e7ffa74fe85e9;p=litex.git lasmibus: fix master locking --- diff --git a/migen/bus/lasmibus.py b/migen/bus/lasmibus.py index d359aa82..62f5db06 100644 --- a/migen/bus/lasmibus.py +++ b/migen/bus/lasmibus.py @@ -66,13 +66,23 @@ class Crossbar(Module): controller_selected = [1]*nmasters master_req_acks = [0]*nmasters master_dat_acks = [0]*nmasters - for nb in range(nbanks): + rrs = [roundrobin.RoundRobin(nmasters, roundrobin.SP_CE) for n in range(nbanks)] + self.submodules += rrs + for nb, rr in enumerate(rrs): bank = getattr(controller, "bank"+str(nb)) + # for each master, determine if another bank locks it + master_locked = [] + for nm, master in enumerate(self.masters): + locked = 0 + for other_nb, other_rr in enumerate(rrs): + if other_nb != nb: + other_bank = getattr(controller, "bank"+str(other_nb)) + locked = locked | (other_bank.lock & (other_rr.grant == nm)) + master_locked.append(locked) + # arbitrate - rr = roundrobin.RoundRobin(nmasters, roundrobin.SP_CE) - self.submodules += rr - bank_selected = [cs & (ba == nb) for cs, ba in zip(controller_selected, m_ba)] + bank_selected = [cs & (ba == nb) & ~locked for cs, ba, locked in zip(controller_selected, m_ba, master_locked)] bank_requested = [bs & master.stb for bs, master in zip(bank_selected, self.masters)] self.comb += [ rr.request.eq(Cat(*bank_requested)),