From 058241057bc543783c8cb4afd1972cc00cedb49e Mon Sep 17 00:00:00 2001 From: lkcl Date: Tue, 18 Apr 2023 09:12:07 +0100 Subject: [PATCH] --- openpower/sv/rfc/ls005.mdwn | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/openpower/sv/rfc/ls005.mdwn b/openpower/sv/rfc/ls005.mdwn index 1ef796de7..c4e817202 100644 --- a/openpower/sv/rfc/ls005.mdwn +++ b/openpower/sv/rfc/ls005.mdwn @@ -175,7 +175,35 @@ RT <- (RA|0) + EXTS(SI) However behind the scenes, RA is XLEN bits wide, therefore EXTS performs an increase in bitlength not to exactly 64 but to XLEN. Obviousy for XLEN=16 there is no sign-extension, and for XLEN=8 truncation of `SI` will occur. - +Illustrates that there are subtle quirks involved, requiring some thought. + +## Compare Ranged Byte (cmprb BF,L,RA,RB) + +``` + src1 <- EXTZ((RA)[XLEN-8:XLEN-1]) + src21hi <- EXTZ((RB)[XLEN-32:XLEN-23]) + src21lo <- EXTZ((RB)[XLEN-24:XLEN-17]) + src22hi <- EXTZ((RB)[XLEN-16:XLEN-9]) + src22lo <- EXTZ((RB)[XLEN-8:XLEN-1]) + if L=0 then + in_range <- (src22lo <= src1) & (src1 <= src22hi) + else + in_range <- (((src21lo <= src1) & (src1 <= src21hi)) | + ((src22lo <= src1) & (src1 <= src22hi))) + CR[4*BF+32] <- 0b0 + CR[4*BF+33] <- in_range + CR[4*BF+34] <- 0b0 + CR[4*BF+35] <- 0b0 +``` + +Compare Ranged Byte takes either one or two ranges from RB as individual bytes, +thus requiring a minimum 16-bit (32-bit when L=1) operand RB. +src1 on the other hand is only +8-bit long: the first byte of RA. + +Therefore a little more thought is required. Should this simply be UNDEFINED +behaviour when XLEN=8/16 and L=1? When XLEN=16, L=0 the instruction is still +valid. Would it be costly at the Decoder? \newpage{} -- 2.30.2