unzip

Bit deinterleave

This instruction is defined by:

  • Zbkb, version >= 0

This instruction is included in the following profiles:

Encoding

svg

Assembly format

unzip rd, rs1

Synopsis

This instruction 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.

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<5> rs1 = $encoding[19:15];
Bits<5> rd = $encoding[11:7];

Execution

  • IDL

  • Sail

XReg input = X[rs1];
XReg output = 0;
for (U32 i = 0; i < (xlen() / 2 - 1); i = i + 1) {
  output[i] = input[2 * i];
  output[i + xlen() / 2] = input[2 * i + 1];
}
X[rd] = output;
foreach (i from 0 to xlen/2-1) {
  X(rd)[i] = X(rs1)[2*i];
  X(rd)[i+xlen/2] = X(rs1)[2*i+1];
}