aboutsummaryrefslogtreecommitdiff
path: root/examples/example1b_blink_led_tclasm/instructions.s.tcl
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-12-28 11:09:30 +0100
committerWojciech Kosior <kwojtus@protonmail.com>2020-12-28 11:09:30 +0100
commitec9a0f72c6b7d74c9a7e2d4eaef44e26037eaca2 (patch)
treeb6971abb7d5233e0b4b5c24c1983429ce3d49f30 /examples/example1b_blink_led_tclasm/instructions.s.tcl
parentfac2f26447a0789a6142a690cefc7a3713f446bf (diff)
downloadAGH-engineering-thesis-ec9a0f72c6b7d74c9a7e2d4eaef44e26037eaca2.tar.gz
AGH-engineering-thesis-ec9a0f72c6b7d74c9a7e2d4eaef44e26037eaca2.zip
also add a wasm version of example1 for comparison
Diffstat (limited to 'examples/example1b_blink_led_tclasm/instructions.s.tcl')
-rw-r--r--examples/example1b_blink_led_tclasm/instructions.s.tcl57
1 files changed, 57 insertions, 0 deletions
diff --git a/examples/example1b_blink_led_tclasm/instructions.s.tcl b/examples/example1b_blink_led_tclasm/instructions.s.tcl
new file mode 100644
index 0000000..3a69c7b
--- /dev/null
+++ b/examples/example1b_blink_led_tclasm/instructions.s.tcl
@@ -0,0 +1,57 @@
+## adapted from soc_measure_time 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 1500
+# this will translate to 2 16-bit instructions
+const 1500
+# 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 3000
+# this will translate to 2 16-bit instructions
+const 3000
+# 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 4500
+const 4500
+lt
+cond_jump 40
+
+## finish operation (will also put led1 on)
+halt