From: Luke Kenneth Casson Leighton Date: Wed, 5 Jan 2022 14:14:29 +0000 (+0000) Subject: use bit_length rather than log2_int function in mask.py X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f1b0fd46ea0a35603d94b19ff9f94b58340e098;p=nmutil.git use bit_length rather than log2_int function in mask.py --- diff --git a/src/nmutil/mask.py b/src/nmutil/mask.py index 4a04862..dc2f05d 100644 --- a/src/nmutil/mask.py +++ b/src/nmutil/mask.py @@ -17,14 +17,14 @@ def masked(m_out, m_in, mask): class Mask(Elaboratable): def __init__(self, sz): self.sz = sz - self.shift = Signal(log2_int(sz, False)+1) + self.shift = Signal(sz.bit_length()+1) self.mask = Signal(sz) def elaborate(self, platform): m = Module() for i in range(self.sz): - with m.If(self.shift > i): + with m.If(i < self.shift): m.d.comb += self.mask[i].eq(1) return m