projects
/
libreriscv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
91662d2
)
clarify bmask.py
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Mon, 27 Jun 2022 09:54:54 +0000
(10:54 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Mon, 27 Jun 2022 09:54:54 +0000
(10:54 +0100)
openpower/sv/bmask.py
patch
|
blob
|
history
diff --git
a/openpower/sv/bmask.py
b/openpower/sv/bmask.py
index e30f8a29ea24f256847121d3d8ad1b35bb3cbaa0..f64708bce54c8baffd11b631f38af31403b58237 100644
(file)
--- a/
openpower/sv/bmask.py
+++ b/
openpower/sv/bmask.py
@@
-1,7
+1,8
@@
-def bmask(bm, RA, RB=None, zero=False):
- mask = RB if RB is not None else
0xffffffffffffffff
+def bmask(bm, RA, RB=None, zero=False
, XLEN=64
):
+ mask = RB if RB is not None else
((1<<XLEN)-1)
ra = RA & mask
- a1 = ra if bm&1 else ~ra
+ mode1 = bm&1
+ a1 = ra if mode1 else ~ra
mode2 = (bm >> 1) & 0b11
if mode2 == 0: a2 = -ra
if mode2 == 1: a2 = ra-1