aboutsummaryrefslogtreecommitdiff
path: root/tests/stack_machine_old_load_store
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-03 20:22:41 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-03 20:22:41 +0200
commitefd0269b55e2db03f5c12d6f47b00b0c2a57ff66 (patch)
treed5715c26f8a7b935baea0af6558f9d415e110f21 /tests/stack_machine_old_load_store
parent43f4e586acf76f3ec08d5892ba784ba6ac5d1932 (diff)
downloadAGH-engineering-thesis-efd0269b55e2db03f5c12d6f47b00b0c2a57ff66.tar.gz
AGH-engineering-thesis-efd0269b55e2db03f5c12d6f47b00b0c2a57ff66.zip
rename stack_machine to stack_machine_old (prepare for redesign of the machine)
Diffstat (limited to 'tests/stack_machine_old_load_store')
-rwxr-xr-xtests/stack_machine_old_load_store/instructions.s.tcl109
l---------tests/stack_machine_old_load_store/test.v1
-rw-r--r--tests/stack_machine_old_load_store/words_to_verify.mem12
3 files changed, 122 insertions, 0 deletions
diff --git a/tests/stack_machine_old_load_store/instructions.s.tcl b/tests/stack_machine_old_load_store/instructions.s.tcl
new file mode 100755
index 0000000..13cabcb
--- /dev/null
+++ b/tests/stack_machine_old_load_store/instructions.s.tcl
@@ -0,0 +1,109 @@
+#!/usr/bin/env tclsh
+
+source tclasm.tcl
+
+### another simple test - set stack to h7FFFC, store 4 numbers on stack (only 2
+### will really get written to memory, other 2 will remain in r0 and r1),
+### then pop all the numbers and write them to h57574
+
+
+## set sp to h7FFFC (actually, lowest bit is assumed 0 and not stored there)
+# 7777 FFFF F
+# bits 19:11 of h7FFFC are 0111 1111 1
+_immediate im=b011111111
+# FFf FFFF CCCC
+# bits 10:0 of h7FFFC are 111 1111 1100
+_immediate im<<=b11111111100
+
+_extended_instruction set_sp
+
+## get value h01010202 into r1
+# 0000 1111 00
+# bits 31:22 of h01010202 are 0000 0001 00
+_immediate im<<=b0000000100
+# 00 1111 0000 2
+# bits 21:11 of h01010202 are 00 0001 0000 0
+_immediate im<<=b00000100000
+# 222 0000 2222
+# bits 10:0 of h01010202 are 010 0000 0010
+_exchange_im im<<=b01000000010
+
+## get value h03030404 into r1
+stack down
+# 0000 3333 00
+# bits 31:22 of h03030404 are 0000 0011 00
+_immediate im<<=b0000001100
+# 00 3333 0000 4
+# bits 21:11 of h03030404 are 00 0011 0000 0
+_immediate im<<=b00001100000
+# 444 0000 4444
+# bits 10:0 of h03030404 are 100 0000 0100
+_exchange_im im<<=b10000000100
+
+## get value h05050606 into r1
+stack down
+# 0000 5555 00
+# bits 31:22 of h05050606 are 0000 0101 00
+_immediate im<<=b0000010100
+# 00 5555 0000 6
+# bits 21:11 of h05050606 are 00 0101 0000 0
+_immediate im<<=b00010100000
+# 666 0000 6666
+# bits 10:0 of h05050606 are 110 0000 0110
+_exchange_im im<<=b11000000110
+
+## get value h07070808 into r1
+stack down
+# 0000 7777 00
+# bits 31:22 of h07070808 are 0000 0111 00
+_immediate im<<=b0000011100
+# 00 7777 0000 8
+# bits 21:11 of h07070808 are 00 0111 0000 1
+_immediate im<<=b00011100001
+# 888 0000 8888
+# bits 10:0 of h07070808 are 000 0000 1000
+_exchange_im im<<=b00000001000
+
+## get address h57574 into im and write r1 to that address
+# 5555 7777 5
+# bits 19:11 of h57574 are 0101 0111 0
+_immediate im=b010101110
+# 555 7777 4444
+# bits 10:0 of h57574 are 101 0111 0100
+store im<<=b10101110100
+
+# get r0 to r1
+stack up
+
+## get address h57578 into im and write r1 to that address
+# 5555 7777 5
+# bits 19:11 of h57578 are 0101 0111 0
+_immediate im=b010101110
+# 555 7777 8888
+# bits 10:0 of h57578 are 101 0111 1000
+store im<<=b10101111000
+
+# get r0 to r1
+stack up
+
+## get address h5757C into im and write r1 to that address
+# 5555 7777 5
+# bits 19:11 of h5757C are 0101 0111 0
+_immediate im=b010101110
+# 555 7777 CCCC
+# bits 10:0 of h5757C are 101 0111 1100
+store im<<=b10101111100
+
+# get r0 to r1
+stack up
+
+## get address h57580 into im and write r1 to that address
+# 5555 7777 5
+# bits 19:11 of h57580 are 0101 0111 0
+_immediate im=b010101110
+# 555 8888 0000
+# bits 10:0 of h57580 are 101 1000 0000
+store im<<=b10110000000
+
+## finish test
+halt
diff --git a/tests/stack_machine_old_load_store/test.v b/tests/stack_machine_old_load_store/test.v
new file mode 120000
index 0000000..f0c3cf9
--- /dev/null
+++ b/tests/stack_machine_old_load_store/test.v
@@ -0,0 +1 @@
+../stack_machine_old_store/test.v \ No newline at end of file
diff --git a/tests/stack_machine_old_load_store/words_to_verify.mem b/tests/stack_machine_old_load_store/words_to_verify.mem
new file mode 100644
index 0000000..349b213
--- /dev/null
+++ b/tests/stack_machine_old_load_store/words_to_verify.mem
@@ -0,0 +1,12 @@
+// address value
+ 57574 0808
+ 57576 0707
+
+ 57578 0606
+ 5757A 0505
+
+ 5757C 0404
+ 5757E 0303
+
+ 57580 0202
+ 57582 0101