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 / om / admission / chip_enum.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note enum: 0 table row identity, 1 raw sysfs vendor, 2 display class, 3 PCI field mask. |
| 3 | fn ce_eq a ulong b ulong to ulong |
| 4 | if eq a b |
| 5 | ret 1 |
| 6 | end |
| 7 | ret 0 |
| 8 | end |
| 9 | fn chip_enum mode ulong a ulong b ulong c ulong d ulong to ulong |
| 10 | if eq mode 0 |
| 11 | ret and ce_eq a c ce_eq b d |
| 12 | end |
| 13 | if eq mode 1 |
| 14 | ret ce_eq a 4318 |
| 15 | end |
| 16 | if eq mode 2 |
| 17 | ret ce_eq shr a 16 3 |
| 18 | end |
| 19 | if eq mode 4 |
| 20 | if eq c 0 |
| 21 | ret 0 |
| 22 | end |
| 23 | sa = shr a 63 |
| 24 | sb = shr b 63 |
| 25 | if ne sa sb |
| 26 | ret sa |
| 27 | end |
| 28 | if lt a b |
| 29 | ret 1 |
| 30 | end |
| 31 | ret 0 |
| 32 | end |
| 33 | if eq mode 5 |
| 34 | ret ce_eq a 46 |
| 35 | end |
| 36 | ret and a b |
| 37 | end |