Source/Packages

Accelerator.SM86.ControlEncoding

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

137 lines17 declarations4.8 KiBSHA-256 7d6f36d62166

def · lines 85–118

encodeValidatedSM86ControlLE

Full file
85def encodeValidatedSM86ControlLE =
86  (lambda unrestricted control : SM86Control .
87    eliminate
88      SM86Control
89      (lambda unrestricted value : SM86Control . Bytes)
90      control
91      (branch SM86ControlValue stall yieldMode writeBarrier readBarrier waitMask reuseMask .
92        app
93          (lambda unrestricted stallNatural : Nat .
94            unrestricted yieldNatural : Nat .
95            unrestricted writeNatural : Nat .
96            unrestricted readNatural : Nat .
97            unrestricted waitNatural : Nat .
98            unrestricted reuseNatural : Nat .
99            app
100              (lambda unrestricted waitHigh : Nat . unrestricted waitLow : Nat .
101                bytes
102                  (then nat-to-byte
103                    (nest sm86NaturalAdd stallNatural (sm86NaturalTimesSixteen yieldNatural))
104                    (sm86NaturalTimesThirtyTwo writeNatural))
105                  (nat-to-byte (sm86NaturalAdd readNatural (sm86NaturalTimesEight waitLow)))
106                  (nat-to-byte (sm86NaturalAdd waitHigh (sm86NaturalDouble reuseNatural)))
107                  0)
108              (nat-less-than 31 waitNatural)
109              (sm86NaturalSelect
110                (nat-less-than 31 waitNatural)
111                (sm86NaturalSubtract waitNatural 32)
112                waitNatural))
113          (byte-to-nat stall)
114          (sm86YieldBit yieldMode)
115          (sm86BarrierCode writeBarrier)
116          (sm86BarrierCode readBarrier)
117          (byte-to-nat waitMask)
118          (byte-to-nat reuseMask)))

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.