Webcentive RISC-V Reference

zext.h

Zero-extend halfword

Extension
Zbb
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
zext.h xd, xs1
Length
32-bit

Encoding

RV32 form; listed in riscv-opcodes as a pseudo-op of pack

312524201915141211760
000010000000rs1100rd0110011

Match 0x08004033, mask 0xfff0707f. Source: $pseudo_op rv_zbkb::pack zext.h.rv32 rd rs1 31..25=0x04 24..20=0 14..12=0x4 6..0=0x33 in riscv-opcodes/extensions/rv32_zbb.

FieldBitsriscv-opcodes name
rs119:15rs1
rd11:7rd

RV64 form; listed in riscv-opcodes as a pseudo-op of packw

31252420191514121176210
000010000000rs1100rd0111011

Match 0x0800403b, mask 0xfff0707f. Source: $pseudo_op rv64_zbkb::packw zext.h rd rs1 31..25=0x04 24..20=0 14..12=0x4 6..2=0xE 1..0=0x3 in riscv-opcodes/extensions/rv64_zbb.

FieldBitsriscv-opcodes name
rs119:15rs1
rd11:7rd

Description

Zero-extends the least-significant halfword of the source to XLEN by inserting 0's into all of the bits more significant than 15.

Note: The zext.h instruction is a pseudo-op for pack when Zbkb is implemented and XLEN == 32.

Note: The zext.h instruction is a pseudo-op for packw when Zbkb is implemented and XLEN == 64.

Description from riscv-unified-db, reformatted.

Operation

X[xd] = X[xs1][15:0];

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages