Notebooks · lib/rv32/tests/riscv/rv32ui_lh
lib/ rv32/ tests/ riscv/ rv32ui_lh.viv
lib/rv32/tests/riscv/rv32ui_lh.viv · 1 code cellOpen in the workbenchDownload .vivLook inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
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]lines 1–173
# riscv-tests rv32ui/lh.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 x15, 0x00000000000000ff la x2, tdat lh x14, 0(x2) li x7, 255 bne x14, x7, fail test_3: li gp, 3 li x15, 0xffffffffffffff00 la x2, tdat lh x14, 2(x2) li x7, 4294967040 bne x14, x7, fail test_4: li gp, 4 li x15, 0x0000000000000ff0 la x2, tdat lh x14, 4(x2) li x7, 4080 bne x14, x7, fail test_5: li gp, 5 li x15, 0xfffffffffffff00f la x2, tdat lh x14, 6(x2) li x7, 4294963215 bne x14, x7, fail test_6: li gp, 6 li x15, 0x00000000000000ff la x2, tdat4 lh x14, -6(x2) li x7, 255 bne x14, x7, fail test_7: li gp, 7 li x15, 0xffffffffffffff00 la x2, tdat4 lh x14, -4(x2) li x7, 4294967040 bne x14, x7, fail test_8: li gp, 8 li x15, 0x0000000000000ff0 la x2, tdat4 lh x14, -2(x2) li x7, 4080 bne x14, x7, fail test_9: li gp, 9 li x15, 0xfffffffffffff00f la x2, tdat4 lh x14, 0(x2) li x7, 4294963215 bne x14, x7, fail test_10: li gp, 10 la x1, tdat addi x1, x1, -32 lh x5, 32(x1) li x7, 255 bne x5, x7, fail test_11: li gp, 11 la x1, tdat addi x1, x1, -5 lh x5, 7(x1) li x7, 4294967040 bne x5, x7, fail test_12: li gp, 12 li x4, 0 1: la x13, tdat2 lh x14, 2(x13) addi x6, x14, 0 li x7, 0x0000000000000ff0 bne x6, x7, fail addi x4, x4, 1 li x5, 2 bne x4, x5, 1b test_13: li gp, 13 li x4, 0 1: la x13, tdat3 lh x14, 2(x13) nop addi x6, x14, 0 li x7, 0xfffffffffffff00f bne x6, x7, fail addi x4, x4, 1 li x5, 2 bne x4, x5, 1b test_14: li gp, 14 li x4, 0 1: la x13, tdat1 lh x14, 2(x13) nop nop addi x6, x14, 0 li x7, 0xffffffffffffff00 bne x6, x7, fail addi x4, x4, 1 li x5, 2 bne x4, x5, 1b test_15: li gp, 15 li x4, 0 1: la x13, tdat2 lh x14, 2(x13) li x7, 0x0000000000000ff0 bne x14, x7, fail addi x4, x4, 1 li x5, 2 bne x4, x5, 1b test_16: li gp, 16 li x4, 0 1: la x13, tdat3 nop lh x14, 2(x13) li x7, 0xfffffffffffff00f bne x14, x7, fail addi x4, x4, 1 li x5, 2 bne x4, x5, 1b test_17: li gp, 17 li x4, 0 1: la x13, tdat1 nop nop lh x14, 2(x13) li x7, 0xffffffffffffff00 bne x14, x7, fail addi x4, x4, 1 li x5, 2 bne x4, x5, 1b test_18: li gp, 18 la x5, tdat lh x2, 0(x5) li x2, 2 li x7, 2 bne x2, x7, fail test_19: li gp, 19 la x5, tdat lh x2, 0(x5) nop li x2, 2 li x7, 2 bne x2, 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 tdat: tdat1: .half 0x00ff tdat2: .half 0xff00 tdat3: .half 0x0ff0 tdat4: .half 0xf00f """ result = run_asm(SOURCE, STEP_LIMIT) show "rv32ui-lh", result.exit_code, result.steps test "rv32ui-lh 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