use brackets round (XLEN/2) in divw pseudocode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Sep 2021 07:49:13 +0000 (08:49 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Sep 2021 07:49:13 +0000 (08:49 +0100)
[0]*XLEN/2 was being interpreted as ([0]*XLEN)/2

openpower/isa/fixedarith.mdwn

index 9dd7f1f45ca215b8a91bea79b5f4f134dfe06d6c..46f635294a0ecda189782a11ae985d443a674578 100644 (file)
@@ -391,13 +391,13 @@ Pseudo-code:
     dividend[0:(XLEN/2)-1] <- (RA)[XLEN/2:XLEN-1]
     divisor[0:(XLEN/2)-1] <- (RB) [XLEN/2:XLEN-1]
     if (((dividend = (0b1 || ([0b0] * ((XLEN/2)-1)))) &
-         (divisor = [1]*XLEN/2)) |
-         (divisor = [0]*XLEN/2)) then
+         (divisor = [1]*(XLEN/2))) |
+         (divisor = [0]*(XLEN/2))) then
         RT[0:XLEN-1] <- undefined([0]*XLEN)
         overflow <- 1
     else
         RT[XLEN/2:XLEN-1] <- DIVS(dividend, divisor)
-        RT[0:(XLEN/2)-1] <- undefined([0]*XLEN/2)
+        RT[0:(XLEN/2)-1] <- undefined([0]*(XLEN/2))
         overflow <- 0
 
 Special Registers Altered: