From 7e3ecd1020179dcd0eafb27c93270a2edcb0e559 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 10:54:14 +0100 Subject: [PATCH] add true and floor div to SelectableInt --- src/soc/decoder/selectable_int.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index 716ad682..72640909 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -1,8 +1,8 @@ import unittest from copy import copy from soc.decoder.power_fields import BitRange -from operator import (add, sub, mul, truediv, mod, or_, and_, xor, neg, inv, - lshift, rshift) +from operator import (add, sub, mul, floordiv, truediv, mod, or_, and_, xor, + neg, inv, lshift, rshift) def check_extsign(a, b): @@ -169,7 +169,9 @@ class SelectableInt: return self._op(sub, b) def __mul__(self, b): return self._op(mul, b) - def __div__(self, b): + def __floordiv__(self, b): + return self._op(floordiv, b) + def __truediv__(self, b): return self._op(truediv, b) def __mod__(self, b): return self._op(mod, b) -- 2.30.2