ORC.B

RISC-V ORC.B Instruction Details

Instruction ManualI-type

Bitwise OR-combine, byte granule

Instruction Syntax

orc.b rd, rs
Operand Breakdown
Destination rd: general-purpose register receiving the result.
Source rs1: register holding the first operand.
Immediate imm: 12-bit signed value, sign-extended before operation with rs1.
BZbbBit ManipulationInteger Operation

Instruction Behavior

ORC.B independently OR-combines each byte of rs: an all-zero byte produces an all-zero result byte, while a byte with any set bit produces an all-ones result byte. It is part of Zbb.

ORC.B Decode And Execute Animation

Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.

rd
rs
orc.b
,
Execution Context
t1(x6)
0x00000014
31..20
19..15
14..12
11..7
6..0
001010000111
imm[11:0]
00110
rs1
101
funct3
00101
rd
0010011
opcode
Execution Data Path
instruction
0x28735293
opcode
0010011 -> OP-IMM
funct3
101 -> ORC.B
rd / rs
t0(x5) / t1(x6)=0x00000014
fixed imm[11:0]
001010000111 -> ORC.B selector (not an arithmetic immediate)
byte-granule OR-combine
byte 0: 0x14 -> 0xFF; byte 1: 0x00 -> 0x00; byte 2: 0x00 -> 0x00; byte 3: 0x00 -> 0x00 -> 0x000000FF
x5
t0(x5) = 0x000000FF
Current Step

Concept Step: receive the 32-bit instruction encoding

The machine code is split by the current instruction format; the animation starts from encoding/decode.

encoding: 0x28735293
syntax : orc.b t0(x5), t1(x6)
result : t0(x5) = 0x000000FF
Architectural Result
t0(x5) = 0x000000FF

This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.

Quick Understanding & Search Notes

ORC.B examines rs byte by byte: a zero byte remains 0x00, while a byte containing any set bit becomes 0xFF; the final XLEN-wide result is written to rd.

Each byte independently becomes all zeros or all ones; the specification gives string processing that tests for a terminating zero byte as a use case.
ORC.B does not combine bits across bytes; each result byte records only whether its corresponding source byte has any set bit.

Common Usage Scenarios

Zero-Byte Detection

Understand this scenario with real code like «orc.b x10, x11 ; each nonzero byte in x11 becomes 0xFF in x10; each zero byte becomes 0x00».

Pre-Use Checklist

Syntax Check
  • Verify the immediate field is within the valid range.
  • Confirm source register rs1 points to the correct operand.
Semantic Check
  • Check if the immediate sign-extension matches expectations.
  • Ensure the result register rd has a clear purpose.

Pitfalls / Common Confusions

Each byte is processed independently

FAQ

Does ORC.B access memory?

No. It only reads and writes integer registers; any memory access must be performed by a separate load or store instruction.

What is the result width of ORC.B?

ORC.B processes the complete XLEN-wide register value by bytes and writes an equally wide result to rd.