Source/Packages

Accelerator.SM86.FieldEncoding

packages/hardware/architectures/nvidia-sm86/src/Accelerator/SM86/FieldEncoding.alpha

794 lines86 declarations28.4 KiBSHA-256 400363ed48c6

def · lines 273–312

sm86PlaceFieldBitsUnchecked

Full file
Place a field's bits, threading the POSITION and the remaining VALUE instead of recomputing a power per bit. The motive is a `pi` over both, because the recursion changes both: each turn writes the low bit of the value at the current position, then hands the induction the next position and the value halved. The bits are written in ascending order into disjoint positions, so the order is not observable -- what changed is that no numeral larger than a byte is ever built.
273def sm86PlaceFieldBitsUnchecked =
274  (lambda unrestricted position : Nat .
275    unrestricted width : Nat .
276    unrestricted value : Nat .
277    unrestricted encoded : Bytes .
278    app
279      (app
280        (app
281          (nat-eliminate
282            (lambda unrestricted current : Nat .
283              pi unrestricted currentPosition : Nat .
284                unrestricted currentValue : Nat .
285                unrestricted currentBytes : Bytes .
286                Bytes)
287            (lambda unrestricted currentPosition : Nat .
288              unrestricted currentValue : Nat .
289              unrestricted currentBytes : Bytes .
290              currentBytes)
291            (lambda unrestricted predecessor : Nat .
292              unrestricted induction : (pi unrestricted currentPosition : Nat . unrestricted currentValue : Nat . unrestricted currentBytes : Bytes . Bytes) .
293              unrestricted currentPosition : Nat .
294              unrestricted currentValue : Nat .
295              unrestricted currentBytes : Bytes .
296              eliminate
297                NaturalDivisionState
298                (lambda unrestricted current : NaturalDivisionState . Bytes)
299                (naturalDivisionState currentValue sm86EncodingNaturalTwo)
300                (branch
301                  NaturalDivisionStateValue
302                  remainder
303                  quotient
304                  .
305                  induction
306                    (succ currentPosition)
307                    quotient
308                    (sm86PlaceBitAt currentPosition remainder currentBytes)))
309            width)
310          position)
311        value)
312      encoded)

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.