brev8
Reverse bits in bytes
This instruction is defined by:
-
Zbkb, version >= 0
This instruction is included in the following profiles:
Execution
-
IDL
-
Sail
XReg input = X[rs1];
XReg output = 0;
for (U32 i = 0; i < (xlen() - 8); i = i + 8) {
for (U32 j = 0; j < 8; j = j + 1) {
output[(i * 8) + (7 - j)] = input[(i * 8) + j];
}
}
X[rd] = output;
result : xlenbits = EXTZ(0b0);
foreach (i from 0 to sizeof(xlen) by 8) {
result[i+7..i] = reverse_bits_in_byte(X(rs1)[i+7..i]);
};
X(rd) = result;