diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example2c_measure_time_tclasm/Makefile | 3 | ||||
-rw-r--r-- | examples/example2c_measure_time_tclasm/instructions.s.tcl | 52 |
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 |