handler ## testnum: \
vxcptkill; \
li TESTNUM,2; \
- vxcptcause a0; \
+ csrr a0, scause; \
li a1,HWACHA_CAUSE_TVEC_ILLEGAL_REGID; \
bne a0,a1,fail; \
- vxcptaux a0; \
+ csrr a0, sbadaddr; \
la a1, illegal ## testnum; \
lw a2, 0(a1); \
bne a0, a2, fail; \
handler ## testnum: \
vxcptkill; \
li TESTNUM,2; \
- vxcptcause a0; \
+ csrr a0, scause; \
li a1,HWACHA_CAUSE_VF_ILLEGAL_REGID; \
bne a0,a1,fail; \
- vxcptaux a0; \
+ csrr a0, sbadaddr; \
la a1,illegal ## testnum; \
bne a0,a1,fail; \
vsetcfg 32,0; \
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_ILLEGAL_CFG
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
li a4, 1
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_ILLEGAL_CFG
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
li a4, 0
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_ILLEGAL_INSTRUCTION
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
li a4, 0xff00002b
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_VF_ILLEGAL_INSTRUCTION
bne a3,a4,fail
# check badvaddr
- vxcptaux a3
+ csrr a3, sbadaddr
la a4,illegal
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_MISALIGNED_LOAD
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
la a4,dest+1
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_MISALIGNED_STORE
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
la a4, dest+1
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_MISALIGNED_LOAD
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
la a4,dest+1
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_MISALIGNED_STORE
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
la a4,dest+1
bne a3,a4,fail
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_VF_MISALIGNED_FETCH
bne a3,a4,fail
# check badvaddr
- vxcptaux a3
+ csrr a3, sbadaddr
la a4,vtcode1+2
andi a3, a3, -4 # mask off lower bits so that may
andi a4, a4, -4 # ignore impl. specific behavior
li TESTNUM,2
# check cause
- vxcptcause a3
+ csrr a3, scause
li a4,HWACHA_CAUSE_PRIVILEGED_INSTRUCTION
bne a3,a4,fail
# check vec irq aux
- vxcptaux a3
+ csrr a3, sbadaddr
la a4, privileged_inst
lw a5, 0(a4)
bne a3,a5,fail