omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / gpu / nvidia / checks / arest-cache.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note gpu/nvidia/checks/arest-cache.om: arcache (gpu/nvidia/om/apirest/cache.om); Q is its 8 q words, the key word (its 4 low bytes, little-endian, are the key) and 17 records of 8 bytes, each word the record's bytes little-endian (the test's struct: valid, pinned, 2 pad, a 4-byte key). Composed before arest.om. |
| 3 | text t_name "AREST-CACHE" |
| 4 | text t_au "cache" |
| 5 | note the 17 records from word s of q, 8 bytes each, little-endian |
| 6 | fn arrec q view ulong 64 s ulong x edit uchar 136 to void |
| 7 | for i ulong 17 |
| 8 | w = get q add s i |
| 9 | c = mul i 8 |
| 10 | for b ulong 8 |
| 11 | put x add c b uchar and shr w mul b 8 255 |
| 12 | end |
| 13 | end |
| 14 | end |
| 15 | fn arop q view ulong 64 nq ulong ny ulong o edit ulong 128 to ulong |
| 16 | if or ne nq 26 ne ny 0 |
| 17 | ckbad |
| 18 | end |
| 19 | a = new ulong 8 0 |
| 20 | for i ulong 8 |
| 21 | put a i get q i |
| 22 | end |
| 23 | key = new uchar 4 0 |
| 24 | for b ulong 4 |
| 25 | put key b uchar and shr get q 8 mul b 8 255 |
| 26 | end |
| 27 | x = new uchar 136 0 |
| 28 | arrec q 9 x |
| 29 | ret arcache a x key |
| 30 | end |