-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtiny-arm-defs.sail
98 lines (86 loc) · 1.58 KB
/
tiny-arm-defs.sail
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
type boolean = bit
type integer = int
type uinteger = nat
type reg_index = range(0, 31)
register _PC : bits(64)
/* General purpose registers */
register R30 : bits(64)
register R29 : bits(64)
register R28 : bits(64)
register R27 : bits(64)
register R26 : bits(64)
register R25 : bits(64)
register R24 : bits(64)
register R23 : bits(64)
register R22 : bits(64)
register R21 : bits(64)
register R20 : bits(64)
register R19 : bits(64)
register R18 : bits(64)
register R17 : bits(64)
register R16 : bits(64)
register R15 : bits(64)
register R14 : bits(64)
register R13 : bits(64)
register R12 : bits(64)
register R11 : bits(64)
register R10 : bits(64)
register R9 : bits(64)
register R8 : bits(64)
register R7 : bits(64)
register R6 : bits(64)
register R5 : bits(64)
register R4 : bits(64)
register R3 : bits(64)
register R2 : bits(64)
register R1 : bits(64)
register R0 : bits(64)
let GPRs : vector(31, register(bits(64))) = [
ref R30,
ref R29,
ref R28,
ref R27,
ref R26,
ref R25,
ref R24,
ref R23,
ref R22,
ref R21,
ref R20,
ref R19,
ref R18,
ref R17,
ref R16,
ref R15,
ref R14,
ref R13,
ref R12,
ref R11,
ref R10,
ref R9,
ref R8,
ref R7,
ref R6,
ref R5,
ref R4,
ref R3,
ref R2,
ref R1,
ref R0,
]
val wX : (reg_index, bits(64)) -> unit
function wX(n, value) = {
if n != 31 then
*GPRs[n] = value;
}
val rX : reg_index -> bits(64)
function rX(n) = {
if n != 31 then
*GPRs[n]
else
0x0000000000000000;
}
overload X = {rX, wX}
function rPC() -> bits(64) = _PC
function wPC(pc : bits(64)) -> unit = _PC = pc
overload PC = {rPC, wPC}