split out instructions from openpower/isa/bcd.mdwn
authorJacob Lifshay <programmerjake@gmail.com>
Mon, 7 Aug 2023 23:04:00 +0000 (16:04 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Mon, 7 Aug 2023 23:06:58 +0000 (16:06 -0700)
openpower/isa/bcd.mdwn
openpower/isa/bcd/addg6s.mdwn [new file with mode: 0644]
openpower/isa/bcd/addg6s_code.mdwn [new file with mode: 0644]
openpower/isa/bcd/cbcdtd.mdwn [new file with mode: 0644]
openpower/isa/bcd/cbcdtd_code.mdwn [new file with mode: 0644]
openpower/isa/bcd/cdtbcd.mdwn [new file with mode: 0644]
openpower/isa/bcd/cdtbcd_code.mdwn [new file with mode: 0644]

index 3707692f55e146d493b451ad8987d9c5820f7832..a5aea01b67f50a3115fb309bc4f002f1fe2ad066 100644 (file)
@@ -7,66 +7,8 @@
 <!-- See Chapter 5. for additional information. -->
 
 
-# Convert Declets To Binary Coded Decimal
+[[!inline pagenames="openpower/isa/bcd/cdtbcd" raw="yes"]]
 
-X-Form
+[[!inline pagenames="openpower/isa/bcd/addg6s" raw="yes"]]
 
-* cdtbcd RA,RS
-
-Pseudo-code:
-
-    src <- [0]*64
-    src[64-XLEN:63] <- (RS)
-    result <- [0]*64
-    do i = 0 to 1
-      n <- i * 32
-      result[n+0:n+7] <- 0
-      result[n+8:n+19] <- DPD_TO_BCD(src[n+12:n+21])
-      result[n+20:n+31] <- DPD_TO_BCD(src[n+22:n+31])
-    RA <- result[64-XLEN:63]
-
-Special Registers Altered:
-
-    None
-
-# Add and Generate Sixes
-
-XO-Form
-
-* addg6s RT,RA,RB
-
-Pseudo-code:
-
-    sum <- (0b0000 || (RA)) + (0b0000 || (RB))
-    carries <- sum ^ (0b0000 || (RA)) ^ (0b0000 || (RB))
-    ones <- [0b0001] * (XLEN / 4)
-    nibbles_need_sixes <- ¬carries[0:XLEN-1] & ones
-    RT <- nibbles_need_sixes * 0b0110
-
-Special Registers Altered:
-
-    None
-
-# Convert Binary Coded Decimal To Declets
-
-X-Form
-
-* cbcdtd RA,RS
-
-Pseudo-code:
-
-    src <- [0]*64
-    src[64-XLEN:63] <- (RS)
-    result <- [0]*64
-    do i = 0 to 1
-      n <- i * 32
-      result[n+0:n+11] <- 0
-      result[n+12:n+21] <- BCD_TO_DPD(src[n+8:n+19])
-      result[n+22:n+31] <- BCD_TO_DPD(src[n+20:n+31])
-    RA <- result[64-XLEN:63]
-
-Special Registers Altered:
-
-    None
-
-<!-- Checked March 2021 -->
+[[!inline pagenames="openpower/isa/bcd/cbcdtd" raw="yes"]]
diff --git a/openpower/isa/bcd/addg6s.mdwn b/openpower/isa/bcd/addg6s.mdwn
new file mode 100644 (file)
index 0000000..b0905f7
--- /dev/null
@@ -0,0 +1,13 @@
+# Add and Generate Sixes
+
+XO-Form
+
+* addg6s RT,RA,RB
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bcd/addg6s_code" raw="yes"]]
+
+Special Registers Altered:
+
+    None
diff --git a/openpower/isa/bcd/addg6s_code.mdwn b/openpower/isa/bcd/addg6s_code.mdwn
new file mode 100644 (file)
index 0000000..e05b204
--- /dev/null
@@ -0,0 +1,5 @@
+    sum <- (0b0000 || (RA)) + (0b0000 || (RB))
+    carries <- sum ^ (0b0000 || (RA)) ^ (0b0000 || (RB))
+    ones <- [0b0001] * (XLEN / 4)
+    nibbles_need_sixes <- ¬carries[0:XLEN-1] & ones
+    RT <- nibbles_need_sixes * 0b0110
diff --git a/openpower/isa/bcd/cbcdtd.mdwn b/openpower/isa/bcd/cbcdtd.mdwn
new file mode 100644 (file)
index 0000000..572da96
--- /dev/null
@@ -0,0 +1,15 @@
+# Convert Binary Coded Decimal To Declets
+
+X-Form
+
+* cbcdtd RA,RS
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bcd/cbcdtd_code" raw="yes"]]
+
+Special Registers Altered:
+
+    None
+
+<!-- Checked March 2021 -->
diff --git a/openpower/isa/bcd/cbcdtd_code.mdwn b/openpower/isa/bcd/cbcdtd_code.mdwn
new file mode 100644 (file)
index 0000000..ce4e38e
--- /dev/null
@@ -0,0 +1,9 @@
+    src <- [0]*64
+    src[64-XLEN:63] <- (RS)
+    result <- [0]*64
+    do i = 0 to 1
+      n <- i * 32
+      result[n+0:n+11] <- 0
+      result[n+12:n+21] <- BCD_TO_DPD(src[n+8:n+19])
+      result[n+22:n+31] <- BCD_TO_DPD(src[n+20:n+31])
+    RA <- result[64-XLEN:63]
diff --git a/openpower/isa/bcd/cdtbcd.mdwn b/openpower/isa/bcd/cdtbcd.mdwn
new file mode 100644 (file)
index 0000000..4dba6b3
--- /dev/null
@@ -0,0 +1,13 @@
+# Convert Declets To Binary Coded Decimal
+
+X-Form
+
+* cdtbcd RA,RS
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bcd/cdtbcd_code" raw="yes"]]
+
+Special Registers Altered:
+
+    None
diff --git a/openpower/isa/bcd/cdtbcd_code.mdwn b/openpower/isa/bcd/cdtbcd_code.mdwn
new file mode 100644 (file)
index 0000000..340bb71
--- /dev/null
@@ -0,0 +1,9 @@
+    src <- [0]*64
+    src[64-XLEN:63] <- (RS)
+    result <- [0]*64
+    do i = 0 to 1
+      n <- i * 32
+      result[n+0:n+7] <- 0
+      result[n+8:n+19] <- DPD_TO_BCD(src[n+12:n+21])
+      result[n+20:n+31] <- DPD_TO_BCD(src[n+22:n+31])
+    RA <- result[64-XLEN:63]