Skip to main content

pin_known_kernel

Function pin_known_kernel 

Source
pub fn pin_known_kernel(
    state: [b8; 64],
    mask: [bool; 64],
    value: [b8; 64],
) -> [b8; 64]
Expand description

Replace the bytes mask marks as compile-time constants by value.

Call it with a row of KNOWN_MASK/KNOWN_VALUE: the selects are then constants, the register feeding a pinned byte has no loads, and synthesis deletes it together with the logic that computed it.

Why this is needed at all: to the tools, a register’s output is not a constant. Its power-up value is “don’t care”, so they cannot assume it always equals the constant computed into it. Pinning states the value directly, so the S-boxes behind it fold to constants. Combinational: 64 selects whose controls are all constants.