Skip to main content

subtree_kernel

Function subtree_kernel 

Source
pub fn subtree_kernel(
    clock_reset: ClockReset,
    input: SubtreeInput,
    q: SubtreeBuilderQ,
) -> (SubtreeOutput, SubtreeBuilderD)
Expand description

The builder’s wiring.

Each cycle it does three things:

  1. Write at most one node: a new leaf from key_done, else a parent result from the factory. Maybe queue the next parent, or emit the root.
  2. Fetch/offer the head job: phase 0 → read left child, 1 → read right child, 2 → hold both, 3 → offer to the factory until merkle_taken.
  3. Update the queue: pop the offered job when taken, push a new one.

A leaf and a parent result never arrive in the same cycle: both are results of the factory’s single BLAKE3 lane, which returns at most one result per cycle. The if/else if below still gives the leaf priority.