aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-05 16:58:33 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-05 16:58:33 +0200
commit3ec21a949b0887e32bbffcdb38a5738abfe8cfd0 (patch)
treeaee2db72c364053e56d985ad3e697c42ddfca7f5 /tests
parent40a11a7155bc474d85ded1fef183baae2007f101 (diff)
downloadAGH-engineering-thesis-3ec21a949b0887e32bbffcdb38a5738abfe8cfd0.tar.gz
AGH-engineering-thesis-3ec21a949b0887e32bbffcdb38a5738abfe8cfd0.zip
add add instruction together with bench
Diffstat (limited to 'tests')
-rwxr-xr-xtests/stack_machine_add/instructions.s.tcl23
l---------tests/stack_machine_add/test.v1
-rw-r--r--tests/stack_machine_add/words_to_verify.mem6
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/stack_machine_add/instructions.s.tcl b/tests/stack_machine_add/instructions.s.tcl
new file mode 100755
index 0000000..c0a9449
--- /dev/null
+++ b/tests/stack_machine_add/instructions.s.tcl
@@ -0,0 +1,23 @@
+#!/usr/bin/env tclsh
+
+source tclasm.tcl
+
+### store 2 values to memory, load them back, add them and store the result
+
+set_sp 0
+
+const 12345678
+store h1EEE0
+const 40302010
+store h1EEE4
+
+const 8
+
+load h1EEE0
+load h1EEE4
+# adding 40302010 to 12345678 should yield 52647688
+add
+# will write to h1EEE0 + 8 = h1EEE8
+store+ h1EEE0
+
+halt
diff --git a/tests/stack_machine_add/test.v b/tests/stack_machine_add/test.v
new file mode 120000
index 0000000..f5b6a59
--- /dev/null
+++ b/tests/stack_machine_add/test.v
@@ -0,0 +1 @@
+../stack_machine_store/test.v \ No newline at end of file
diff --git a/tests/stack_machine_add/words_to_verify.mem b/tests/stack_machine_add/words_to_verify.mem
new file mode 100644
index 0000000..601e8fd
--- /dev/null
+++ b/tests/stack_machine_add/words_to_verify.mem
@@ -0,0 +1,6 @@
+// address value
+ 1EEE0 BC614E // 12345678 in hex is BC614E
+
+ 1EEE4 266F5BA // 40302010 in hex is 266F5BA
+
+ 1EEE8 3235708 // 52647688 in hex is 3235708