summaryrefslogtreecommitdiff
path: root/sudocode
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@gmail.com>2024-04-12 15:41:55 -0500
committerBrett Weiland <brett_weiland@gmail.com>2024-04-12 15:41:55 -0500
commitb0b2eb6ff181ae84d7a83807f47c3cec25451969 (patch)
treeac26bfaf5e8a665c30fc640970496f89654c222b /sudocode
parent302ed2955552ca681afec3d79e3a3630d0c61a09 (diff)
need to re-read and spellcheck
Diffstat (limited to 'sudocode')
-rw-r--r--sudocode35
1 files changed, 35 insertions, 0 deletions
diff --git a/sudocode b/sudocode
new file mode 100644
index 0000000..455d885
--- /dev/null
+++ b/sudocode
@@ -0,0 +1,35 @@
+Booth:
+ result = multiplier << 1
+ loop (operand length) times:
+ if last two bits are 01:
+ result(upper half) += multiplicand
+ if last two bits are 10:
+ result(upper half) += twos_comp(multiplicand)
+ remove extra bits from result
+ arithmatic shift result right
+ result >> 1
+
+Modified booth:
+ multiplicand(MSB) = multiplicand(second MSB)
+ result = multiplier << 1
+ loop (operand length / 2) times:
+ if last two bits are 001 or 010:
+ result(upper half) += multiplicand
+ if last two bits are 011:
+ result(upper half) += multiplicand * 2
+ if last two bits are 100:
+ result(upper half) += twos_comp(multiplicand) * 2
+ if last two bits are 101 or 110:
+ result(upper half) += twos_comp(multiplicand)
+ remove extra bits from result
+ arithmatic shift result right twice
+ result >> 1
+ result(second MSB) = result(MSB)
+ result(MSB) = 0
+
+
+
+
+
+
+