From: lkcl Date: Wed, 2 Oct 2019 11:16:27 +0000 (+0100) Subject: (no commit message) X-Git-Tag: convert-csv-opcode-to-binary~3924 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0c4b40443f74ffbe8410b1ec5d024b1772c474a;p=libreriscv.git --- diff --git a/simple_v_extension/specification/bitmanip.mdwn b/simple_v_extension/specification/bitmanip.mdwn index 1af47e749..fb47df634 100644 --- a/simple_v_extension/specification/bitmanip.mdwn +++ b/simple_v_extension/specification/bitmanip.mdwn @@ -95,6 +95,19 @@ This instruction is present in BitManip. finds the first bit set as an index. +Pseudocode: + + + uint_xlen_t clz(uint_xlen_t rs1) + { + for (int count = 0; count < XLEN; count++) + if ((rs1 << count) >> (XLEN - 1)) + return count; + return XLEN; // -1 + } + +This is similar but not identical to BitManip "CLZ". CLZ returns XLEN when no bits are set, whereas RVV returns -1. + ## sbf - set before first bit Sets all LSBs leading up to where an LSB in the src is set. If the second @@ -142,6 +155,8 @@ Pseudo-code: ## sif - set including first bit +Similar to sbf except including the bit which ends a run. + # Example 7 6 5 4 3 2 1 0 Element number