a risc-v simulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
vriscv/tests/jal.s

27 lines
444 B

.include "exit_return.s"
.global _start
_start:
# Set base value of a0 to 'test failed'
addi a0, zero, 1
# Construct value that ra should have in t0
auipc t0, 0
addi t0, t0, 12
# Jump and link
jal ra, fn0
exret
fnNeg:
# All good
addi a0, zero, 0
exret
fn0:
# Check ra value with our t0 construct
beq t0, ra, eq0
exret
eq0:
# Try to jump back to a negative offset
jal ra, fnNeg