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 / gsp / sec2sim.om
| 1 | note GB20B register-model extension. Pure simulator, not device evidence. |
| 2 | note s2sc: secure-delay,response-delay,missing-response,bad-header,error,bad-pointer,short-response,reply-head. |
| 3 | global s2sc ulong 8 |
| 4 | global s2ss ulong 8 |
| 5 | fn s2simrd off ulong to ulong |
| 6 | put s2ss 7 add get s2ss 7 1 |
| 7 | if eq off S2SCR |
| 8 | if eq get s2sc 0 0 |
| 9 | ret 255 |
| 10 | end |
| 11 | put s2sc 0 sub get s2sc 0 1 |
| 12 | ret 0 |
| 13 | end |
| 14 | if eq off S2MH |
| 15 | if eq get s2ss 0 1 |
| 16 | v = srmb0 |
| 17 | if and eq v 0 eq get s2sc 2 0 |
| 18 | if eq get s2sc 1 0 |
| 19 | put s2ss 1 1 |
| 20 | else |
| 21 | put s2sc 1 sub get s2sc 1 1 |
| 22 | end |
| 23 | end |
| 24 | end |
| 25 | ret and get s2sc 7 M32 |
| 26 | end |
| 27 | if eq off S2MT |
| 28 | h = and get s2sc 7 M32 |
| 29 | if eq get s2ss 1 0 |
| 30 | ret h |
| 31 | end |
| 32 | if ne get s2sc 6 0 |
| 33 | ret and add h 12 M32 |
| 34 | end |
| 35 | ret and add h 16 M32 |
| 36 | end |
| 37 | if and eq off S2EMC eq get s2ss 2 1 |
| 38 | dw = and add add get s2ss 4 get s2ss 3 get s2sc 5 S2DWMSK |
| 39 | ret mul dw 4 |
| 40 | end |
| 41 | if and eq off S2EMD eq get s2ss 2 1 |
| 42 | i = get s2ss 3 |
| 43 | put s2ss 3 add i 1 |
| 44 | if eq i 0 |
| 45 | ret 3221225472 |
| 46 | end |
| 47 | if eq i 1 |
| 48 | ret add 353427070 get s2sc 3 |
| 49 | end |
| 50 | if eq i 2 |
| 51 | ret 7 |
| 52 | end |
| 53 | if eq i 3 |
| 54 | ret 20 |
| 55 | end |
| 56 | if eq i 4 |
| 57 | ret get s2sc 4 |
| 58 | end |
| 59 | ret 0 |
| 60 | end |
| 61 | ret simrd off |
| 62 | end |
| 63 | fn s2simwr off ulong v ulong to void |
| 64 | put s2ss 7 add get s2ss 7 1 |
| 65 | h = and get s2sc 7 M32 |
| 66 | if eq off S2MH |
| 67 | if and eq v h eq get s2ss 5 1 |
| 68 | put s2ss 6 1 |
| 69 | end |
| 70 | ret |
| 71 | end |
| 72 | if eq off S2MT |
| 73 | if eq v h |
| 74 | put s2ss 5 1 |
| 75 | end |
| 76 | put s2ss 1 0 |
| 77 | ret |
| 78 | end |
| 79 | if and eq off S2EMC eq v or S2AINCR and h S2OFFMSK |
| 80 | put s2ss 2 1 |
| 81 | put s2ss 3 0 |
| 82 | put s2ss 4 ememdw v |
| 83 | ret |
| 84 | end |
| 85 | simwr off v |
| 86 | if eq off S2QH |
| 87 | put s2ss 0 1 |
| 88 | end |
| 89 | end |