- comb += mr.eq(right_mask(m, mb))
- comb += ml.eq(left_mask(m, me))
+ m.submodules.right_mask = right_mask = Mask(width)
+ with m.If(mb <= width):
+ comb += right_mask.shift.eq(width-mb)
+ comb += mr.eq(right_mask.mask)
+ with m.Else():
+ comb += mr.eq(0)
+ #comb += mr.eq(right_mask(m, mb))
+
+ m.submodules.left_mask = left_mask = Mask(width)
+ comb += left_mask.shift.eq(width-1-me)
+ comb += ml.eq(~left_mask.mask)
+ #comb += ml.eq(left_mask(m, me))
+