pub fn plan_chip(
mode: Mode,
budget: &Budget,
cx: &Context,
slots: &[Slot],
) -> ChipPlanExpand description
Plan every slot of mode and the delivered rates.
- Every module is planned in its guaranteed share (
shares): its power % of each resource. - Lending. A module rarely uses its share evenly (DSig signing uses almost no DSPs; an Ed25519 verifier may run out of URAM long before its LUTs). What the modules leave unused is counted in real units (LUTs, DSPs, BRAM36, URAM, not percentages), and each module is re-planned in its own build’s resources plus what is free. The re-plan that raises the delivered rates the most is kept, and the round repeats until no module gains. First each side lends only within itself (its modules share what the side’s guarantee leaves); then whatever is still free, which that side could not use, goes to either side. So a side never loses resources it could have used, and nothing sits idle that the other side could turn into rate.
Floors. A module whose side delivers nothing because its share is
smaller than its smallest build gets that build first
(floor_starved), when that raises the weaker side.
Auto-sized lines. A line whose size_for
answers (the SHA-512 line on “auto”) gets the allowance of its smallest
build that supplies what the chip wants (Delivered::sha_wanted), and
the chip is planned again with the engines in what that leaves. A smaller
line gives the engines LUTs, which raises what they want, so this repeats
(at most four times) until the size settles; of the plans tried, the one
the line does not limit, delivering the most, wins.