brev8

Reverse bits in bytes

Reverses the order of the bits in every byte of a register.

This instruction must have data-independent timing when extension Zkt is enabled.

Assembly format

brev8 xd, xs1

Decode Variables

Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];

Execution

XReg input = X[xs1];
XReg output = 0;
for (U32 i = 0; i < xlen(); i = i + 8) {
  for (U32 j = 0; j < 8; j = j + 1) {
    output[i + (7 - j)] = input[i + j];
  }
}
X[xd] = output;

Encoding

svg

Defining extension

Access

M

Always

Containing profiles

  • Mandatory: None

  • Optional: None