-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmulti_tool.py
executable file
·89 lines (71 loc) · 5.09 KB
/
multi_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
#!/usr/bin/env python3
import logging, sys, argparse
from collect import Collection
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="test a project repo")
parser.add_argument('--force-delete', help='instead of aborting on existing files, delete them', action='store_const', const=True)
subparsers = parser.add_subparsers(help='help for subcommand', dest="command")
parser.add_argument('--config', help="the config file listing all project directories", default='projects.yaml')
parser.add_argument('--local-config', help="the local environment config file", default='local.yaml')
parser.add_argument('--project', help="just run for a single project, supply project ID", type=int)
parser.add_argument('--test-module', help="run the module's test", action='store_const', const=True)
parser.add_argument('--prove-wrapper', help="check the wrapper proof", action='store_const', const=True)
parser.add_argument('--test-caravel', help="check the caravel test", action='store_const', const=True)
parser.add_argument('--test-gds', help="check the gds", action='store_const', const=True)
parser.add_argument('--test-lvs', help="check the gds against powered verilog", action='store_const', const=True)
parser.add_argument('--test-tristate-z', help="check outputs are z when not active", action='store_const', const=True)
parser.add_argument('--test-tristate-driver', help="check outputs are driven by tristate cell", action='store_const', const=True)
parser.add_argument('--test-ports', help="check ports defined in yaml match the verilog", action='store_const', const=True)
parser.add_argument('--test-git', help="check gitsha on disk matches the config", action='store_const', const=True)
parser.add_argument('--test-all', help="run all the checks for each project", action='store_const', const=True)
parser.add_argument('--test-from', help="run all the checks for all projects with id equal or more than the given id", type=int)
parser.add_argument('--prove-tristate', help="build and run the tristate proof", action='store_const', const=True)
parser.add_argument('--openram', help="use OpenRAM - instantiate the bridge, wrapper and do the wiring", action='store_const', const=True)
parser.add_argument('--clone-shared-repos', help="clone shared repos defined in projects.yaml", action='store_const', const=True)
parser.add_argument('--clone-repos', help="git clone the repo", action='store_const', const=True)
parser.add_argument('--create-openlane-config', help="create the OpenLane & caravel_user_project config", action='store_const', const=True)
parser.add_argument('--gate-level', help="create the caravel includes file with gate level includes", action='store_const', const=True)
parser.add_argument('--copy-project', help="copy project's RTL and tests to correct locations in caravel_user_project", action='store_const', const=True)
parser.add_argument('--copy-gds', help="copy the projects GDS and LEF files", action='store_const', const=True)
parser.add_argument('--generate-doc', help="generate a index.md file with information about each project", action='store_const', const=True)
parser.add_argument('--dump-hash', help="print current commit hash of each project along with author and title", action='store_const', const=True)
parser.add_argument('--fill', help="for testing, repeat the given projects this number of times", type=int)
parser.add_argument('--annotate-image', help="annotate the multi_macro.png image generated by klayout", action='store_const', const=True)
parser.add_argument('--dump-macro-position', help="use the macro.cfg + gds to create a list of positions and sizes", action='store_const', const=True)
parser.add_argument('--count-cells', help="cells per design and total", action='store_const', const=True)
args = parser.parse_args()
# setup log
log_format = logging.Formatter('%(asctime)s - %(module)-15s - %(levelname)-8s - %(message)s')
# configure the client logging
log = logging.getLogger('')
# has to be set to debug as is the root logger
log.setLevel(logging.INFO)
# create console handler and set level to info
ch = logging.StreamHandler(sys.stdout)
# create formatter for console
ch.setFormatter(log_format)
log.addHandler(ch)
collection = Collection(args)
# run any tests specified by arguments
collection.run_tests()
# create all the OpenLane config for the user collection wrapper
if args.create_openlane_config:
collection.create_openlane_config()
if args.prove_tristate:
collection.prove_all_tristate()
# copy gds to correct place
if args.copy_gds:
collection.copy_all_gds()
if args.copy_project:
collection.copy_all_project_files_to_caravel()
# generate doc
if args.generate_doc:
collection.generate_docs()
# image
if args.annotate_image:
collection.annotate_image()
# dump macro pos - wip for assisted macro placement
if args.dump_macro_position:
collection.get_macro_pos()
if args.count_cells:
collection.count_cells()