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 / gsp / irqsim.om

82 lines · 1881 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Explicit host-only GSP IRQ/queue peer. No map handles, VFIO, device fds or physical firmware.
3note Model choices: finite queue; one edge may arrive during receive or the post-drain status read;
4note service can fail at an ordinal or deliver a lockdown notification. Not firmware emulation.
5note Constants intentionally independent of irq.om so a wrong handler mask does not move this peer.
6global israw uint 1
7global ismask uint 1
8global isdest uint 1
9global iscnt ulong 1
10global isdone ulong 1
11global isedge ulong 1
12global isfail ulong 1
13global islock ulong 1
14global istail ulong 1
15global ispm ulong 1
16global isacks ulong 1
17global isreads ulong 1
18global ismasks ulong 1
19global isviol ulong 1
20global islocked ulong 1
21fn isaccess to void
22if or ne get ispm 0 0 ne get islocked 0 0
23put isviol 0 add get isviol 0 1
24end
25end
26fn iqpm to bool
27ret eq get ispm 0 0
28end
29fn iqread to uint
30isaccess
31put isreads 0 add get isreads 0 1
32if and ne get istail 0 0 eq get isreads 0 2
33put istail 0 0
34put israw 0 or get israw 0 64
35put iscnt 0 add get iscnt 0 1
36end
37ret and and get israw 0 get ismask 0 get isdest 0
38end
39fn iqclear v uint to void
40isaccess
41if ne v 64
42put isviol 0 add get isviol 0 1
43end
44put isacks 0 add get isacks 0 1
45put israw 0 and get israw 0 not v
46end
47fn iqready to bool
48isaccess
49if eq get isacks 0 0
50put isviol 0 add get isviol 0 1
51end
52ret lt get isdone 0 get iscnt 0
53end
54fn iqrecv to long
55isaccess
56if eq get isacks 0 0
57put isviol 0 add get isviol 0 1
58end
59n = add get isdone 0 1
60if eq get isfail 0 n
61ret -1
62end
63if gt n get iscnt 0
64ret -1
65end
66put isdone 0 n
67if and ne get isedge 0 0 eq get isedge 0 n
68put isedge 0 0
69put israw 0 or get israw 0 64
70put iscnt 0 add get iscnt 0 1
71end
72if eq get islock 0 n
73put islocked 0 1
74ret 2
75end
76ret 1
77end
78fn iqmask to void
79isaccess
80put ismasks 0 add get ismasks 0 1
81put ismask 0 0
82end