From: Luke Kenneth Casson Leighton Date: Sun, 13 Sep 2020 13:39:57 +0000 (+0100) Subject: add masked util function X-Git-Tag: 24jan2021_ls180~19 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b68c8ca23a6c3e6e91b2ee09347504ad237dac56;p=nmutil.git add masked util function --- diff --git a/src/nmutil/mask.py b/src/nmutil/mask.py index 2237522..25fd142 100644 --- a/src/nmutil/mask.py +++ b/src/nmutil/mask.py @@ -1,6 +1,9 @@ from nmigen import Module, Signal, Elaboratable from nmigen.utils import log2_int +def masked(m_out, m_in, mask): + return (m_out & ~mask) | (m_in & mask) + class Mask(Elaboratable): def __init__(self, sz):