(no commit message)
authorlkcl <lkcl@web>
Tue, 18 Apr 2023 08:12:07 +0000 (09:12 +0100)
committerIkiWiki <ikiwiki.info>
Tue, 18 Apr 2023 08:12:07 +0000 (09:12 +0100)
openpower/sv/rfc/ls005.mdwn

index 1ef796de78bc866dc1d4d0ad22022e9097b060db..c4e817202896f0c3e8e014838ff3829f5e5506e3 100644 (file)
@@ -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{}