From 8920df310fc7ac51a59cd7be4bb9be23bf26bd42 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 21:29:30 +0100 Subject: [PATCH] add comments on trunc_div and trunc_rem --- src/soc/decoder/helpers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/soc/decoder/helpers.py b/src/soc/decoder/helpers.py index ef6610e5..6b61ffca 100644 --- a/src/soc/decoder/helpers.py +++ b/src/soc/decoder/helpers.py @@ -10,6 +10,8 @@ def exts(value, bits): sign = 1 << (bits - 1) return (value & (sign - 1)) - (value & sign) + +# this is a POWER ISA 3.0B compatible div function def trunc_div(n, d): f = getattr(n, "trunc_div", None) if f is not None: @@ -24,6 +26,8 @@ def trunc_div(n, d): return abs_q return -abs_q + +# this is a POWER ISA 3.0B compatible mod / remainder function def trunc_rem(n, d): f = getattr(n, "trunc_rem", None) if f is not None: -- 2.30.2