prtyw

Parity Word

prtyw RA, RS

Calculates parity of a word (Scalar).

Details

Computes the parity of the entire 32-bit word in register RS by XORing all 32 bits and stores the result (a single bit) in the low bit of register RA. All other bits of RA are cleared to zero. No condition registers or status fields are affected.

Pseudocode Operation

parity_bit ← 0
for i in 0 to 31 do
  parity_bit ← parity_bit XOR RS[i]
end
RA ← (0 || parity_bit)

Programming Note

The prtyw instruction is useful for calculating the parity of each byte in a doubleword, which can be helpful in error detection. Ensure that the input register (RS) contains valid data; otherwise, the output may not reflect meaningful parity information. This instruction operates at user privilege level and does not generate exceptions under normal conditions.

Example

prtyw r4, r3

Encoding

Binary Layout
31
0
RS
6
RA
11
/
16
154
21
/
31
 
Format X-form
Opcode 0x7C000134
Extension Base

Operands

  • RA
    Target
  • RS
    Source