OXYGENHUB
◆ main openmsx / build / cpu.py
1.8 KiB · Python · last changed chore(): initial commit 1 month ago source blame history raw
1
class CPU(object):
2
	'''Abstract base class for CPU families.
3
	'''
4
5
	# String that we use to identify this CPU type.
6
	name = None
7
8
	# GCC flags to pass to the compile and link commands.
9
	gccFlags = ()
10
11
class Alpha(CPU):
12
	'''DEC Alpha.
13
	'''
14
	name = 'alpha'
15
16
class ARM(CPU):
17
	'''ARM.
18
	'''
19
	name = 'arm'
20
21
class ARM64(CPU):
22
	'''ARM 64-bit, little endian mode.
23
	'''
24
	name = 'aarch64'
25
26
class ARM64BE(CPU):
27
	'''ARM 64-bit, big endian mode.
28
	'''
29
	name = 'aarch64_be'
30
31
class AVR32(CPU):
32
	'''Atmel AVR32, an embedded RISC CPU.
33
	'''
34
	name = 'avr32'
35
36
class HPPA(CPU):
37
	'''HP PA-RISC.
38
	'''
39
	name = 'hppa'
40
41
class IA64(CPU):
42
	'''Intel Itanium.
43
	'''
44
	name = 'ia64'
45
46
class LoongArch64(CPU):
47
	'''64-bit LoongArch.
48
	'''
49
	name = 'loongarch64'
50
51
class M68k(CPU):
52
	'''Motorola 680x0.
53
	'''
54
	name = 'm68k'
55
56
class MIPS(CPU):
57
	'''Big endian MIPS.
58
	'''
59
	name = 'mips'
60
61
class MIPSel(MIPS):
62
	'''Little endian MIPS.
63
	'''
64
	name = 'mipsel'
65
66
class PPC(CPU):
67
	'''32-bit Power PC.
68
	'''
69
	name = 'ppc'
70
71
class PPC64(CPU):
72
	'''64-bit Power PC.
73
	'''
74
	name = 'ppc64'
75
76
class PPC64LE(CPU):
77
	'''64-bit Power PC LE.
78
	'''
79
	name = 'ppc64le'
80
81
class RISCV64(CPU):
82
	'''64-bit RISC-V.
83
	'''
84
	name = 'riscv64'
85
86
class S390(CPU):
87
	'''IBM S/390.
88
	'''
89
	name = 's390'
90
91
class SH(CPU):
92
	'''Little endian Renesas SuperH.
93
	'''
94
	name = 'sh'
95
96
class SHeb(CPU):
97
	'''Big endian Renesas SuperH.
98
	'''
99
	name = 'sheb'
100
101
class Sparc(CPU):
102
	'''Sun Sparc.
103
	'''
104
	name = 'sparc'
105
106
class X86(CPU):
107
	'''32-bit x86: Intel Pentium, AMD Athlon etc.
108
	'''
109
	name = 'x86'
110
	gccFlags = '-m32',
111
112
class X86_64(CPU):
113
	'''64-bit x86. Also known as AMD64 or x64.
114
	'''
115
	name = 'x86_64'
116
	gccFlags = '-m64',
117
118
# Build a dictionary of CPUs using introspection.
119
_cpusByName = {
120
	obj.name: obj
121
	for obj in locals().values()
122
	if isinstance(obj, type)
123
		and issubclass(obj, CPU)
124
		and obj is not CPU
125
	}
126
127
def getCPU(name):
128
	return _cpusByName[name]