From: lkcl Date: Tue, 26 Apr 2022 16:27:28 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~2578 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc79c46ae3b6d6add66d6e00737249b9dfcdf1cf;p=libreriscv.git --- diff --git a/openpower/sv/biginteger/analysis.mdwn b/openpower/sv/biginteger/analysis.mdwn index a29aa6a6b..76f0a37f5 100644 --- a/openpower/sv/biginteger/analysis.mdwn +++ b/openpower/sv/biginteger/analysis.mdwn @@ -409,3 +409,11 @@ selecting whether `RS=RC` or allows the instruction to perform full parallel vector div/mod, or act in loop-back mode for big-int division by a scalar, or for a single scalar 128/64 div/mod. + +Just as with `divdeu` on which this instruction is based an overflow +detection is required. When the divisor is too small compared to +the dividend then the result may not fit into 64 bit. Knuth's +original algorithm detects overflow and manually places 0xffffffff +(all ones) into `qhat`. It makes sense for `divrem2du` to do +this, and also to return an overflow indicator: this can be dobe +by always setting Rc=1 as a way to save opcode space