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
| 3125 | 2420 | 1915 | 1412 | 117 | 60 | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0000100 | 00000 | rs1 | 100 | rd | 0110011 | ||||||||||||||||||||||||||
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.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
RV64 form; listed in riscv-opcodes as a pseudo-op of packw
| 3125 | 2420 | 1915 | 1412 | 117 | 62 | 10 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0000100 | 00000 | rs1 | 100 | rd | 01110 | 11 | |||||||||||||||||||||||||
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.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
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.