-
Notifications
You must be signed in to change notification settings - Fork 7
/
generate-cpu-cores-table.py
55 lines (39 loc) · 1.4 KB
/
generate-cpu-cores-table.py
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
#!/usr/bin/env python3
from datetime import datetime, timezone
from jinja2 import Environment, FileSystemLoader
import tables
def handle_cpu_cores():
cpu_cores = {}
implementer = 0x41 # ARM
cpu_cores[implementer] = {
"implementer_name": tables.cpu_cores[implementer]["name"],
"cores": {}
}
for core in sorted(tables.cpu_cores[implementer]['cores']):
try:
core_data = tables.cpu_cores[implementer]['cores'][core].copy()
if core_data['aarch32'] == "to be set":
core_data['aarch32'] = ""
elif not core_data["aarch32"]:
core_data['aarch32'] = "NO"
cpu_cores[implementer]["cores"][int(core, base=16)] = (
core_data)
except ValueError:
pass
return cpu_cores
def generate_html_file(cpu_cores):
file_loader = FileSystemLoader("templates")
env = Environment(loader=file_loader,
trim_blocks=True,
lstrip_blocks=True)
template = env.get_template("arm-cpu-cores.html.j2")
output = template.render(
generate_time=datetime.strftime(datetime.now(timezone.utc),
"%d %B %Y %H:%M"),
cpu_cores=cpu_cores,
git_repo="arm-socs-table",
)
print(output)
if __name__ == "__main__":
cpu_cores = handle_cpu_cores()
generate_html_file(cpu_cores)