interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / driver / tests / q38_run_shim.om

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