[Libre-soc-bugs] [Bug 324] create POWER9 DIV pipeline

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Jun 19 15:29:55 BST 2020


https://bugs.libre-soc.org/show_bug.cgi?id=324

--- Comment #21 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #19)
> (In reply to Luke Kenneth Casson Leighton from comment #17)
> 
> > i have one more thing left to do (one more bad hack) - identify where
> > "undefined" is used and copy only the bits required from it.
> 
> done.
> 
> this is a good sign:
> 
>     RT[32:64] = trunc_div(dividend, divisor)
>   File "/home/lkcl/src/libresoc/soc/src/soc/decoder/helpers.py", line 20, in
> trunc_div
>     abs_n = abs(n)
> TypeError: bad operand type for abs(): 'SelectableInt'
> 
> and appears to be sorted by this:
> 
> diff --git a/src/soc/decoder/selectable_int.py
> b/src/soc/decoder/selectable_int.py
> index 7264090..eebada6 100644
> --- a/src/soc/decoder/selectable_int.py
> +++ b/src/soc/decoder/selectable_int.py
> @@ -181,6 +181,8 @@ class SelectableInt:
>          return self._op(or_, b)
>      def __xor__(self, b):
>          return self._op(xor, b)
> +    def __abs__(self):
> +        return SelectableInt(0, self.bits) - self

I was thinking SelectableInt and other custom classes would implement the
trunc_div and rtrunc_div member functions, which is the trunc_div version of
__sub__ and __rsub__. Similarly for trunc_rem and rtrunc_rem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list