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 / q38_run_shim.om
| 1 | note tests/q38_run_shim.om: Zero-syscall host memory + DC CIVAC simulator shim for q38_run_test.om. |
| 2 | note Maps 8 MiB of simulated LPDDR5x at 0x00_8000_0000 (2147483648) for host testing on macOS/Linux. |
| 3 | note Never touches real hardware. |
| 4 | |
| 5 | const MMPALIM ulong 1099511627776 |
| 6 | const SHBASE ulong 2147483648 |
| 7 | const SHBYTES ulong 8388608 |
| 8 | |
| 9 | global shmem uint 2097152 |
| 10 | global shflsh ulong 1 |
| 11 | global shflpa ulong 1 |
| 12 | global shflsz ulong 1 |
| 13 | global shdb uint 1 |
| 14 | |
| 15 | note Stubbed RPC/param symbols required by compute.om Sections 1-3 (unused by q38_run_test.om) |
| 16 | global rqpay uchar 65536 |
| 17 | global rqlen ulong 1 |
| 18 | global bplen ulong 1 |
| 19 | |
| 20 | fn rqclear n ulong to void |
| 21 | put rqlen 0 n |
| 22 | end |
| 23 | |
| 24 | fn rqput32 b ulong off ulong v ulong to void |
| 25 | if eq b 999 |
| 26 | put rqlen 0 add off v |
| 27 | end |
| 28 | end |
| 29 | |
| 30 | fn rqget32 b ulong off ulong to ulong |
| 31 | if eq b 999 |
| 32 | ret off |
| 33 | end |
| 34 | ret 0 |
| 35 | end |
| 36 | |
| 37 | fn pachan to long |
| 38 | ret 0 |
| 39 | end |
| 40 | |
| 41 | fn paempty to long |
| 42 | ret 0 |
| 43 | end |
| 44 | |
| 45 | fn pasched a ulong b ulong c ulong to long |
| 46 | ret long add a add b c |
| 47 | end |
| 48 | |
| 49 | fn pawstreq to long |
| 50 | ret 0 |
| 51 | end |
| 52 | |
| 53 | fn pawstdec n ulong to long |
| 54 | ret long n |
| 55 | end |
| 56 | |
| 57 | fn pacgpcls g bool to ulong |
| 58 | if g |
| 59 | ret 51823 |
| 60 | end |
| 61 | ret 51567 |
| 62 | end |
| 63 | |
| 64 | fn brmalloc a ulong b ulong c ulong d ulong e ulong to long |
| 65 | ret long add a add b add c add d e |
| 66 | end |
| 67 | |
| 68 | fn brmctrl a ulong b ulong c ulong d ulong to long |
| 69 | ret long add a add b add c d |
| 70 | end |
| 71 | |
| 72 | fn mmregwr reg ulong val ulong to void |
| 73 | if eq reg 12255376 |
| 74 | put shdb 0 uint and val 4294967295 |
| 75 | end |
| 76 | end |
| 77 | |
| 78 | fn mmwr32 pa ulong val ulong to void |
| 79 | if or lt pa SHBASE ge pa add SHBASE SHBYTES |
| 80 | trap 3 |
| 81 | end |
| 82 | off = sub pa SHBASE |
| 83 | if ne and off 3 0 |
| 84 | trap 3 |
| 85 | end |
| 86 | put shmem div off 4 uint and val 4294967295 |
| 87 | end |
| 88 | |
| 89 | fn mmrd32 pa ulong to ulong |
| 90 | if or lt pa SHBASE ge pa add SHBASE SHBYTES |
| 91 | trap 3 |
| 92 | end |
| 93 | off = sub pa SHBASE |
| 94 | if ne and off 3 0 |
| 95 | trap 3 |
| 96 | end |
| 97 | ret ulong get shmem div off 4 |
| 98 | end |
| 99 | |
| 100 | fn mmwr64 pa ulong val ulong to void |
| 101 | mmwr32 pa and val 4294967295 |
| 102 | mmwr32 add pa 4 shr val 32 |
| 103 | end |
| 104 | |
| 105 | fn q3_dc_civac pa ulong nbytes ulong to void |
| 106 | put shflsh 0 add get shflsh 0 1 |
| 107 | put shflpa 0 pa |
| 108 | put shflsz 0 nbytes |
| 109 | end |