Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/gpu/nvidia/tools/sm121dis/test.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / nvidia / tools / sm121dis / test.om` 98 lines ยท 2275 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note gpu/nvidia/tools/sm121dis/test.om: pure-Omega positive and negative tests for sm121_dis + dis_words. 3 note Compose after gpu/nvidia/om/disasm/words.om and gpu/nvidia/om/disasm/sm121_dis.om. 4 5 text st_pass "PASS sm121dis pure-Omega positive and negative controls\n" 6 text st_fail "FAIL sm121dis\n" 7 text st_exit "EXIT" 8 text st_nop "NOP" 9 10 fn st_starts txt view uchar 256 tlen ulong want view uchar 4 wlen ulong to bool 11 if lt tlen wlen 12 ret false 13 end 14 for i ulong wlen bound 4 15 if ne get txt i get want i 16 ret false 17 end 18 end 19 ret true 20 end 21 22 fn main to int 23 w8 = new uchar 8 0 24 txt = new uchar 256 0 25 exp = new uchar 4 0 26 27 note 1. dis_words little-endian assembly + EXIT (0x94d = 2381) padding detection 28 put w8 0 uchar 77 29 put w8 1 uchar 9 30 put w8 2 uchar 0 31 put w8 3 uchar 0 32 put w8 4 uchar 0 33 put w8 5 uchar 0 34 put w8 6 uchar 0 35 put w8 7 uchar 0 36 lo_exit = dis_words view w8 0 0 0 37 if ne lo_exit 2381 38 r = write 2 st_fail 0 len st_fail 39 ret 1 40 end 41 pad = dis_words view w8 1 32 0 42 if ne pad 48 43 r = write 2 st_fail 0 len st_fail 44 ret 2 45 end 46 47 note 2. Decode unguarded EXIT: opcode 0x94d, guard=7 (0x794d = 31053), hi fixed bits 0x0000000003800000 = `58720256` 48 res_exit = sm121_dis 31053 `58720256` 0 edit txt 49 if ne and res_exit 65536 0 50 r = write 2 st_fail 0 len st_fail 51 ret 3 52 end 53 if eq and res_exit 131072 0 54 r = write 2 st_fail 0 len st_fail 55 ret 4 56 end 57 put exp 0 69 58 put exp 1 88 59 put exp 2 73 60 put exp 3 84 61 if not st_starts view txt and res_exit 65535 view exp 4 62 r = write 2 st_fail 0 len st_fail 63 ret 5 64 end 65 66 note 3. Decode guarded @P0 EXIT: lo = 0x094d (2381), hi = 0x0000000003800000 (`58720256`) 67 res_p0 = sm121_dis 2381 `58720256` 16 edit txt 68 if ne and res_p0 65536 0 69 r = write 2 st_fail 0 len st_fail 70 ret 6 71 end 72 put exp 0 64 73 put exp 1 80 74 put exp 2 48 75 put exp 3 32 76 if not st_starts view txt and res_p0 65535 view exp 4 77 r = write 2 st_fail 0 len st_fail 78 ret 7 79 end 80 81 note 4. Negative control: unknown opcode 0xfff must set unknown bit 16 and emit "?? " 82 res_unk = sm121_dis 4095 0 32 edit txt 83 if eq and res_unk 65536 0 84 r = write 2 st_fail 0 len st_fail 85 ret 8 86 end 87 put exp 0 63 88 put exp 1 63 89 put exp 2 32 90 put exp 3 0 91 if not st_starts view txt and res_unk 65535 view exp 3 92 r = write 2 st_fail 0 len st_fail 93 ret 9 94 end 95 96 r = write 1 st_pass 0 len st_pass 97 ret 0 98 end