aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-12-28 10:44:00 +0100
committerWojciech Kosior <kwojtus@protonmail.com>2020-12-28 10:44:00 +0100
commitfac2f26447a0789a6142a690cefc7a3713f446bf (patch)
tree8b1f7d9a1cf2bd6498bc7f03c593705d8c08b152
parent4405535099fae4e1c01260f730d51a8b21d11806 (diff)
downloadAGH-engineering-thesis-fac2f26447a0789a6142a690cefc7a3713f446bf.tar.gz
AGH-engineering-thesis-fac2f26447a0789a6142a690cefc7a3713f446bf.zip
add a tclasm version of example2
-rw-r--r--examples/example2c_measure_time_tclasm/Makefile3
-rw-r--r--examples/example2c_measure_time_tclasm/instructions.s.tcl52
2 files changed, 55 insertions, 0 deletions
diff --git a/examples/example2c_measure_time_tclasm/Makefile b/examples/example2c_measure_time_tclasm/Makefile
new file mode 100644
index 0000000..b4058ef
--- /dev/null
+++ b/examples/example2c_measure_time_tclasm/Makefile
@@ -0,0 +1,3 @@
+SIMFLAGS += -DFINISH_ON_LED1=1 -DFINISH_ON_LED2=1
+
+include ../../Makefile.example
diff --git a/examples/example2c_measure_time_tclasm/instructions.s.tcl b/examples/example2c_measure_time_tclasm/instructions.s.tcl
new file mode 100644
index 0000000..39e1666
--- /dev/null
+++ b/examples/example2c_measure_time_tclasm/instructions.s.tcl
@@ -0,0 +1,52 @@
+## also look at soc_measure_time test
+
+### we do some of the same operations as in example2a and example2b
+
+# this will translate to 2 16-bit instructions
+set_sp h100000
+
+## reset the timer
+# this will translate to 1 16-bit instruction
+const 0
+# this will translate to 2 16-bit instructions
+storew h1C0008
+
+### we're going to add numbers from 0 to 100
+## initialize counter
+# this will translate to 1 16-bit instruction
+const 0
+# this will translate to 2 16-bit instructions
+storew h080000
+
+## initialize sum variable
+# this will translate to 1 16-bit instruction
+const 0
+
+### this is the point we later jump to, address 18
+## load counter value, add it to the sum
+loadwzx h080000
+add
+
+## increase counter
+loadwzx h080000
+const 1
+add
+storew h080000
+
+## compare counter to 100
+loadwzx h080000
+const 100
+lt
+cond_jump 18
+
+## light LED2
+const 1
+storew h1C0006
+
+### at this point we skip displaying to VGA - it'd be too cumbersome
+### to do in tclasm
+## store sum somewhere
+store h080004
+
+## finish operation (will also put led1 on)
+halt