siliconcompiler 0.33.2__py3-none-any.whl → 0.34.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. siliconcompiler/__init__.py +2 -0
  2. siliconcompiler/_metadata.py +1 -1
  3. siliconcompiler/apps/_common.py +1 -1
  4. siliconcompiler/apps/sc.py +1 -1
  5. siliconcompiler/apps/sc_issue.py +6 -4
  6. siliconcompiler/apps/sc_remote.py +3 -20
  7. siliconcompiler/apps/sc_show.py +2 -2
  8. siliconcompiler/apps/utils/replay.py +4 -4
  9. siliconcompiler/checklist.py +202 -1
  10. siliconcompiler/core.py +62 -293
  11. siliconcompiler/data/templates/email/general.j2 +3 -3
  12. siliconcompiler/data/templates/email/summary.j2 +1 -1
  13. siliconcompiler/data/templates/issue/README.txt +1 -1
  14. siliconcompiler/data/templates/report/sc_report.j2 +7 -7
  15. siliconcompiler/dependencyschema.py +392 -0
  16. siliconcompiler/design.py +758 -0
  17. siliconcompiler/flowgraph.py +79 -13
  18. siliconcompiler/optimizer/vizier.py +2 -2
  19. siliconcompiler/package/__init__.py +383 -223
  20. siliconcompiler/package/git.py +75 -77
  21. siliconcompiler/package/github.py +70 -97
  22. siliconcompiler/package/https.py +77 -93
  23. siliconcompiler/packageschema.py +260 -0
  24. siliconcompiler/pdk.py +5 -5
  25. siliconcompiler/remote/client.py +33 -15
  26. siliconcompiler/remote/server.py +2 -2
  27. siliconcompiler/report/dashboard/cli/__init__.py +6 -6
  28. siliconcompiler/report/dashboard/cli/board.py +4 -4
  29. siliconcompiler/report/dashboard/web/components/__init__.py +5 -5
  30. siliconcompiler/report/dashboard/web/components/flowgraph.py +4 -4
  31. siliconcompiler/report/dashboard/web/components/graph.py +2 -2
  32. siliconcompiler/report/dashboard/web/state.py +1 -1
  33. siliconcompiler/report/dashboard/web/utils/__init__.py +5 -5
  34. siliconcompiler/report/html_report.py +1 -1
  35. siliconcompiler/report/report.py +4 -4
  36. siliconcompiler/report/summary_table.py +2 -2
  37. siliconcompiler/report/utils.py +5 -5
  38. siliconcompiler/scheduler/__init__.py +3 -1382
  39. siliconcompiler/scheduler/docker.py +263 -0
  40. siliconcompiler/scheduler/run_node.py +10 -21
  41. siliconcompiler/scheduler/scheduler.py +311 -0
  42. siliconcompiler/scheduler/schedulernode.py +944 -0
  43. siliconcompiler/scheduler/send_messages.py +3 -3
  44. siliconcompiler/scheduler/slurm.py +149 -163
  45. siliconcompiler/scheduler/taskscheduler.py +45 -57
  46. siliconcompiler/schema/__init__.py +3 -3
  47. siliconcompiler/schema/baseschema.py +234 -11
  48. siliconcompiler/schema/editableschema.py +4 -0
  49. siliconcompiler/schema/journal.py +210 -0
  50. siliconcompiler/schema/namedschema.py +55 -2
  51. siliconcompiler/schema/parameter.py +14 -1
  52. siliconcompiler/schema/parametervalue.py +1 -34
  53. siliconcompiler/schema/schema_cfg.py +210 -349
  54. siliconcompiler/tool.py +412 -148
  55. siliconcompiler/tools/__init__.py +2 -0
  56. siliconcompiler/tools/builtin/_common.py +5 -5
  57. siliconcompiler/tools/builtin/concatenate.py +7 -7
  58. siliconcompiler/tools/builtin/minimum.py +4 -4
  59. siliconcompiler/tools/builtin/mux.py +4 -4
  60. siliconcompiler/tools/builtin/nop.py +4 -4
  61. siliconcompiler/tools/builtin/verify.py +8 -9
  62. siliconcompiler/tools/execute/exec_input.py +1 -1
  63. siliconcompiler/tools/genfasm/genfasm.py +1 -6
  64. siliconcompiler/tools/openroad/_apr.py +5 -1
  65. siliconcompiler/tools/openroad/antenna_repair.py +1 -1
  66. siliconcompiler/tools/openroad/macro_placement.py +1 -1
  67. siliconcompiler/tools/openroad/power_grid.py +1 -1
  68. siliconcompiler/tools/openroad/scripts/common/procs.tcl +32 -25
  69. siliconcompiler/tools/opensta/timing.py +26 -3
  70. siliconcompiler/tools/slang/__init__.py +2 -2
  71. siliconcompiler/tools/surfer/__init__.py +0 -0
  72. siliconcompiler/tools/surfer/show.py +53 -0
  73. siliconcompiler/tools/surfer/surfer.py +30 -0
  74. siliconcompiler/tools/vpr/route.py +82 -0
  75. siliconcompiler/tools/vpr/vpr.py +23 -6
  76. siliconcompiler/tools/yosys/__init__.py +1 -1
  77. siliconcompiler/tools/yosys/scripts/procs.tcl +143 -0
  78. siliconcompiler/tools/yosys/{sc_synth_asic.tcl → scripts/sc_synth_asic.tcl} +4 -0
  79. siliconcompiler/tools/yosys/{sc_synth_fpga.tcl → scripts/sc_synth_fpga.tcl} +24 -77
  80. siliconcompiler/tools/yosys/syn_fpga.py +14 -0
  81. siliconcompiler/toolscripts/_tools.json +9 -13
  82. siliconcompiler/toolscripts/rhel9/install-vpr.sh +0 -2
  83. siliconcompiler/toolscripts/ubuntu22/install-surfer.sh +33 -0
  84. siliconcompiler/toolscripts/ubuntu24/install-surfer.sh +33 -0
  85. siliconcompiler/utils/__init__.py +4 -24
  86. siliconcompiler/utils/flowgraph.py +29 -28
  87. siliconcompiler/utils/issue.py +23 -29
  88. siliconcompiler/utils/logging.py +37 -7
  89. siliconcompiler/utils/showtools.py +6 -1
  90. {siliconcompiler-0.33.2.dist-info → siliconcompiler-0.34.1.dist-info}/METADATA +16 -25
  91. {siliconcompiler-0.33.2.dist-info → siliconcompiler-0.34.1.dist-info}/RECORD +98 -91
  92. siliconcompiler/scheduler/docker_runner.py +0 -254
  93. siliconcompiler/schema/journalingschema.py +0 -242
  94. siliconcompiler/tools/yosys/procs.tcl +0 -71
  95. siliconcompiler/toolscripts/rhel9/install-yosys-parmys.sh +0 -68
  96. siliconcompiler/toolscripts/ubuntu22/install-yosys-parmys.sh +0 -68
  97. siliconcompiler/toolscripts/ubuntu24/install-yosys-parmys.sh +0 -68
  98. /siliconcompiler/tools/yosys/{sc_lec.tcl → scripts/sc_lec.tcl} +0 -0
  99. /siliconcompiler/tools/yosys/{sc_screenshot.tcl → scripts/sc_screenshot.tcl} +0 -0
  100. /siliconcompiler/tools/yosys/{syn_strategies.tcl → scripts/syn_strategies.tcl} +0 -0
  101. {siliconcompiler-0.33.2.dist-info → siliconcompiler-0.34.1.dist-info}/WHEEL +0 -0
  102. {siliconcompiler-0.33.2.dist-info → siliconcompiler-0.34.1.dist-info}/entry_points.txt +0 -0
  103. {siliconcompiler-0.33.2.dist-info → siliconcompiler-0.34.1.dist-info}/licenses/LICENSE +0 -0
  104. {siliconcompiler-0.33.2.dist-info → siliconcompiler-0.34.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,392 @@
1
+ import os.path
2
+
3
+ from siliconcompiler.schema.baseschema import BaseSchema
4
+ from siliconcompiler.schema.editableschema import EditableSchema
5
+ from siliconcompiler.schema.parameter import Parameter, Scope
6
+ from siliconcompiler.schema.namedschema import NamedSchema
7
+ from siliconcompiler.schema.utils import trim
8
+
9
+ from siliconcompiler.package import Resolver
10
+
11
+
12
+ class DependencySchema(BaseSchema):
13
+ '''
14
+ Schema extension to add :meth:`.add_dep` capability to a schema section.
15
+ '''
16
+
17
+ def __init__(self):
18
+ super().__init__()
19
+
20
+ self.__deps = {}
21
+
22
+ schema = EditableSchema(self)
23
+ schema.insert(
24
+ "deps",
25
+ Parameter(
26
+ '[str]',
27
+ scope=Scope.GLOBAL,
28
+ lock=True,
29
+ shorthelp="List of dependencies",
30
+ help="List of named object dependencies included via add_dep()."))
31
+
32
+ schema.insert(
33
+ 'package', 'default', 'root',
34
+ Parameter(
35
+ 'str',
36
+ scope=Scope.GLOBAL,
37
+ shorthelp="Package: package root",
38
+ example=[
39
+ "api: chip.set('source', "
40
+ "'freepdk45_data', 'path', 'ssh://git@github.com/siliconcompiler/freepdk45/')"],
41
+ help=trim("""
42
+ Package root path, this points the location where the package data can be
43
+ retrieved or accessed.
44
+ Allowed roots:
45
+
46
+ * /path/on/network/drive
47
+ * file:///path/on/network/drive
48
+ * git+https://github.com/xyz/xyz
49
+ * git://github.com/xyz/xyz
50
+ * git+ssh://github.com/xyz/xyz
51
+ * ssh://github.com/xyz/xyz
52
+ * https://github.com/xyz/xyz/archive
53
+ * https://zeroasic.com/xyz.tar.gz
54
+ * github://siliconcompiler/lambdapdk/v1.0/asap7.tar.gz
55
+ * python://siliconcompiler
56
+ """)))
57
+
58
+ schema.insert(
59
+ 'package', 'default', 'tag',
60
+ Parameter(
61
+ 'str',
62
+ scope=Scope.GLOBAL,
63
+ shorthelp="Package: package tag/version",
64
+ example=[
65
+ "api: chip.set('source', 'freepdk45_data', 'ref', '07ec4aa')"],
66
+ help=trim("""
67
+ Package reference tag. The meaning of the this tag depends on the context of
68
+ the root.
69
+ For git, this can be a tag, branch, or commit id. For https this is the version
70
+ of the file that will be downloaded.
71
+ """)))
72
+
73
+ def _from_dict(self, manifest, keypath, version=None):
74
+ self.set("deps", False, field="lock")
75
+ ret = super()._from_dict(manifest, keypath, version)
76
+ self.set("deps", True, field="lock")
77
+ return ret
78
+
79
+ def add_dep(self, obj: NamedSchema, clobber: bool = True) -> bool:
80
+ """
81
+ Adds a module to this object.
82
+
83
+ Args:
84
+ obj (:class:`NamedSchema`): Module to add
85
+ clobber (bool): If true will insert the object and overwrite any
86
+ existing with the same name
87
+
88
+ Returns:
89
+ True if object was imported, otherwise false.
90
+ """
91
+
92
+ if not isinstance(obj, NamedSchema):
93
+ raise TypeError(f"Cannot add an object of type: {type(obj)}")
94
+
95
+ if not clobber and obj.name() in self.__deps:
96
+ return False
97
+
98
+ if obj.name() not in self.__deps:
99
+ self.set("deps", False, field="lock")
100
+ self.add("deps", obj.name())
101
+ self.set("deps", True, field="lock")
102
+
103
+ self.__deps[obj.name()] = obj
104
+ obj._reset()
105
+
106
+ return True
107
+
108
+ def write_depgraph(self, filename: str,
109
+ fontcolor: str = '#000000',
110
+ background: str = 'transparent',
111
+ fontsize: str = '14',
112
+ border: bool = True, landscape: bool = False) -> None:
113
+ r'''
114
+ Renders and saves the dependency graph to a file.
115
+
116
+ Args:
117
+ filename (filepath): Output filepath
118
+ fontcolor (str): Node font RGB color hex value
119
+ background (str): Background color
120
+ fontsize (str): Node text font size
121
+ border (bool): Enables node border if True
122
+ landscape (bool): Renders graph in landscape layout if True
123
+
124
+ Examples:
125
+ >>> schema.write_depgraph('mydump.png')
126
+ Renders the object dependency graph and writes the result to a png file.
127
+ '''
128
+ import graphviz
129
+
130
+ filepath = os.path.abspath(filename)
131
+ fileroot, ext = os.path.splitext(filepath)
132
+ fileformat = ext[1:]
133
+
134
+ # controlling border width
135
+ if border:
136
+ penwidth = '1'
137
+ else:
138
+ penwidth = '0'
139
+
140
+ # controlling graph direction
141
+ if landscape:
142
+ rankdir = 'LR'
143
+ else:
144
+ rankdir = 'TB'
145
+
146
+ dot = graphviz.Digraph(format=fileformat)
147
+ dot.graph_attr['rankdir'] = rankdir
148
+ dot.attr(bgcolor=background)
149
+
150
+ def make_label(dep):
151
+ return f"lib-{dep.name()}"
152
+
153
+ nodes = {
154
+ self.name(): {
155
+ "text": self.name(),
156
+ "shape": "box",
157
+ "color": background,
158
+ "connects_to": set([make_label(subdep) for subdep in self.__deps.values()])
159
+ }
160
+ }
161
+ for dep in self.get_dep():
162
+ nodes[make_label(dep)] = {
163
+ "text": dep.name(),
164
+ "shape": "oval",
165
+ "color": background,
166
+ "connects_to": set([make_label(subdep) for subdep in dep.__deps.values()])
167
+ }
168
+
169
+ for label, info in nodes.items():
170
+ dot.node(label, label=info['text'], bordercolor=fontcolor, style='filled',
171
+ fontcolor=fontcolor, fontsize=fontsize, ordering="in",
172
+ penwidth=penwidth, fillcolor=info["color"], shape=info['shape'])
173
+
174
+ for conn in info['connects_to']:
175
+ dot.edge(label, conn, dir='back')
176
+
177
+ try:
178
+ dot.render(filename=fileroot, cleanup=True)
179
+ except graphviz.ExecutableNotFound as e:
180
+ raise RuntimeError(f'Unable to save flowgraph: {e}')
181
+
182
+ def __get_all_deps(self, seen: set) -> list:
183
+ '''
184
+ Loop through the dependency tree and generate a flat list
185
+ '''
186
+ deps = []
187
+
188
+ for obj in self.__deps.values():
189
+ if obj.name() in seen:
190
+ continue
191
+
192
+ deps.append(obj)
193
+ seen.add(obj.name())
194
+
195
+ if not isinstance(obj, DependencySchema):
196
+ # nothing to iterate over
197
+ continue
198
+
199
+ for obj_dep in obj.__get_all_deps(seen):
200
+ deps.append(obj_dep)
201
+ seen.add(obj_dep.name())
202
+
203
+ return deps
204
+
205
+ def get_dep(self, name: str = None, hierarchy: bool = True) -> list:
206
+ '''
207
+ Returns all dependencies associated with this object or a specific one if requested.
208
+
209
+ Raises:
210
+ KeyError: if the module specific module is requested but not found
211
+
212
+ Args:
213
+ name (str): name of the module
214
+ hierarchy (bool): if True, will return all modules including children
215
+ otherwise only this objects modules are returned.
216
+ '''
217
+
218
+ if name:
219
+ if name not in self.__deps:
220
+ raise KeyError(f"{name} is not an imported module")
221
+
222
+ return self.__deps[name]
223
+
224
+ if hierarchy:
225
+ return self.__get_all_deps(set())
226
+ return list(self.__deps.values())
227
+
228
+ def remove_dep(self, name: str) -> bool:
229
+ '''
230
+ Removes a previously registered module.
231
+
232
+ Args:
233
+ name (str): name of the module
234
+
235
+ Returns:
236
+ True if the module was removed, False is not found.
237
+ '''
238
+ if name not in self.__deps:
239
+ return False
240
+
241
+ del self.__deps[name]
242
+
243
+ # Remove from dependency list
244
+ dependencies = self.get("deps")
245
+ dependencies.remove(name)
246
+
247
+ self.set("deps", False, field="lock")
248
+ self.set("deps", dependencies)
249
+ self.set("deps", True, field="lock")
250
+
251
+ return True
252
+
253
+ def _populate_deps(self, module_map: dict):
254
+ if self.__deps:
255
+ return
256
+
257
+ for module in self.get("deps"):
258
+ if module not in module_map:
259
+ raise ValueError(f"{module} not available in map")
260
+ self.__deps[module] = module_map[module]
261
+
262
+ if isinstance(self.__deps[module], DependencySchema):
263
+ self.__deps[module]._populate_deps(module_map)
264
+
265
+ def register_package(self, name: str, root: str, tag: str = None):
266
+ """
267
+ Registers a package by its name with the root and associated tag.
268
+
269
+ Args:
270
+ name (str): Package name
271
+ root (str): Path to the root, can be directory, git url, or archive url
272
+ tag (str): Reference of the sources, can be commitid, branch name, tag
273
+
274
+ Examples:
275
+ >>> schema.register_package('siliconcompiler_data',
276
+ 'git+https://github.com/siliconcompiler/siliconcompiler',
277
+ 'v1.0.0')
278
+ """
279
+
280
+ if os.path.isfile(root):
281
+ root = os.path.dirname(os.path.abspath(root))
282
+
283
+ self.set("package", name, "root", root)
284
+ if tag:
285
+ self.set("package", name, "tag", tag)
286
+
287
+ def find_package(self, name: str):
288
+ """
289
+ Returns absolute path to the package root.
290
+
291
+ Raises:
292
+ ValueError: is package is not found
293
+
294
+ Args:
295
+ name (str): name of the package to find.
296
+
297
+ Returns:
298
+ Path to the package directory root.
299
+
300
+ Examples:
301
+ >>> schema.find_package('siliconcompiler')
302
+ Returns the path to the root of the siliconcompiler package.
303
+ """
304
+
305
+ if not self.valid("package", name):
306
+ raise ValueError(f"{name} is not a recognized source")
307
+
308
+ root = self.get("package", name, "root")
309
+ tag = self.get("package", name, "tag")
310
+
311
+ resolver = Resolver.find_resolver(root)
312
+ return resolver(name, self._parent(root=True), root, tag).get_path()
313
+
314
+ def __get_resolver_map(self):
315
+ """
316
+ Generate the resolver map got package handling for find_files and check_filepaths
317
+ """
318
+ schema_root = self._parent(root=True)
319
+ resolver_map = {}
320
+ for package in self.getkeys("package"):
321
+ root = self.get("package", package, "root")
322
+ tag = self.get("package", package, "tag")
323
+ resolver = Resolver.find_resolver(root)
324
+ resolver_map[package] = resolver(package, schema_root, root, tag).get_path
325
+ return resolver_map
326
+
327
+ def find_files(self, *keypath,
328
+ missing_ok=False,
329
+ step=None, index=None):
330
+ """
331
+ Returns absolute paths to files or directories based on the keypath
332
+ provided.
333
+
334
+ The keypath provided must point to a schema parameter of type file, dir,
335
+ or lists of either. Otherwise, it will trigger an error.
336
+
337
+ Args:
338
+ keypath (list of str): Variable length schema key list.
339
+ missing_ok (bool): If True, silently return None when files aren't
340
+ found. If False, print an error and set the error flag.
341
+ step (str): Step name to access for parameters that may be specified
342
+ on a per-node basis.
343
+ index (str): Index name to access for parameters that may be specified
344
+ on a per-node basis.
345
+
346
+ Returns:
347
+ If keys points to a scalar entry, returns an absolute path to that
348
+ file/directory, or None if not found. It keys points to a list
349
+ entry, returns a list of either the absolute paths or None for each
350
+ entry, depending on whether it is found.
351
+
352
+ Examples:
353
+ >>> schema.find_files('input', 'verilog')
354
+ Returns a list of absolute paths to source files, as specified in
355
+ the schema.
356
+ """
357
+ schema_root = self._parent(root=True)
358
+ cwd = getattr(schema_root, "cwd", os.getcwd())
359
+ collection_dir = getattr(schema_root, "collection_dir", None)
360
+ if collection_dir:
361
+ collection_dir = collection_dir()
362
+
363
+ return super().find_files(*keypath,
364
+ missing_ok=missing_ok,
365
+ step=step, index=index,
366
+ packages=self.__get_resolver_map(),
367
+ collection_dir=collection_dir,
368
+ cwd=cwd)
369
+
370
+ def check_filepaths(self, ignore_keys=None):
371
+ '''
372
+ Verifies that paths to all files in manifest are valid.
373
+
374
+ Args:
375
+ ignore_keys (list of keypaths): list of keypaths to ignore while checking
376
+
377
+ Returns:
378
+ True if all file paths are valid, otherwise False.
379
+ '''
380
+ schema_root = self._parent(root=True)
381
+ cwd = getattr(schema_root, "cwd", os.getcwd())
382
+ logger = getattr(schema_root, "logger", None)
383
+ collection_dir = getattr(schema_root, "collection_dir", None)
384
+ if collection_dir:
385
+ collection_dir = collection_dir()
386
+
387
+ return super().check_filepaths(
388
+ ignore_keys=ignore_keys,
389
+ logger=logger,
390
+ packages=self.__get_resolver_map(),
391
+ collection_dir=collection_dir,
392
+ cwd=cwd)