prtyw

Parity Word

prtyw RA, RS

Calculates parity of a word (Scalar).

Encoding

Binary Layout
31
0:5
RS
6:10
RA
11:15
/
16:20
154
21:30
/
31
 
Format X-form
Opcode 0x7C000134
Extension Base

Operands

  • RA
    Target
  • RS
    Source

Example

prtyw r4, r3

Related

More in Base

Reference

Description

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.

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.