code wiki / (root) / nx_crc32_kat.nx

nx_crc32_kat.nx

buildroot/runtime/nx_crc32_kat.nx

4620 B105 linesdepth 0pulls 0 transitivereach 0 importersview sourcekind tooltopic crc32
docsdependenciesstructsconstsfunctions

about

nx_crc32_kat.nx -- functional KAT for the hardware CRC-32C intrinsic __crc32_u64 (x86 SSE4.2 crc32q). Two independent checks: (A) STANDARD CHECK VALUE: a software CRC-32C oracle (reflected poly 0x82F63B78, init 0xFFFFFFFF, final XOR 0xFFFFFFFF) over the ASCII string "123456789" must equal 0xE3069283 -- the world-standard CRC-32C/iSCSI (Castagnoli) validation constant. This proves the oracle's math is the real CRC-32C. (B) HARDWARE == ORACLE: the hardware __crc32_u64(crc, data) must match a bit-identical software model of x86 crc32q (the same reflected step, 64 bits LSB-first, NO init/final -- those are the software convention) over a spread of (crc, data) inputs. Since (A) proves the oracle IS CRC-32C and (B) proves hardware == oracle, the hardware instruction is transitively validated against the standard. exit 0 = all cases correct. license_tier: ORIGINAL

dependencies 0 imports · 0 importers

imports: none

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sw_crc32b sw_crc32q

structs

none

consts

20const CRC32C_REFL_POLY: i64 = 0x82F63B78 // reflected CRC-32C polynomial

functions

25func sw_crc32q(crc_in: i64, data: i64) -> i64
called by 1: main
40func sw_crc32b(crc_in: i64, byte: i64) -> i64
called by 1: main
53func main() -> i64