UNZIP

RISC-V UNZIP Instruction Details

Instruction ManualI-type

RV32 bit deinterleave (Zbkb), RV32-only.

Instruction Syntax

unzip rd, rs1
Operand Breakdown
Destination rd: general-purpose register receiving the result.
Source rs1: register holding the first operand.
Immediate imm: 12-bit signed value, sign-extended before operation with rs1.
ZbkbBit Manipulation

Instruction Behavior

UNZIP (Zbkb, RV32-only) gathers even-numbered bits of rs1 into the low 16 bits of rd and odd-numbered bits into the high 16 bits: for i=0..15, rd[i]=rs1[2*i] and rd[i+16]=rs1[2*i+1]. It is the inverse of ZIP.

UNZIP Decode & Execute Animation

Shows only specification-defined encodings, conditions, and architectural state.

unzip a0, a1
Execution Context
Instruction Encoding
31..20
imm[11:0]
000010001111
19..15
rs1
a1
14..12
funct3
101
11..7
rd
a0
6..0
opcode
0010011 OP-IMM
Decode fixed fields
x[a1]=0xD2C4B8A1
rd[i] = rs1[2*i], rd[i+16] = rs1[2*i+1], i=0..15
Architectural state has not been committed.

Quick Understanding & Search Notes

UNZIP is a Zbkb cryptographic bit-manipulation instruction; this page follows the official B-extension operation.

The official encoding and semantics are RV32-only.
It rearranges even source bits into the low half and odd source bits into the high half without accessing memory.

Common Usage Scenarios

Crypto & Security

Understand this scenario with real code like «unzip a0, a1».

Logical Operations

Understand this scenario with real code like «unzip a0, a1».

Pre-Use Checklist

Syntax Check
  • Verify the immediate field is within the valid range.
  • Confirm source register rs1 points to the correct operand.
Semantic Check
  • Check if the immediate sign-extension matches expectations.
  • Ensure the result register rd has a clear purpose.

Pitfalls / Common Confusions

UNZIP is defined only on RV32; there is no RV64 form.
It deinterleaves bits, not bytes or halfwords.
This instruction is RV32-only; there is no RV64 form.

FAQ

Does UNZIP access memory?

No. It only rearranges bit fields in integer registers.

Which extension contains UNZIP?

It belongs to the Zbkb cryptographic bit-manipulation extension.