aboutsummaryrefslogtreecommitdiff
path: root/tests/stack_machine_relop
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stack_machine_relop')
l---------tests/stack_machine_relop/Makefile1
-rw-r--r--tests/stack_machine_relop/instructions.s.tcl235
l---------tests/stack_machine_relop/test.v1
-rw-r--r--tests/stack_machine_relop/words_to_verify.mem40
4 files changed, 277 insertions, 0 deletions
diff --git a/tests/stack_machine_relop/Makefile b/tests/stack_machine_relop/Makefile
new file mode 120000
index 0000000..2c3c770
--- /dev/null
+++ b/tests/stack_machine_relop/Makefile
@@ -0,0 +1 @@
+../stack_machine_store/Makefile \ No newline at end of file
diff --git a/tests/stack_machine_relop/instructions.s.tcl b/tests/stack_machine_relop/instructions.s.tcl
new file mode 100644
index 0000000..5a83b53
--- /dev/null
+++ b/tests/stack_machine_relop/instructions.s.tcl
@@ -0,0 +1,235 @@
+### store 2 values to memory, load them back, add them and store the result
+
+set_sp 0
+
+## compare 1234567890 to itself
+
+const 1234567890
+const 1234567890
+# yields 1
+eq
+store h1EEE0
+
+const 1234567890
+const 1234567890
+# yields 0
+lt
+store h1EEE4
+
+const 1234567890
+const 1234567890
+# yields 0
+ult
+store h1EEE8
+
+const 1234567890
+const 1234567890
+# yields 1
+le
+store h1EEEC
+
+const 1234567890
+const 1234567890
+# yields 1
+ule
+store h1EEF0
+
+const 1234567890
+const 1234567890
+# yields 0
+gt
+store h1EEF4
+
+const 1234567890
+const 1234567890
+# yields 0
+ugt
+store h1EEF8
+
+const 1234567890
+const 1234567890
+# yields 1
+ge
+store h1EEFC
+
+const 1234567890
+const 1234567890
+# yields 1
+uge
+store h1EF00
+
+
+## compare hFFFFFFFF to h7FFFFFFF
+## hFFFFFFFF will be treated as negative for signed operations
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 0
+eq
+store h1F0E0
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 1
+lt
+store h1F0E4
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 0
+ult
+store h1F0E8
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 1
+le
+store h1F0EC
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 0
+ule
+store h1F0F0
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 0
+gt
+store h1F0F4
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 1
+ugt
+store h1F0F8
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 0
+ge
+store h1F0FC
+
+const hFFFFFFFF
+const h7FFFFFFF
+# yields 1
+uge
+store h1F100
+
+
+## compare 18532 to 234, no signedness magic here
+
+const 18532
+const 234
+# yields 0
+eq
+store h1F2E0
+
+const 18532
+const 234
+# yields 0
+lt
+store h1F2E4
+
+const 18532
+const 234
+# yields 0
+ult
+store h1F2E8
+
+const 18532
+const 234
+# yields 0
+le
+store h1F2EC
+
+const 18532
+const 234
+# yields 0
+ule
+store h1F2F0
+
+const 18532
+const 234
+# yields 1
+gt
+store h1F2F4
+
+const 18532
+const 234
+# yields 1
+ugt
+store h1F2F8
+
+const 18532
+const 234
+# yields 1
+ge
+store h1F2FC
+
+const 18532
+const 234
+# yields 1
+uge
+store h1F300
+
+
+## compare 123 to -1294081
+## -1294081 will be interpreted as big positive number for unsigned operations
+
+const 123
+const -1294081
+# yields 0
+eq
+store h1F4E0
+
+const 123
+const -1294081
+# yields 0
+lt
+store h1F4E4
+
+const 123
+const -1294081
+# yields 1
+ult
+store h1F4E8
+
+const 123
+const -1294081
+# yields 0
+le
+store h1F4EC
+
+const 123
+const -1294081
+# yields 1
+ule
+store h1F4F0
+
+const 123
+const -1294081
+# yields 1
+gt
+store h1F4F4
+
+const 123
+const -1294081
+# yields 0
+ugt
+store h1F4F8
+
+const 123
+const -1294081
+# yields 1
+ge
+store h1F4FC
+
+const 123
+const -1294081
+# yields 0
+uge
+store h1F500
+
+
+halt
diff --git a/tests/stack_machine_relop/test.v b/tests/stack_machine_relop/test.v
new file mode 120000
index 0000000..f5b6a59
--- /dev/null
+++ b/tests/stack_machine_relop/test.v
@@ -0,0 +1 @@
+../stack_machine_store/test.v \ No newline at end of file
diff --git a/tests/stack_machine_relop/words_to_verify.mem b/tests/stack_machine_relop/words_to_verify.mem
new file mode 100644
index 0000000..b0564a3
--- /dev/null
+++ b/tests/stack_machine_relop/words_to_verify.mem
@@ -0,0 +1,40 @@
+// address value
+ 1EEE0 1
+ 1EEE4 0
+ 1EEE8 0
+ 1EEEC 1
+ 1EEF0 1
+ 1EEF4 0
+ 1EEF8 0
+ 1EEFC 1
+ 1EF00 1
+
+ 1F0E0 0
+ 1F0E4 1
+ 1F0E8 0
+ 1F0EC 1
+ 1F0F0 0
+ 1F0F4 0
+ 1F0F8 1
+ 1F0FC 0
+ 1F100 1
+
+ 1F2E0 0
+ 1F2E4 0
+ 1F2E8 0
+ 1F2EC 0
+ 1F2F0 0
+ 1F2F4 1
+ 1F2F8 1
+ 1F2FC 1
+ 1F300 1
+
+ 1F4E0 0
+ 1F4E4 0
+ 1F4E8 1
+ 1F4EC 0
+ 1F4F0 1
+ 1F4F4 1
+ 1F4F8 0
+ 1F4FC 1
+ 1F500 0