From b68c8ca23a6c3e6e91b2ee09347504ad237dac56 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 13 Sep 2020 14:39:57 +0100 Subject: [PATCH] add masked util function --- src/nmutil/mask.py | 3 +++ 1 file changed, 3 insertions(+) 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): -- 2.30.2