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 / driver / tests / irq_trace.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Host-only fixture. A new process is a new model lifetime; never resets a live handler. |
| 3 | global itinp uchar 16 |
| 4 | global itout uchar 128 |
| 5 | fn itput off ulong v ulong to void |
| 6 | for i ulong 8 |
| 7 | put itout add off i uchar and shr v mul i 8 255 |
| 8 | end |
| 9 | end |
| 10 | fn itstatus off ulong r long to void |
| 11 | itput off ulong add r 32 |
| 12 | end |
| 13 | fn main to int |
| 14 | n = read 0 itinp 0 16 |
| 15 | if ne n 16 |
| 16 | ret 2 |
| 17 | end |
| 18 | put israw 0 uint get itinp 0 |
| 19 | put ismask 0 uint get itinp 1 |
| 20 | put isdest 0 uint get itinp 2 |
| 21 | put iscnt 0 ulong get itinp 3 |
| 22 | put isedge 0 ulong get itinp 5 |
| 23 | put isfail 0 ulong get itinp 6 |
| 24 | put islock 0 ulong get itinp 7 |
| 25 | put istail 0 ulong get itinp 8 |
| 26 | put ispm 0 ulong get itinp 9 |
| 27 | put iqmode 0 ulong get itinp 10 |
| 28 | r = iqinit 7 |
| 29 | if ne r 0 |
| 30 | ret 3 |
| 31 | end |
| 32 | gen = ulong 7 |
| 33 | if ne get itinp 11 0 |
| 34 | gen = 8 |
| 35 | end |
| 36 | r = iqservice gen ulong get itinp 4 |
| 37 | itstatus 0 r |
| 38 | itput 8 get iqstate 0 |
| 39 | itput 16 ulong get iqpend 0 |
| 40 | itput 24 get iqdone 0 |
| 41 | itput 32 get isdone 0 |
| 42 | itput 40 ulong get israw 0 |
| 43 | itput 48 get isacks 0 |
| 44 | itput 56 get isreads 0 |
| 45 | itput 64 get ismasks 0 |
| 46 | if ne get itinp 12 0 |
| 47 | r = iqservice 7 ulong get itinp 4 |
| 48 | else |
| 49 | r = iqinit 8 |
| 50 | end |
| 51 | itstatus 72 r |
| 52 | itput 80 ulong get iqpend 0 |
| 53 | itput 88 get isdone 0 |
| 54 | itput 96 get isacks 0 |
| 55 | itput 104 get isreads 0 |
| 56 | itput 112 get ismasks 0 |
| 57 | itput 120 get isviol 0 |
| 58 | n = write 1 itout 0 128 |
| 59 | if ne n 128 |
| 60 | ret 4 |
| 61 | end |
| 62 | ret 0 |
| 63 | end |