aboutsummaryrefslogtreecommitdiff
path: root/core/sys/info/cpu_riscv64.odin
blob: 64f2edfd3d1f6f4dcbc104cd570d1e4ee56698bb (plain)
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
99
100
101
102
103
104
package sysinfo

CPU_Feature :: enum u64 {
	// Bit-Manipulation ISA Extensions v1.
	Zba = 3,
	Zbb,
	Zbs,

	// CMOs (ratified).
	Zicboz,

	// Bit-Manipulation ISA Extensions v1.
	Zbc,

	// Scalar Crypto ISA extensions v1.
	Zbkb,
	Zbkc,
	Zbkx,
	Zknd,
	Zkne,
	Zknh,
	Zksed,
	Zksh,
	Zkt,

	// Cryptography Extensions Volume II v1.
	Zvbb,
	Zvbc,
	Zvkb,
	Zvkg,
	Zvkned,
	Zvknha,
	Zvknhb,
	Zvksed,
	Zvksh,
	Zvkt,

	// ISA Manual v1.
	Zfh,
	Zfhmin,
	Zihintntl,

	// ISA manual (ratified).
	Zvfh,
	Zvfhmin,
	Zfa,
	Ztso,

	// Atomic Compare-and-Swap Instructions Manual (ratified).
	Zacas,
	Zicond,

	// ISA manual (ratified).
	Zihintpause,

	// Vector Extensions Manual v1.
	Zve32x,
	Zve32f,
	Zve64x,
	Zve64f,
	Zve64d,

	// ISA manual (ratified).
	Zimop,

	// Code Size Reduction (ratified).
	Zca,
	Zcb,
	Zcd,
	Zcf,

	// ISA manual (ratified).
	Zcmop,
	Zawrs,

 	// Base features, don't think this is ever not here.
	I,
 	// Integer multiplication and division, currently required by Odin.
	M,
 	// Atomics.
	A,
 	// Single precision floating point, currently required by Odin.
	F,
 	// Double precision floating point, currently required by Odin.
	D,
 	// Compressed instructions.
	C,
 	// Vector operations.
	V,

	// Indicates Misaligned Scalar Loads will not trap the program.
	Misaligned_Supported,
	// Indicates Hardware Support for Misaligned Scalar Loads.
	Misaligned_Fast,
}

CPU_Features :: distinct bit_set[CPU_Feature; u64]
CPU :: struct {
	name:           Maybe(string),
	features:       Maybe(CPU_Features),
	physical_cores: int,
	logical_cores:  int,
}
cpu: CPU