projects
/
nmutil.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f108034
)
add masked util function
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Sun, 13 Sep 2020 13:39:57 +0000
(14:39 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Sun, 13 Sep 2020 13:39:57 +0000
(14:39 +0100)
src/nmutil/mask.py
patch
|
blob
|
history
diff --git
a/src/nmutil/mask.py
b/src/nmutil/mask.py
index 223752297e0d48ffeffc23f3c6ca02280270c13e..25fd1429d94921b9453de863a92914fd8fa8027b 100644
(file)
--- 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):