Webcentive RISC-V Reference

Zba instructions

Address generation

The Zba instructions can be used to accelerate the generation of addresses that index into arrays of basic types (halfword, word, doubleword) using both unsigned word-sized and XLEN-sized indices: a shifted index is added to a base address.

The shift and add instructions do a left shift of 1, 2, or 3 because these are commonly found in real-world code and because they can be implemented with a minimal amount of additional hardware beyond that of the simple adder. This avoids lengthening the critical path in implementations.

While the shift and add instructions are limited to a maximum left shift of 3, the slli instruction (from the base ISA) can be used to perform similar shifts for indexing into arrays of wider elements. The slli.uw -- added in this extension -- can be used when the index is to be interpreted as an unsigned word.

Extension description from riscv-unified-db, reformatted.

Specification chapter: The RISC-V Instruction Set Manual, src/unpriv/zba.adoc.

Instructions (9)

MnemonicName (riscv-unified-db)XLEN
add.uwAdd unsigned wordRV64 only
sh1addShift left by 1 and addRV32 and RV64
sh1add.uwShift unsigned word left by 1 and addRV64 only
sh2addShift left by 2 and addRV32 and RV64
sh2add.uwShift unsigned word left by 2 and addRV64 only
sh3addShift left by 3 and addRV32 and RV64
sh3add.uwShift unsigned word left by 3 and addRV64 only
slli.uwShift left unsigned word (Immediate)RV64 only
zext.w (pseudo-op)RV64 only