projects
/
soc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
483d2e5
)
MULS on parameter b needed to check whether it was sign-extended
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Wed, 5 Aug 2020 18:46:51 +0000
(19:46 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Thu, 6 Aug 2020 15:38:50 +0000
(16:38 +0100)
src/soc/decoder/helpers.py
patch
|
blob
|
history
diff --git
a/src/soc/decoder/helpers.py
b/src/soc/decoder/helpers.py
index 17534800e600ba2ffb521b38c8ca3c4450aa534b..a50d009263a839271a136ceacc3995ff44d85b63 100644
(file)
--- a/
src/soc/decoder/helpers.py
+++ b/
src/soc/decoder/helpers.py
@@
-4,6
+4,7
@@
from nmutil.divmod import trunc_divs, trunc_rems
from operator import floordiv, mod
from soc.decoder.selectable_int import selectltu as ltu
from soc.decoder.selectable_int import selectgtu as gtu
+from soc.decoder.selectable_int import check_extsign
trunc_div = floordiv
trunc_rem = mod
@@
-37,6
+38,9
@@
def EXTS64(value):
# signed version of MUL
def MULS(a, b):
+ if isinstance(b, int):
+ b = SelectableInt(b, self.bits)
+ b = check_extsign(a, b)
a_s = a.value & (1 << (a.bits-1)) != 0
b_s = b.value & (1 << (b.bits-1)) != 0
result = abs(a) * abs(b)