summaryrefslogtreecommitdiff
path: root/sim/testsuite/riscv/testutils.inc
blob: b9680b9c22e09c3591d82408c3bc47d314e2feb7 (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
# MACRO: exit
	.macro exit nr
	li a0, \nr
	# The exit utility function.
	li a7, 93;
	# Trigger OS trap.
	ecall;
	.endm

# MACRO: pass
# Write 'pass' to stdout and quit.
	.macro pass
	# syscall write().
	li a7, 64;
	# Use stdout.
	li a0, 1;
	# Point to the string.
	lla a1, 1f;
	# Number of bytes to write.
	li a2, 5;
	# Trigger OS trap.
	ecall;
	exit 0;
	.data
	1: .asciz "pass\n"
	.endm

# MACRO: fail
# Write 'fail' to stdout and quit.
	.macro fail
	# syscall write().
	li a7, 64;
	# Use stdout.
	li a0, 1;
	# Point to the string.
	lla a1, 1f;
	# Number of bytes to write.
	li a2, 5;
	# Trigger OS trap.
	ecall;
	exit 0;
	.data
	1: .asciz "fail\n"
	.endm

# MACRO: start
# All assembler tests should start with a call to "start".
	.macro start
	.text
.global _start
_start:
	.endm