Repeated fixed-base conversion #
Repeatedly divide a fixed-width binary input by a positive base. The circuit keeps the current fixed-width quotient and appends every remainder in least-significant-first order, with each remainder represented one-hot. This is the runtime base conversion needed by canonical prefix packing.
Gate-count recurrence for repeated fixed-base division.
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.MassProduction.BaseConversion.gateCount inputWidth basePositive 0 = 0
Instances For
Read the current quotient prefix as the input to one more division.
Equations
- Algebraic.MassProduction.BaseConversion.quotientInputIndex inputWidth retainedBits = Fin.castAdd retainedBits
Instances For
Retain an already emitted remainder bit after the quotient prefix.
Equations
- Algebraic.MassProduction.BaseConversion.retainedInputIndex inputWidth retainedBits = Fin.natAdd inputWidth
Instances For
Reorder the intermediate (new quotient, new remainder, old remainders)
layout into (new quotient, old remainders, new remainder).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Output index of an already retained remainder bit.
Equations
- Algebraic.MassProduction.BaseConversion.retainedOutputIndex inputWidth base digits bit = ⟨inputWidth + ↑bit, ⋯⟩
Instances For
Output index of a newly appended remainder bit.
Equations
Instances For
One repeated-conversion step. The existing remainder log is retained at zero cost.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Repeated fixed-base conversion circuit.
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.MassProduction.BaseConversion.circuit inputWidth basePositive 0 = Cslib.Circuits.Circuit.castCounts ⋯ ⋯ (Cslib.Circuits.Circuit.id Algebraic.DeMorgan.signature inputWidth)
Instances For
Natural quotient represented by the current quotient block.
Equations
- Algebraic.MassProduction.BaseConversion.quotientValue input base digits = ↑(Algebraic.MassProduction.FixedDivision.bitVectorIndex input) / base ^ digits
Instances For
The digitth least-significant base digit, as a bounded index.
Equations
- Algebraic.MassProduction.BaseConversion.digitValue basePositive input digit = ⟨↑(Algebraic.MassProduction.FixedDivision.bitVectorIndex input) / base ^ digit % base, ⋯⟩
Instances For
The current quotient block has value input / base^digits.
Every emitted remainder block is one-hot at the corresponding base digit.
Repeated conversion charges exactly one divider per emitted digit.