crc32b

CRC32 Byte (A32)

CRC32B<c> <Rd>, <Rn>, <Rm>

CRC32 checksum update (Byte).

Details

CRC32 Checksum Update (Byte): accumulates a 32-bit CRC checksum by processing a single byte from the input. Rd is updated with CRC32(Rn, Rm[7:0]) using the standard CRC32 polynomial. No condition flags are affected. Subject to condition code in A32; available in A32 only with CRC extension.

Pseudocode Operation

Rd ← CRC32_POLYNOMIAL(Rn, Rm[7:0])

Example

CRC32B r0, r1, r2

Encoding

Binary Layout
cond
00010
00
0
Rn
Rd
0
0
0
0
0100
Rm
 
Format Data Proc
Opcode 0x01000040
Extension CRC

Operands

  • Rd
    Destination general-purpose register
  • Rn
    Acc
  • Rm
    Data

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x01000040 CRC32B{<q>} <Rd>, <Rn>, <Rm> A32 cond | 00010 | 00 | 0 | Rn | Rd | 0 | 0 | 0 | 0 | 0100 | Rm
0xFAC0F080 CRC32B{<q>} <Rd>, <Rn>, <Rm> T32 111110101 | 10 | 0 | Rn | 1111 | Rd | 10 | 00 | Rm

Description

CRC32 performs a cyclic redundancy check (CRC) calculation on a value held in a general-purpose register. It takes an input CRC value in the first source operand, performs a CRC on the input value in the second source operand, and returns the output CRC value. The second source operand can be 8, 16, or 32 bits. To align with common usage, the bit order of the values is reversed as part of the operation, and the polynomial 0x04C11DB7 is used for the CRC calculation. In an Armv8.0 implementation, this is an optional instruction. From Armv8.1, it is mandatory for all implementations to implement this instruction.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();

    acc = R[n];             // accumulator
    val = R[m]<size-1:0>;   // input value
    poly = (if crc32c then 0x1EDC6F41 else 0x04C11DB7)<31:0>;
    tempacc = BitReverse(acc):Zeros(size);
    tempval = BitReverse(val):Zeros(32);
    // Poly32Mod2 on a bitstring does a polynomial Modulus over {0,1} operation
    R[d] = BitReverse(Poly32Mod2(tempacc EOR tempval, poly));