2011-02-17 23:45:16 +01:00
|
|
|
|
2014-04-22 20:18:43 +02:00
|
|
|
.equ MAX_TESTNAME_LEN, 32
|
2011-02-17 23:45:16 +01:00
|
|
|
.macro test_name name
|
|
|
|
.data
|
|
|
|
tn_\name:
|
2014-04-22 20:18:43 +02:00
|
|
|
.ascii "\name"
|
|
|
|
.space MAX_TESTNAME_LEN - (. - tn_\name), ' '
|
2011-02-17 23:45:16 +01:00
|
|
|
.text
|
2014-04-22 20:18:43 +02:00
|
|
|
.global \name
|
|
|
|
\name:
|
|
|
|
addi sp, sp, -12
|
|
|
|
sw (sp+4), r1
|
|
|
|
sw (sp+8), r2
|
|
|
|
sw (sp+12), r3
|
|
|
|
mvi r1, 1
|
|
|
|
mvhi r2, hi(tn_\name)
|
|
|
|
ori r2, r2, lo(tn_\name)
|
|
|
|
mvi r3, MAX_TESTNAME_LEN
|
|
|
|
calli _write
|
|
|
|
lw r3, (sp+12)
|
|
|
|
lw r2, (sp+8)
|
|
|
|
lw r1, (sp+4)
|
|
|
|
addi sp, sp, 12
|
2011-02-17 23:45:16 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro load reg val
|
|
|
|
mvhi \reg, hi(\val)
|
|
|
|
ori \reg, \reg, lo(\val)
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro tc_pass
|
2014-04-22 20:18:43 +02:00
|
|
|
calli _tc_pass
|
2011-02-17 23:45:16 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro tc_fail
|
2014-04-22 20:18:43 +02:00
|
|
|
addi r12, r12, 1
|
|
|
|
calli _tc_fail
|
2011-02-17 23:45:16 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro check_r3 val
|
|
|
|
mvhi r13, hi(\val)
|
|
|
|
ori r13, r13, lo(\val)
|
|
|
|
be r3, r13, 1f
|
|
|
|
tc_fail
|
|
|
|
bi 2f
|
|
|
|
1:
|
|
|
|
tc_pass
|
|
|
|
2:
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro check_mem adr val
|
|
|
|
mvhi r13, hi(\adr)
|
|
|
|
ori r13, r13, lo(\adr)
|
|
|
|
mvhi r14, hi(\val)
|
|
|
|
ori r14, r14, lo(\val)
|
|
|
|
lw r13, (r13+0)
|
|
|
|
be r13, r14, 1f
|
|
|
|
tc_fail
|
|
|
|
bi 2f
|
|
|
|
1:
|
|
|
|
tc_pass
|
|
|
|
2:
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro check_excp excp
|
|
|
|
andi r13, r25, \excp
|
|
|
|
bne r13, r0, 1f
|
|
|
|
tc_fail
|
|
|
|
bi 2f
|
|
|
|
1:
|
|
|
|
tc_pass
|
|
|
|
2:
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro start
|
|
|
|
.global _main
|
|
|
|
.text
|
|
|
|
_main:
|
2014-04-22 20:18:43 +02:00
|
|
|
mvi r12, 0
|
2011-02-17 23:45:16 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro end
|
2014-04-22 20:18:43 +02:00
|
|
|
mv r1, r12
|
|
|
|
calli _exit
|
2011-02-17 23:45:16 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
# base +
|
|
|
|
# 0 ctrl
|
|
|
|
# 4 pass/fail
|
|
|
|
# 8 ptr to test name
|