brev8
Reverse bits in bytes
Encoding
| 3120 | 1915 | 1412 | 117 | 62 | 10 | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 011010000111 | rs1 | 101 | rd | 00100 | 11 | ||||||||||||||||||||||||||
Match 0x68705013, mask 0xfff0707f. Source: brev8 rd rs1 31..20=0x687 14..12=5 6..2=0x4 1..0=0x3 in riscv-opcodes/extensions/rv_zbkb.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
Description
Reverses the order of the bits in every byte of a register.
Description from riscv-unified-db, reformatted.
Operation
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;Pseudocode in riscv-unified-db’s IDL, quoted unchanged.
Specification and related pages
- The RISC-V Instruction Set Manual: src/unpriv/zbkb.adoc (Zbkb)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zk)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zkn)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zks)
- riscv-unified-db: spec/std/isa/inst/Zbkb/brev8.yaml
- Zbkb instruction listing
- Zk instruction listing
- Zkn instruction listing
- Zks instruction listing