From: Luke Kenneth Casson Leighton Date: Thu, 3 Oct 2019 09:00:39 +0000 (+0100) Subject: clarify sbf / sif / sof X-Git-Tag: convert-csv-opcode-to-binary~3917 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=991dfd5b9a308a6fee6c1e876c3f73bde0bdb2e5;p=libreriscv.git clarify sbf / sif / sof --- diff --git a/simple_v_extension/specification/bitmanip.mdwn b/simple_v_extension/specification/bitmanip.mdwn index 32d228e07..04e1b0418 100644 --- a/simple_v_extension/specification/bitmanip.mdwn +++ b/simple_v_extension/specification/bitmanip.mdwn @@ -110,9 +110,11 @@ This is similar but not identical to BitManip "CLZ". CLZ returns XLEN when no bi ## sbf - set before first bit -Sets all LSBs leading up to (excluding) where an LSB in the src is set. -If the second operand is non-zero, this process begins each time -(including the first time) from where 1s are set in the second operand. +Sets all LSBs leading up to (excluding) where an LSB in the src is set, +and sets zeros including and following the src bit found. +If the second operand is non-zero, this process continues the search +(in the same LSB to MSB order) beginning each time (including the first time) +from where 1s are set in the second operand. A side-effect of the search is that when src is zero, the output is all ones. If the second operand is non-zero and the src is zero, the output is a @@ -191,8 +193,14 @@ Pseudo-code: ## sif - set including first bit -Similar to sbf except including the bit which ends a run. -The side-effect of when the src is zero is also the same as for sbf. +Similar to sbf except including the bit which ends a run. i.e: +Sets all LSBs leading up to *and including* where an LSB in the src is set, +and sets zeros following the point where the src bit is found. + +The side-effect of when the src is zero is also the same as for sbf: +output is all 1s if src2 is zero, and output is equal to src2 if src2 +is non-zero. + # Example