1 <!-- Instructions here described in PowerISA Version 3.0 B Book 1 -->
3 <!-- Section 3.3.15 Binary Coded Decimal (BCD) Assist Instructions. Page 111 -->
5 <!-- The Binary Coded Decimal Assist instructions operate on Binary Coded Decimal -->
6 <!-- operands (cbcdtd and addg6s) and Decimal Floating-Point operands (cdtbcd) -->
7 <!-- See Chapter 5. for additional information. -->
10 # Convert Declets To Binary Coded Decimal
19 src[64-XLEN:63] <- (RS)
24 result[n+8:n+19] <- DPD_TO_BCD(src[n+12:n+21])
25 result[n+20:n+31] <- DPD_TO_BCD(src[n+22:n+31])
26 RA <- result[64-XLEN:63]
28 Special Registers Altered:
32 # Add and Generate Sixes
40 sum <- (0b0000 || (RA)) + (0b0000 || (RB))
41 carries <- sum ^ (0b0000 || (RA)) ^ (0b0000 || (RB))
42 ones <- [0b0001] * (XLEN / 4)
43 nibbles_need_sixes <- ¬carries[0:XLEN-1] & ones
44 RT <- nibbles_need_sixes * 0b0110
46 Special Registers Altered:
50 # Convert Binary Coded Decimal To Declets
59 src[64-XLEN:63] <- (RS)
64 result[n+12:n+21] <- BCD_TO_DPD(src[n+8:n+19])
65 result[n+22:n+31] <- BCD_TO_DPD(src[n+20:n+31])
66 RA <- result[64-XLEN:63]
68 Special Registers Altered:
72 <!-- Checked March 2021 -->