bus_busy = Signal()
        if hasattr(self.bus, "lock"):
            # If LOCK is not asserted, we also wait for STB to be deasserted before granting bus
            # ownership to the next initiator. If we didn't, the next bus owner could receive
            # an ACK (or ERR, RTY) from the previous transaction when targeting the same
            # peripheral.
            m.d.comb += bus_busy.eq(self.bus.cyc & (self.bus.lock | self.bus.stb))
        else:
            m.d.comb += bus_busy.eq(self.bus.cyc)