From: Luke Kenneth Casson Leighton Date: Thu, 3 Oct 2019 08:53:00 +0000 (+0100) Subject: clarify and add better pseudocode X-Git-Tag: convert-csv-opcode-to-binary~3918 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4aa38df0abcc1fae4d9337e0c8a72c37b13f81aa;p=libreriscv.git clarify and add better pseudocode --- diff --git a/simple_v_extension/specification/bitmanip.mdwn b/simple_v_extension/specification/bitmanip.mdwn index a6d8dcb9b..32d228e07 100644 --- a/simple_v_extension/specification/bitmanip.mdwn +++ b/simple_v_extension/specification/bitmanip.mdwn @@ -110,9 +110,13 @@ 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 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. +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. + +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 +copy of the second operand. # Example @@ -137,6 +141,35 @@ second operand. Pseudo-code: + def sof(rd, rs1, rs2): + rd = 0 + setting_mode = rs2 == x0 or (regs[rs2] & 1) + + while i < XLEN: + bit = 1<