Webcentive RISC-V Reference

unzip

Bit deinterleave

Extension
Zbkb, Zk, Zkn, Zks
XLEN
RV32 only
Assembly (riscv-unified-db)
unzip xd, xs1
Length
32-bit

Encoding

31252420191514121176210
000010001111rs1101rd0010011

Match 0x08f05013, mask 0xfff0707f. Source: unzip rd rs1 31..25=4 24..20=15 14..12=5 6..2=4 1..0=3 in riscv-opcodes/extensions/rv32_zbkb.

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

Description

Gathers bits from the high and low halves of the source word into odd/even bit positions in the destination word. It is the inverse of the zip instruction. This instruction is available only on RV32.

Description from riscv-unified-db, reformatted.

Operation

XReg input = X[xs1];
XReg output = 0;

for(U32 i=0; i < (xlen()/2); i = i+1) {
  output[i] = input[2*i];
  output[i+xlen()/2] = input[2*i+1];
}

X[xd] = output;

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

Specification and related pages