From: Luke Kenneth Casson Leighton Date: Sat, 28 Mar 2020 20:49:15 +0000 (+0000) Subject: add bcd X-Git-Tag: convert-csv-opcode-to-binary~3031 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d51b884a0114debe0f4cd5c3409b6b20cebdfe7;p=libreriscv.git add bcd --- diff --git a/openpower/isa/bcd.mdwn b/openpower/isa/bcd.mdwn new file mode 100644 index 000000000..ff1afc58b --- /dev/null +++ b/openpower/isa/bcd.mdwn @@ -0,0 +1,28 @@ +# Convert Declets To Binary Coded Decimal + +cdtbcd RA, RS + + do i = 0 to 1 + n <- i * 32 + RA[n+0:n+7] <- 0 + RA[n+8:n+19 ] <- DPD_TO_BCD( (RS)[n+12:n+21] ) + RA[n+20:n+31] <- DPD_TO_BCD( (RS)[n+22:n+31] ) + +# Add and Generate Sixes + +addg6s RT,RA,RB + + do i = 0 to 15 + dci <- carry_out(RA[4xi:63] + RB[4xi:63]) + c <- [dc[0]]*4 || [dc[1]]*4 || ... || [dc[15]]*4 + RT <- (¬c) & 0x6666_6666_6666_6666 + +# Convert Binary Coded Decimal To Declets + +cbcdtd RA, RS + + do i = 0 to 1 + n <- i * 32 + RA[n+0:n+11] <- 0 + RA[n+12:n+21] <- BCD_TO_DPD( (RS)[n+8:n+19] ) + RA[n+22:n+31] <- BCD_TO_DPD( (RS)[n+20:n+31] )