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

25 lines
421 B

.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
ebreak
fnNeg:
# All good
addi a0, zero, 0
ebreak
fn0:
# Check ra value with our t0 construct
beq t0, ra, eq0
ebreak
eq0:
# Try to jump back to a negative offset
jal ra, fnNeg