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 / tests / arboris_gated_test.om

131 lines · 3135 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note Compose arboris_arena.om, gpu/nvidia/om/numeric/numeric.om,
3note arboris_gated.om and this file in order, strip '^export ', compile and run.
4fn ag_fixture arena edit ushort * offsets view ulong 6 to void
5 topo = div get offsets 1 2
6 note CSR [0,2,3]; branch synapse offsets [0,0,1,2]; sources [1,0].
7 put arena add topo 2 2
8 put arena add topo 4 3
9 put arena add topo 10 1
10 put arena add topo 12 2
11 put arena add topo 14 1
12 note Branch metadata: soma 0 root, soma 0 child at depth 1, soma 1 root.
13 put arena add topo 21 0x0100
14 put arena add topo 22 1
15 p = div get offsets 2 2
16 s = div get offsets 3 2
17 for i ulong 8
18 put arena add p i 0x3c00
19 put arena add add p 8 i 0x3c00
20 put arena add add p 16 i 0xc200
21 put arena add add p 24 i 0x4000
22 put arena add add p 56 i 0x3c00
23 put arena add add p 64 i 0x3c00
24 put arena add s i 0x4000
25 put arena add add s 8 i 0x4400
26 end
27end
28
29fn ag_pack_test m view ulong 16 offsets view ulong 6 original view ushort * to int
30 packed = new ushort 45064 0
31 for i ulong len original
32 put packed i get original i
33 end
34 limits = new ulong 2 0
35 put limits 0 1
36 topo = div get offsets 1 2
37 put packed add topo 14 7
38 put packed 22528 27
39 if ne arboris_pack_gated m offsets packed limits 3
40 ret 12
41 end
42 if or ne get packed 22528 27 ne get limits 1 0
43 ret 12
44 end
45 put packed add topo 14 1
46 inactive = div get offsets 4 2
47 put packed inactive 0xbeef
48 if ne arboris_pack_gated m offsets packed limits 0
49 ret 8
50 end
51 if ne get limits 1 1
52 ret 9
53 end
54 if ne get packed 45056 1
55 ret 9
56 end
57 if ne get packed 45060 1
58 ret 9
59 end
60 if ne ag_u32 packed 22528 1 shr get m 0 32
61 ret 13
62 end
63 if ne get packed add add 22528 inactive 8 0xbeef
64 ret 14
65 end
66 if ne arboris_gated_tick m offsets part packed 22528 22528 4096 0
67 ret 10
68 end
69 pong = add 22528 div get offsets 4 2
70 for i ulong 8
71 if ne get packed add pong i 0x4200
72 ret 11
73 end
74 if ne get packed add add pong 8 i 0x4100
75 ret 11
76 end
77 end
78 ret 0
79end
80
81fn main to int
82 m = new ulong 16 0
83 offsets = new ulong 6 0
84 arena = new ushort 22528 0
85 put m 0 0x4152425200000001
86 put m 1 2
87 put m 2 3
88 put m 3 2
89 put m 4 8
90 put m 5 2
91 put m 10 144
92 if ne arboris_plan_arena m 45056 4096 offsets 0
93 ret 1
94 end
95 ag_fixture arena offsets
96 rc = ag_pack_test m offsets arena
97 if ne rc 0
98 ret rc
99 end
100 if ne arboris_gated_tick m offsets arena 4096 0
101 ret 2
102 end
103 pong = div get offsets 4 2
104 for i ulong 8
105 if ne get arena add pong i 0x4100
106 ret 3
107 end
108 if ne get arena add add pong 8 i 0x4200
109 ret 3
110 end
111 end
112 put m 6 1
113 if ne arboris_gated_tick m offsets arena 4096 0
114 ret 4
115 end
116 ping = div get offsets 3 2
117 if or ne get arena ping 0x4080 ne get arena add ping 8 0x4180
118 ret 5
119 end
120 topo = div get offsets 1 2
121 put arena add topo 21 0x0200
122 if ne arboris_gated_tick m offsets arena 4096 2
123 ret 6
124 end
125 put arena add topo 21 0x0100
126 put arena add topo 22 0
127 if ne arboris_gated_tick m offsets arena 4096 2
128 ret 7
129 end
130 ret 0
131end