summaryrefslogtreecommitdiff
path: root/tests/alu
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2017-01-08 21:58:16 -0600
committerBobby Bingham <koorogi@koorogi.info>2017-01-08 23:18:31 -0600
commit17f5cbe781ae761d86d55fec7d46ba3172167894 (patch)
treeb02d0dc075eb94a56cccd49a471e852a6799c266 /tests/alu
parent47cfb7ba2df247310e2160e4e53d1843d4e4d1c8 (diff)
Add carry input to ALU
Diffstat (limited to 'tests/alu')
-rw-r--r--tests/alu15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/alu b/tests/alu
index 474acbb..d271a0c 100644
--- a/tests/alu
+++ b/tests/alu
@@ -1,8 +1,10 @@
# X op Y = RESULT ZERO CARRY
#
# Operations:
-# + : add
-# - : subtract
+# + : add (x+y)
+# ++ : add with carry (x+y+1)
+# - : subtract (x-y)
+# -- : subtract with borrow (x-y-1)
# * : multiply
# / : divide
# & : and
@@ -17,9 +19,12 @@
# ->> : right shift extended with most significant bit
# >>> : right rotate
-0x0123 + 0x1234 = 0x1357 Z=0 C=0
-0x0123 - 0x1234 = 0xeeef Z=0 C=1
-0x0123 - 0x0123 = 0x0000 Z=1 C=0
+0x0123 + 0x1234 = 0x1357 Z=0 C=0
+0x0123 ++ 0x1234 = 0x1358 Z=0 C=0
+0x0123 - 0x1234 = 0xeeef Z=0 C=1
+0x0123 -- 0x1234 = 0xeeee Z=0 C=1
+0x0123 - 0x0123 = 0x0000 Z=1 C=0
+0x0123 -- 0x0123 = 0xffff Z=0 C=1
0x0123 * 0x1234 = 0xb11c Z=0 C=0
0x3e58 / 0x0078 = 0x0085 Z=0 C=0
0xaf74 & 0x7cc7 = 0x2c44 Z=0 C=0