aboutsummaryrefslogtreecommitdiff
path: root/tests/soc_measure_time/instructions.s.tcl
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-11-21 21:35:54 +0100
committerWojciech Kosior <kwojtus@protonmail.com>2020-11-21 21:35:54 +0100
commitb44a3a201ee2b524f31aa93abfe4abd8b756a533 (patch)
tree3e51f9fa39e54139b913351d81fc0fe1cf299c53 /tests/soc_measure_time/instructions.s.tcl
parent8999a1a82eddb97fa2d4aa7de12e88a3205d0e3d (diff)
downloadAGH-engineering-thesis-b44a3a201ee2b524f31aa93abfe4abd8b756a533.tar.gz
AGH-engineering-thesis-b44a3a201ee2b524f31aa93abfe4abd8b756a533.zip
add miscellaneous module, which controls led2 and button2 and provides a timer; include a testbench for timer and led
Diffstat (limited to 'tests/soc_measure_time/instructions.s.tcl')
-rw-r--r--tests/soc_measure_time/instructions.s.tcl57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/soc_measure_time/instructions.s.tcl b/tests/soc_measure_time/instructions.s.tcl
new file mode 100644
index 0000000..b1f8511
--- /dev/null
+++ b/tests/soc_measure_time/instructions.s.tcl
@@ -0,0 +1,57 @@
+## also look at stack_machine_cond_jump test
+
+## we're going to write numbers from 0 to 639 at addresses h100000 to h1009FC
+## and then write non-zero value at h100A00
+
+# this will translate to 2 16-bit instructions
+set_sp h100000
+
+## load current value of timer, in a loop
+## this is address 4 we later jump to
+# this will translate to 2 16-bit instructions
+loadwzx h1C0008
+
+## loop until timer exceeds 500
+# this will translate to 2 16-bit instructions
+const 500
+# this will translate to 1 16-bit instruction
+lt
+# this will translate to 1 16-bit instruction
+cond_jump 4
+
+## now, light led2
+# this will translate to 1 16-bit instruction
+const 1
+# this will translate to 2 16-bit instructions
+storew h1C0006
+
+## second loop, analogous to the first one
+## this is address 22 we later jump to
+# this will translate to 2 16-bit instructions
+loadwzx h1C0008
+
+## loop until timer exceeds 1000
+# this will translate to 2 16-bit instructions
+const 1000
+# this will translate to 1 16-bit instruction
+lt
+# this will translate to 1 16-bit instruction
+cond_jump 22
+
+## now, switch led2 off
+# this will translate to 1 16-bit instruction
+const 0
+# this will translate to 2 16-bit instructions
+storew h1C0006
+
+## third loop, analogous to the first two
+## this is address 40 we later jump to
+loadwzx h1C0008
+
+## loop until timer exceeds 1500
+const 1500
+lt
+cond_jump 40
+
+## finish operation (will also put led1 on)
+halt