aboutsummaryrefslogtreecommitdiff
path: root/examples/example1_blink_led/instructions.s.tcl
blob: 13c51e23cee66958ddf07ac3a27add9a9ee6f1b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 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