From 9647302b462d7f39feba2b0b3b0a7eb0a1a972c8 Mon Sep 17 00:00:00 2001 From: lkcl Date: Fri, 25 Dec 2020 21:48:36 +0000 Subject: [PATCH] --- openpower/sv/bitmanip.mdwn | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 47f407849..54958ba43 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -19,3 +19,20 @@ vpdepd VRT,VRA,VRB # vector bit extract other way round + +# single bit set + +``` +uint_xlen_t sbset(uint_xlen_t rs1, uint_xlen_t rs2) { int shamt = rs2 & (XLEN - 1); +} +return rs1 | (uint_xlen_t(1) << shamt); +uint_xlen_t sbclr(uint_xlen_t rs1, uint_xlen_t rs2) { int shamt = rs2 & (XLEN - 1); +} +return rs1 & ~(uint_xlen_t(1) << shamt); +uint_xlen_t sbinv(uint_xlen_t rs1, uint_xlen_t rs2) { int shamt = rs2 & (XLEN - 1); +} +return rs1 ^ (uint_xlen_t(1) << shamt); +uint_xlen_t sbext(uint_xlen_t rs1, uint_xlen_t rs2) { int shamt = rs2 & (XLEN - 1); +} +return 1 & (rs1 >> shamt); +``` -- 2.30.2