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 / core / sovereign-core / om / ribbon / test_driver.om

56 lines · 918 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note Test transport appended to pipeline.om. Fixed little-endian u64 requests and replies.
3fn unpack a view uchar 64 j ulong to ulong
4v = ulong 0
5for i ulong 8
6v = or v shl ulong get a add mul j 8 i uint mul i 8
7end
8ret v
9end
10
11fn pack a edit uchar 72 j ulong v ulong to void
12for i ulong 8
13put a add mul j 8 i uchar and shr v uint mul i 8 255
14end
15end
16
17fn main to int
18st = new ulong 4096 0
19q = new ulong 8 0
20ans = new ulong 8 0
21inb = new uchar 64 0
22outb = new uchar 72 0
23for turn ulong 1000000
24n = ulong 0
25while lt n 64 bound 64
26k = read 0 inb n sub 64 n
27if lt k 0
28ret 2
29end
30if eq k 0
31if eq n 0
32ret 0
33end
34ret 2
35end
36n = add n ulong k
37end
38for i ulong 8
39put q i unpack inb i
40end
41rc = pipeline st q ans
42pack outb 0 rc
43for i ulong 8
44pack outb add i 1 get ans i
45end
46n = ulong 0
47while lt n 72 bound 72
48k = write 1 outb n sub 72 n
49if le k 0
50ret 3
51end
52n = add n ulong k
53end
54end
55ret 4
56end