-
Notifications
You must be signed in to change notification settings - Fork 14
/
tt_tool.py
executable file
·177 lines (155 loc) · 4.29 KB
/
tt_tool.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env python3
import argparse
import logging
import sys
from project import Project
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="TT setup")
parser.add_argument("--project-dir", help="location of the project", default=".")
parser.add_argument(
"--yaml", help="the project's yaml configuration file", default="info.yaml"
)
parser.add_argument(
"--debug",
help="debug logging",
action="store_const",
dest="loglevel",
const=logging.DEBUG,
default=logging.INFO,
)
parser.add_argument(
"--openlane2",
help="use openlane 2",
action="store_const",
const=True,
default=False,
)
parser.add_argument(
"--orfs",
help="use ORFS",
action="store_const",
const=True,
default=False,
)
# reports & summaries
parser.add_argument(
"--print-cell-summary",
help="print summary",
action="store_const",
const=True,
default=False,
)
parser.add_argument(
"--print-cell-category",
help="print category",
action="store_const",
const=True,
default=False,
)
parser.add_argument(
"--print-stats",
help="print some stats from the run",
action="store_const",
const=True,
)
parser.add_argument(
"--print-warnings", help="print any warnings", action="store_const", const=True
)
parser.add_argument(
"--print-wokwi-id",
help="prints the Wokwi project id",
action="store_const",
const=True,
)
parser.add_argument(
"--print-top-module",
help="prints the name of the top module",
action="store_const",
const=True,
)
# documentation
parser.add_argument(
"--check-docs",
help="check the documentation part of the yaml",
action="store_const",
const=True,
)
parser.add_argument(
"--create-pdf",
help="create a single page PDF",
action="store_const",
const=True,
)
parser.add_argument(
"--create-svg",
help="create a svg of the GDS layout",
action="store_const",
const=True,
)
parser.add_argument(
"--create-png",
help="create a png of the GDS layout",
action="store_const",
const=True,
)
# configure
parser.add_argument(
"--create-user-config",
help="create the user_config.json file with top module and source files",
action="store_const",
const=True,
)
parser.add_argument(
"--harden",
help="use a local OpenLane install to harden the project",
action="store_const",
const=True,
)
# FPGA
parser.add_argument(
"--create-fpga-bitstream",
help="create the FPGA bitstream",
action="store_const",
const=True,
)
args = parser.parse_args()
# setup log
log_format = logging.Formatter(
"%(asctime)s - %(module)-10s - %(levelname)-8s - %(message)s"
)
# configure the client logging
log = logging.getLogger("")
# has to be set to debug as is the root logger
log.setLevel(args.loglevel)
# create console handler and set level to info
ch = logging.StreamHandler(sys.stdout)
# create formatter for console
ch.setFormatter(log_format)
log.addHandler(ch)
project = Project(0, "unknown", args.project_dir, args, is_user_project=True)
project.post_clone_setup()
# handle the options
if args.check_docs:
project.check_docs()
if args.print_cell_summary or args.print_cell_category:
project.summarize()
if args.print_stats:
project.print_stats()
if args.print_warnings:
project.print_warnings()
if args.print_wokwi_id:
project.print_wokwi_id()
if args.print_top_module:
project.print_top_module()
if args.create_user_config:
project.create_user_config()
if args.harden:
project.harden()
if args.create_pdf:
project.create_pdf()
if args.create_png:
project.create_png()
if args.create_svg:
project.create_svg()
if args.create_fpga_bitstream:
project.create_fpga_bitstream()