This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize
for the AI-speak, we are working on rewriting it!
Notebooks · lib/rv32/tests/riscv/rv32ui_jal
lib/ rv32/ tests/ riscv/ rv32ui_jal.viv Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.
[1] ▶ Run lines 1–54
# riscv-tests rv32ui/jal.S, preprocessed by tools/rv32/riscv_tests.py
# (riscv-tests commit 7b68f7b91f82; BSD-3-Clause, The Regents of the
# University of California). Generated: do not edit.
from rv32.system import run_asm, STEP_LIMIT
SOURCE = """
.text
_start:
test_2:
li gp, 2
li ra, 0
jal x4, target_2
linkaddr_2:
nop
nop
j fail
target_2:
la x2, linkaddr_2
bne x2, x4, fail
test_3: li gp, 3
li ra, 1
jal x0, 1f
addi ra, ra, 1
addi ra, ra, 1
addi ra, ra, 1
addi ra, ra, 1
1: addi ra, ra, 1
addi ra, ra, 1
li x7, 3
bne ra, x7, fail
bne x0, gp, pass
fail: mv a0, gp
li a7, 93
ecall
pass: li gp, 1
li a7, 93
li a0, 0
ecall
.data
.data
"""
result = run_asm (SOURCE, STEP_LIMIT)
show "rv32ui-jal" , result.exit_code, result.steps
test "rv32ui-jal passes every case" {
assert_true (result.halted)
assert_true (result.exit_code == 0 )
}
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2012-2015 The Regents of the University of California (Regents)
# SPDX-FileCopyrightText: 2026 The Viv authors