From 7f1b0fd46ea0a35603d94b19ff9f94b58340e098 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 5 Jan 2022 14:14:29 +0000 Subject: [PATCH] use bit_length rather than log2_int function in mask.py --- src/nmutil/mask.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.30.2