From 3683d40d020ca785168fb059f75e7159cc904ab1 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 18 Apr 2023 14:04:02 -0700 Subject: [PATCH] fix extsb pseudo-code some of the bit positions had been wrong --- openpower/sv/rfc/ls005.mdwn | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/openpower/sv/rfc/ls005.mdwn b/openpower/sv/rfc/ls005.mdwn index 6611f89f8..b8ea786c2 100644 --- a/openpower/sv/rfc/ls005.mdwn +++ b/openpower/sv/rfc/ls005.mdwn @@ -284,14 +284,19 @@ is a loss of functionality and opportunity: extsw: 32-bit -> 64-bit sign extension ``` -The RTL for `extsb` becomes: +The pseudo-code for `extsb` becomes: ``` - in <- (RA)[XLEN-8:XLEN-1] - if XLEN = 8 then RT <- in[0]] * 8 # 1->8 - if XLEN = 16 then RT <- in[13]] * 15 || in[15] # 2->16 - if XLEN = 32 then RT <- in[28]] * 29 || in[29:31] # 4->32 - if XLEN = 64 then RT <- in[55]] * 56 || in[57:63] # 8->64 +RT[0:XLEN-1] <- EXTS((RA)[XLEN*7/8:XLEN-1]) +``` + +or, if expanded out: + +``` + if XLEN = 8 then RT <- (RA)[ 7] * 7 || (RA)[ 7: 7] # 1 -> 8 + if XLEN = 16 then RT <- (RA)[14] * 14 || (RA)[14:15] # 2 -> 16 + if XLEN = 32 then RT <- (RA)[28] * 28 || (RA)[28:31] # 4 -> 32 + if XLEN = 64 then RT <- (RA)[56] * 56 || (RA)[56:63] # 8 -> 64 ``` And `extsh` and `extsw` follow similar logic. Interestingly there is -- 2.30.2