1#include "soc/rtc_cntl_reg.h"
2#include "soc/rtc_io_reg.h"
3#include "soc/soc_ulp.h"
4
5	.bss
6
7	.global jumps_pass
8jumps_pass:
9	.long 0
10
11	.global jumps_fail
12jumps_fail:
13	.long 0
14
15	.text
16	.global test_jumps
17test_jumps:
18
19	/* tests for LT (less than) condition */
20	stage_rst           /* cnt = 0 */
21	jumps test_fail, 0, LT /* 0 < 0: false, should not jump */
22	jumps 1f, 1, LT     /* 0 < 1: true, should jump */
23	jump test_fail
241:
25	stage_inc 2         /* cnt = 2 */
26	jumps 1f, 3, LT     /* 2 < 1: true */
27	jump test_fail
281:
29	jumps test_fail, 1, LT  /* 2 < 1: false */
30	jumps test_fail, 2, LT  /* 2 < 2: false */
31
32	/* tests for LE (less or equal) condition */
33	stage_rst           /* cnt = 0 */
34	jumps 1f, 0, LE     /* 0 <= 0: true */
35	jump test_fail
361:
37	jumps 1f, 1, LE     /* 0 <= 1: true */
38	jump test_fail
391:
40	stage_inc 2         /* cnt = 2 */
41	jumps test_fail, 1, LE  /* 2 <= 1: false */
42
43	/* tests for EQ (equal) condition */
44	stage_rst           /* cnt = 0 */
45	jumps 1f, 0, EQ     /* 0 = 0: true */
46	jump test_fail
471:
48	jumps test_fail, 1, EQ  /* 0 = 1: false */
49
50	stage_inc 1         /* cnt = 1 */
51	jumps test_fail, 0, EQ  /* 1 = 0: false */
52	jumps test_fail, 2, EQ  /* 1 = 2: false */
53	jumps 1f, 1, EQ         /* 1 = 1: true */
541:
55
56	/* tests for GE (greater or equal) condition */
57	stage_rst           /* cnt = 0 */
58	jumps 1f, 0, GE     /* 0 >= 0: true */
59	jump test_fail
601:
61	jumps test_fail, 1, GE  /* 0 >= 1: false */
62
63	stage_inc 1         /* cnt = 1 */
64	jumps 1f, 0, GE     /* 1 >= 0: true */
65	jump test_fail
661:
67	jumps 1f, 1, GE     /* 1 >= 1: true */
68	jump test_fail
691:
70	jumps test_fail, 2, GE  /* 1 >= 2: false */
71
72	/* tests for GT (greater than) condition */
73	stage_rst           /* cnt = 0 */
74	jumps test_fail, 0, GT  /* 0 > 0: false */
75	jumps test_fail, 1, GE  /* 0 > 1: false */
76
77	stage_inc 1         /* cnt = 1 */
78	jumps 1f, 0, GT     /* 1 > 0: true */
79	jump test_fail
801:
81	jumps test_fail, 1, GT  /* 1 > 1: false */
82	jumps test_fail, 2, GT  /* 1 > 2: false */
83
84	jump test_pass
85
86test_fail:
87	move r0, jumps_fail
88	move r1, 1
89	st r1, r0, 0
90	jump done
91
92test_pass:
93	move r0, jumps_pass
94	move r1, 1
95	st r1, r0, 0
96	jump done
97
98	.global done
99done:
100	wake
101	halt
102