Source/Packages

Accelerator.SM86.FieldEncoding

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

861 lines86 declarations33.8 KiBSHA-256 1449867e9447

def · lines 443–470

sm86PlaceWord32FieldWithValidWord

Full file
The fixed32 constructor makes width/value overflow unrepresentable. Keep the old word-length-before-extent error order and one-field telemetry. Select thunks so malformed output never invokes the unchecked placement.
443def sm86PlaceWord32FieldWithValidWord =
444  (lambda unrestricted position : Nat .
445    (lambda unrestricted value : (family SM86Unsigned32) .
446      (lambda unrestricted encoded : Bytes .
447        (app
448          (lambda unrestricted extent : Nat .
449            (app
450              (nat-eliminate
451                (lambda unrestricted current : Nat .
452                  (pi unrestricted ignored : Nat . (family SM86FieldEncodingResult)))
453                (lambda unrestricted ignored : Nat .
454                  (sm86FieldFailure
455                    (constructor SM86EncodingErrorCode SM86EncodingFieldExtentInvalid)
456                    position
457                    sm86EncodingNaturalThirtyTwo
458                    extent
459                    (bytes-length encoded)))
460                (lambda unrestricted predecessor : Nat .
461                  (lambda unrestricted induction : (pi unrestricted ignored : Nat . (family SM86FieldEncodingResult)) .
462                    (lambda unrestricted ignored : Nat .
463                      (constructor
464                        SM86FieldEncodingResult
465                        SM86FieldEncodingSucceeded
466                        (sm86PlaceWord32BitsUnchecked position value encoded)
467                        (sm86FieldTelemetryOne sm86EncodingNaturalThirtyTwo extent)))))
468                (naturalLessOrEqual extent sm86EncodingNaturalOneHundredTwentyEight))
469              zero))
470          (naturalAdd position sm86EncodingNaturalThirtyTwo)))))

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.