siliconcompiler 0.34.1__py3-none-any.whl → 0.34.3__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.
- siliconcompiler/__init__.py +23 -4
- siliconcompiler/__main__.py +1 -7
- siliconcompiler/_metadata.py +1 -1
- siliconcompiler/apps/_common.py +104 -23
- siliconcompiler/apps/sc.py +4 -8
- siliconcompiler/apps/sc_dashboard.py +6 -4
- siliconcompiler/apps/sc_install.py +10 -6
- siliconcompiler/apps/sc_issue.py +7 -5
- siliconcompiler/apps/sc_remote.py +1 -1
- siliconcompiler/apps/sc_server.py +9 -14
- siliconcompiler/apps/sc_show.py +7 -6
- siliconcompiler/apps/smake.py +130 -94
- siliconcompiler/apps/utils/replay.py +4 -7
- siliconcompiler/apps/utils/summarize.py +3 -5
- siliconcompiler/asic.py +420 -0
- siliconcompiler/checklist.py +25 -2
- siliconcompiler/cmdlineschema.py +534 -0
- siliconcompiler/constraints/__init__.py +17 -0
- siliconcompiler/constraints/asic_component.py +378 -0
- siliconcompiler/constraints/asic_floorplan.py +449 -0
- siliconcompiler/constraints/asic_pins.py +489 -0
- siliconcompiler/constraints/asic_timing.py +517 -0
- siliconcompiler/core.py +10 -35
- siliconcompiler/data/templates/tcl/manifest.tcl.j2 +8 -0
- siliconcompiler/dependencyschema.py +96 -202
- siliconcompiler/design.py +327 -241
- siliconcompiler/filesetschema.py +250 -0
- siliconcompiler/flowgraph.py +298 -106
- siliconcompiler/fpga.py +124 -1
- siliconcompiler/library.py +331 -0
- siliconcompiler/metric.py +327 -92
- siliconcompiler/metrics/__init__.py +7 -0
- siliconcompiler/metrics/asic.py +245 -0
- siliconcompiler/metrics/fpga.py +220 -0
- siliconcompiler/package/__init__.py +391 -67
- siliconcompiler/package/git.py +92 -16
- siliconcompiler/package/github.py +114 -22
- siliconcompiler/package/https.py +79 -16
- siliconcompiler/packageschema.py +341 -16
- siliconcompiler/pathschema.py +255 -0
- siliconcompiler/pdk.py +566 -1
- siliconcompiler/project.py +1460 -0
- siliconcompiler/record.py +38 -1
- siliconcompiler/remote/__init__.py +5 -2
- siliconcompiler/remote/client.py +11 -6
- siliconcompiler/remote/schema.py +5 -23
- siliconcompiler/remote/server.py +41 -54
- siliconcompiler/report/__init__.py +3 -3
- siliconcompiler/report/dashboard/__init__.py +48 -14
- siliconcompiler/report/dashboard/cli/__init__.py +99 -21
- siliconcompiler/report/dashboard/cli/board.py +364 -179
- siliconcompiler/report/dashboard/web/__init__.py +90 -12
- siliconcompiler/report/dashboard/web/components/__init__.py +219 -240
- siliconcompiler/report/dashboard/web/components/flowgraph.py +49 -26
- siliconcompiler/report/dashboard/web/components/graph.py +139 -100
- siliconcompiler/report/dashboard/web/layouts/__init__.py +29 -1
- siliconcompiler/report/dashboard/web/layouts/_common.py +38 -2
- siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph.py +39 -26
- siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph_node_tab.py +50 -50
- siliconcompiler/report/dashboard/web/layouts/vertical_flowgraph_sac_tabs.py +49 -46
- siliconcompiler/report/dashboard/web/state.py +141 -14
- siliconcompiler/report/dashboard/web/utils/__init__.py +79 -16
- siliconcompiler/report/dashboard/web/utils/file_utils.py +74 -11
- siliconcompiler/report/dashboard/web/viewer.py +25 -1
- siliconcompiler/report/report.py +5 -2
- siliconcompiler/report/summary_image.py +29 -11
- siliconcompiler/scheduler/__init__.py +9 -1
- siliconcompiler/scheduler/docker.py +81 -4
- siliconcompiler/scheduler/run_node.py +37 -20
- siliconcompiler/scheduler/scheduler.py +211 -36
- siliconcompiler/scheduler/schedulernode.py +394 -60
- siliconcompiler/scheduler/send_messages.py +77 -29
- siliconcompiler/scheduler/slurm.py +76 -12
- siliconcompiler/scheduler/taskscheduler.py +142 -21
- siliconcompiler/schema/__init__.py +0 -4
- siliconcompiler/schema/baseschema.py +338 -59
- siliconcompiler/schema/editableschema.py +14 -6
- siliconcompiler/schema/journal.py +28 -17
- siliconcompiler/schema/namedschema.py +22 -14
- siliconcompiler/schema/parameter.py +89 -28
- siliconcompiler/schema/parametertype.py +2 -0
- siliconcompiler/schema/parametervalue.py +258 -15
- siliconcompiler/schema/safeschema.py +25 -2
- siliconcompiler/schema/schema_cfg.py +23 -19
- siliconcompiler/schema/utils.py +2 -2
- siliconcompiler/schema_obj.py +24 -5
- siliconcompiler/tool.py +1131 -265
- siliconcompiler/tools/bambu/__init__.py +41 -0
- siliconcompiler/tools/builtin/concatenate.py +2 -2
- siliconcompiler/tools/builtin/minimum.py +2 -1
- siliconcompiler/tools/builtin/mux.py +2 -1
- siliconcompiler/tools/builtin/nop.py +2 -1
- siliconcompiler/tools/builtin/verify.py +2 -1
- siliconcompiler/tools/klayout/__init__.py +95 -0
- siliconcompiler/tools/openroad/__init__.py +289 -0
- siliconcompiler/tools/openroad/scripts/apr/preamble.tcl +3 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_detailed_route.tcl +7 -2
- siliconcompiler/tools/openroad/scripts/apr/sc_global_route.tcl +8 -4
- siliconcompiler/tools/openroad/scripts/apr/sc_init_floorplan.tcl +9 -5
- siliconcompiler/tools/openroad/scripts/common/write_images.tcl +5 -1
- siliconcompiler/tools/slang/__init__.py +1 -1
- siliconcompiler/tools/slang/elaborate.py +2 -1
- siliconcompiler/tools/vivado/scripts/sc_run.tcl +1 -1
- siliconcompiler/tools/vivado/scripts/sc_syn_fpga.tcl +8 -1
- siliconcompiler/tools/vivado/syn_fpga.py +6 -0
- siliconcompiler/tools/vivado/vivado.py +35 -2
- siliconcompiler/tools/vpr/__init__.py +150 -0
- siliconcompiler/tools/yosys/__init__.py +369 -1
- siliconcompiler/tools/yosys/scripts/procs.tcl +0 -1
- siliconcompiler/toolscripts/_tools.json +5 -10
- siliconcompiler/utils/__init__.py +66 -0
- siliconcompiler/utils/flowgraph.py +2 -2
- siliconcompiler/utils/issue.py +2 -1
- siliconcompiler/utils/logging.py +14 -0
- siliconcompiler/utils/multiprocessing.py +256 -0
- siliconcompiler/utils/showtools.py +10 -0
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/METADATA +6 -6
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/RECORD +122 -115
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/entry_points.txt +3 -0
- siliconcompiler/schema/cmdlineschema.py +0 -250
- siliconcompiler/schema/packageschema.py +0 -101
- siliconcompiler/toolscripts/rhel8/install-slang.sh +0 -40
- siliconcompiler/toolscripts/rhel9/install-slang.sh +0 -40
- siliconcompiler/toolscripts/ubuntu20/install-slang.sh +0 -47
- siliconcompiler/toolscripts/ubuntu22/install-slang.sh +0 -37
- siliconcompiler/toolscripts/ubuntu24/install-slang.sh +0 -37
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/WHEEL +0 -0
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/licenses/LICENSE +0 -0
- {siliconcompiler-0.34.1.dist-info → siliconcompiler-0.34.3.dist-info}/top_level.txt +0 -0
|
@@ -83,11 +83,24 @@ class NodeListValue:
|
|
|
83
83
|
field (str): name of schema field.
|
|
84
84
|
"""
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
if self.__values:
|
|
87
|
+
vals = []
|
|
88
|
+
for val in self.__values:
|
|
89
|
+
vals.append(val.get(field=field))
|
|
90
|
+
return vals
|
|
91
|
+
if self.__base.get("value") is None:
|
|
92
|
+
return []
|
|
93
|
+
|
|
94
|
+
return [self.__base.get(field=field)]
|
|
95
|
+
|
|
96
|
+
def gettcl(self):
|
|
97
|
+
"""
|
|
98
|
+
Returns the tcl representation for the value
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
field (str): name of schema field.
|
|
102
|
+
"""
|
|
103
|
+
return NodeType.to_tcl(self.get(), self.type)
|
|
91
104
|
|
|
92
105
|
def set(self, value, field='value'):
|
|
93
106
|
"""
|
|
@@ -150,6 +163,16 @@ class NodeListValue:
|
|
|
150
163
|
"""
|
|
151
164
|
return self.__base.fields
|
|
152
165
|
|
|
166
|
+
@property
|
|
167
|
+
def has_value(self):
|
|
168
|
+
"""
|
|
169
|
+
Returns true if this node has a value.
|
|
170
|
+
"""
|
|
171
|
+
if self.__values:
|
|
172
|
+
return True
|
|
173
|
+
else:
|
|
174
|
+
return False
|
|
175
|
+
|
|
153
176
|
@property
|
|
154
177
|
def values(self):
|
|
155
178
|
'''
|
|
@@ -178,6 +201,204 @@ class NodeListValue:
|
|
|
178
201
|
return [self.__base.type]
|
|
179
202
|
|
|
180
203
|
|
|
204
|
+
class NodeSetValue:
|
|
205
|
+
'''
|
|
206
|
+
Holds the data for a set schema type.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
base (:class:`NodeValue`): base type for this set.
|
|
210
|
+
'''
|
|
211
|
+
|
|
212
|
+
def __init__(self, base):
|
|
213
|
+
self.__base = base
|
|
214
|
+
self.__values = []
|
|
215
|
+
|
|
216
|
+
def getdict(self):
|
|
217
|
+
"""
|
|
218
|
+
Returns a schema dictionary.
|
|
219
|
+
|
|
220
|
+
Examples:
|
|
221
|
+
>>> value.getdict()
|
|
222
|
+
Returns the complete dictionary for the value
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
manifest = {}
|
|
226
|
+
for field in self.fields:
|
|
227
|
+
if field is None:
|
|
228
|
+
continue
|
|
229
|
+
|
|
230
|
+
value = self.get(field=field, ordered=True)
|
|
231
|
+
manifest.setdefault(field, []).extend(value)
|
|
232
|
+
|
|
233
|
+
if field == "author":
|
|
234
|
+
tmplist = []
|
|
235
|
+
for a in manifest[field]:
|
|
236
|
+
tmplist.extend(a)
|
|
237
|
+
manifest[field] = tmplist
|
|
238
|
+
return manifest
|
|
239
|
+
|
|
240
|
+
def _from_dict(self, manifest, keypath, version):
|
|
241
|
+
'''
|
|
242
|
+
Create a new value based on the provided dictionary.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
manifest (dict): Manifest to decide.
|
|
246
|
+
keypath (list of str): Path to the current keypath.
|
|
247
|
+
version (packaging.Version): Version of the dictionary schema
|
|
248
|
+
sctype (str): schema type for this value
|
|
249
|
+
'''
|
|
250
|
+
|
|
251
|
+
self.__values.clear()
|
|
252
|
+
for n in range(len(manifest["value"])):
|
|
253
|
+
param = self.__base.copy()
|
|
254
|
+
self.__values.append(param)
|
|
255
|
+
|
|
256
|
+
for field in self.fields:
|
|
257
|
+
if field is None:
|
|
258
|
+
continue
|
|
259
|
+
|
|
260
|
+
if len(manifest[field]) <= n:
|
|
261
|
+
continue
|
|
262
|
+
param.set(manifest[field][n], field=field)
|
|
263
|
+
|
|
264
|
+
def get(self, field='value', ordered: bool = False):
|
|
265
|
+
"""
|
|
266
|
+
Returns the value in the specified field
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
field (str): name of schema field.
|
|
270
|
+
ordered (bool): if true, returns a list instead of set for values
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
vals = []
|
|
274
|
+
|
|
275
|
+
if self.__values:
|
|
276
|
+
for val in self.__values:
|
|
277
|
+
vals.append(val.get(field=field))
|
|
278
|
+
elif self.__base.get("value") is None:
|
|
279
|
+
pass
|
|
280
|
+
else:
|
|
281
|
+
vals.append(self.__base.get(field=field))
|
|
282
|
+
|
|
283
|
+
if not ordered and field == "value":
|
|
284
|
+
return set(vals)
|
|
285
|
+
return vals
|
|
286
|
+
|
|
287
|
+
def gettcl(self):
|
|
288
|
+
"""
|
|
289
|
+
Returns the tcl representation for the value
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
field (str): name of schema field.
|
|
293
|
+
"""
|
|
294
|
+
return NodeType.to_tcl(self.get(ordered=True), [self.__base.type])
|
|
295
|
+
|
|
296
|
+
def set(self, value, field='value'):
|
|
297
|
+
value = NodeType.normalize(value, [self.__base.type])
|
|
298
|
+
|
|
299
|
+
if field == 'value':
|
|
300
|
+
self.__values.clear()
|
|
301
|
+
else:
|
|
302
|
+
if len(value) != len(self.__values):
|
|
303
|
+
raise ValueError(f"set on {field} field must match number of values")
|
|
304
|
+
|
|
305
|
+
current_values = []
|
|
306
|
+
if field == "value":
|
|
307
|
+
current_values = [v.get() for v in self.__values]
|
|
308
|
+
|
|
309
|
+
modified = list()
|
|
310
|
+
m = 0
|
|
311
|
+
for n in range(len(value)):
|
|
312
|
+
if field == 'value':
|
|
313
|
+
if value[n] in current_values:
|
|
314
|
+
continue
|
|
315
|
+
|
|
316
|
+
self.__values.append(self.__base.copy())
|
|
317
|
+
current_values.append(value[n])
|
|
318
|
+
self.__values[m].set(value[n], field=field)
|
|
319
|
+
modified.append(self.__values[m])
|
|
320
|
+
m += 1
|
|
321
|
+
return tuple(modified)
|
|
322
|
+
|
|
323
|
+
def add(self, value, field='value'):
|
|
324
|
+
"""
|
|
325
|
+
Adds the value in a specific field and ensures it has been normalized.
|
|
326
|
+
|
|
327
|
+
Returns:
|
|
328
|
+
tuple of modified values
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
value (any): value to set
|
|
332
|
+
field (str): field to set
|
|
333
|
+
"""
|
|
334
|
+
|
|
335
|
+
current_values = []
|
|
336
|
+
if field == "value":
|
|
337
|
+
current_values = [v.get() for v in self.__values]
|
|
338
|
+
|
|
339
|
+
modified = list()
|
|
340
|
+
if field == 'value':
|
|
341
|
+
value = NodeType.normalize(value, [self.__base.type])
|
|
342
|
+
|
|
343
|
+
for n in range(len(value)):
|
|
344
|
+
if value[n] in current_values:
|
|
345
|
+
continue
|
|
346
|
+
|
|
347
|
+
self.__values.append(self.__base.copy())
|
|
348
|
+
self.__values[-1].set(value[n], field=field)
|
|
349
|
+
current_values.append(value[n])
|
|
350
|
+
modified.append(self.__values[-1])
|
|
351
|
+
else:
|
|
352
|
+
for val in self.__values:
|
|
353
|
+
val.add(value, field=field)
|
|
354
|
+
modified.append(val)
|
|
355
|
+
return tuple(modified)
|
|
356
|
+
|
|
357
|
+
@property
|
|
358
|
+
def has_value(self):
|
|
359
|
+
"""
|
|
360
|
+
Returns true if this node has a value.
|
|
361
|
+
"""
|
|
362
|
+
if self.__values:
|
|
363
|
+
return True
|
|
364
|
+
else:
|
|
365
|
+
return False
|
|
366
|
+
|
|
367
|
+
@property
|
|
368
|
+
def fields(self):
|
|
369
|
+
"""
|
|
370
|
+
Returns a list of valid fields for this value
|
|
371
|
+
"""
|
|
372
|
+
return self.__base.fields
|
|
373
|
+
|
|
374
|
+
@property
|
|
375
|
+
def values(self):
|
|
376
|
+
'''
|
|
377
|
+
Returns a copy of the values stored in the list
|
|
378
|
+
'''
|
|
379
|
+
return self.__values.copy()
|
|
380
|
+
|
|
381
|
+
def copy(self):
|
|
382
|
+
"""
|
|
383
|
+
Returns a copy of this value.
|
|
384
|
+
"""
|
|
385
|
+
|
|
386
|
+
return copy.deepcopy(self)
|
|
387
|
+
|
|
388
|
+
def _set_type(self, sctype):
|
|
389
|
+
sctype = NodeType.parse(sctype)[0]
|
|
390
|
+
self.__base._set_type(sctype)
|
|
391
|
+
for val in self.__values:
|
|
392
|
+
val._set_type(sctype)
|
|
393
|
+
|
|
394
|
+
@property
|
|
395
|
+
def type(self):
|
|
396
|
+
"""
|
|
397
|
+
Returns the type for this value
|
|
398
|
+
"""
|
|
399
|
+
return set([self.__base.type])
|
|
400
|
+
|
|
401
|
+
|
|
181
402
|
class NodeValue:
|
|
182
403
|
'''
|
|
183
404
|
Holds the data for a parameter.
|
|
@@ -251,6 +472,15 @@ class NodeValue:
|
|
|
251
472
|
return self.__signature
|
|
252
473
|
raise ValueError(f"{field} is not a valid field")
|
|
253
474
|
|
|
475
|
+
def gettcl(self):
|
|
476
|
+
"""
|
|
477
|
+
Returns the tcl representation for the value
|
|
478
|
+
|
|
479
|
+
Args:
|
|
480
|
+
field (str): name of schema field.
|
|
481
|
+
"""
|
|
482
|
+
return NodeType.to_tcl(self.get(), self.__type)
|
|
483
|
+
|
|
254
484
|
def set(self, value, field='value'):
|
|
255
485
|
"""
|
|
256
486
|
Sets the value in a specific field and ensures it has been normalized.
|
|
@@ -276,6 +506,19 @@ class NodeValue:
|
|
|
276
506
|
"""
|
|
277
507
|
raise ValueError(f"cannot add to {field} field")
|
|
278
508
|
|
|
509
|
+
@property
|
|
510
|
+
def has_value(self):
|
|
511
|
+
"""
|
|
512
|
+
Returns true if this node has a value.
|
|
513
|
+
"""
|
|
514
|
+
if isinstance(self.__type, (set, tuple, list)):
|
|
515
|
+
return bool(self.__value)
|
|
516
|
+
|
|
517
|
+
if self.__value is not None:
|
|
518
|
+
return True
|
|
519
|
+
else:
|
|
520
|
+
return False
|
|
521
|
+
|
|
279
522
|
@property
|
|
280
523
|
def fields(self):
|
|
281
524
|
"""
|
|
@@ -375,10 +618,10 @@ class PathNodeValue(NodeValue):
|
|
|
375
618
|
value (any): default value for this parameter
|
|
376
619
|
'''
|
|
377
620
|
|
|
378
|
-
def __init__(self, type, value=None):
|
|
621
|
+
def __init__(self, type, value=None, package=None):
|
|
379
622
|
super().__init__(type, value=value)
|
|
380
623
|
self.__filehash = None
|
|
381
|
-
self.__package =
|
|
624
|
+
self.__package = package
|
|
382
625
|
|
|
383
626
|
def getdict(self):
|
|
384
627
|
return {
|
|
@@ -439,7 +682,7 @@ class PathNodeValue(NodeValue):
|
|
|
439
682
|
|
|
440
683
|
return None
|
|
441
684
|
|
|
442
|
-
def resolve_path(self, search=None, collection_dir=None):
|
|
685
|
+
def resolve_path(self, search=None, collection_dir=None) -> str:
|
|
443
686
|
"""
|
|
444
687
|
Resolve the path of this value.
|
|
445
688
|
|
|
@@ -457,10 +700,10 @@ class PathNodeValue(NodeValue):
|
|
|
457
700
|
if collection_dir:
|
|
458
701
|
collect_path = self.__resolve_collection_path(value, collection_dir)
|
|
459
702
|
if collect_path:
|
|
460
|
-
return collect_path
|
|
703
|
+
return str(pathlib.Path(collect_path))
|
|
461
704
|
|
|
462
705
|
if os.path.isabs(value) and os.path.exists(value):
|
|
463
|
-
return value
|
|
706
|
+
return str(pathlib.Path(value))
|
|
464
707
|
|
|
465
708
|
# Search for file
|
|
466
709
|
if search is None:
|
|
@@ -469,7 +712,7 @@ class PathNodeValue(NodeValue):
|
|
|
469
712
|
for searchdir in search:
|
|
470
713
|
abspath = os.path.abspath(os.path.join(searchdir, value))
|
|
471
714
|
if os.path.exists(abspath):
|
|
472
|
-
return abspath
|
|
715
|
+
return str(pathlib.Path(abspath))
|
|
473
716
|
|
|
474
717
|
# File not found
|
|
475
718
|
raise FileNotFoundError(value)
|
|
@@ -603,8 +846,8 @@ class DirectoryNodeValue(PathNodeValue):
|
|
|
603
846
|
value (any): default value for this parameter
|
|
604
847
|
'''
|
|
605
848
|
|
|
606
|
-
def __init__(self, value=None):
|
|
607
|
-
super().__init__("dir", value=value)
|
|
849
|
+
def __init__(self, value=None, package=None):
|
|
850
|
+
super().__init__("dir", value=value, package=package)
|
|
608
851
|
|
|
609
852
|
def hash(self, function, **kwargs):
|
|
610
853
|
"""
|
|
@@ -631,8 +874,8 @@ class FileNodeValue(PathNodeValue):
|
|
|
631
874
|
value (any): default value for this parameter
|
|
632
875
|
'''
|
|
633
876
|
|
|
634
|
-
def __init__(self, value=None):
|
|
635
|
-
super().__init__("file", value=value)
|
|
877
|
+
def __init__(self, value=None, package=None):
|
|
878
|
+
super().__init__("file", value=value, package=package)
|
|
636
879
|
self.__date = None
|
|
637
880
|
self.__author = []
|
|
638
881
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# SC dependencies outside of its directory, since it may be used by tool drivers
|
|
5
5
|
# that have isolated Python environments.
|
|
6
6
|
|
|
7
|
+
from typing import Dict, Tuple
|
|
8
|
+
|
|
7
9
|
from .parameter import Parameter
|
|
8
10
|
from .baseschema import BaseSchema
|
|
9
11
|
|
|
@@ -15,16 +17,27 @@ class SafeSchema(BaseSchema):
|
|
|
15
17
|
'''
|
|
16
18
|
|
|
17
19
|
@staticmethod
|
|
18
|
-
def __is_dict_leaf(manifest, keypath, version):
|
|
20
|
+
def __is_dict_leaf(manifest: Dict, keypath: Tuple[str], version: str) -> Parameter:
|
|
19
21
|
try:
|
|
20
22
|
return Parameter.from_dict(manifest, keypath, version)
|
|
21
23
|
except: # noqa E722
|
|
22
24
|
return None
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
@classmethod
|
|
27
|
+
def _getdict_type(cls) -> str:
|
|
28
|
+
"""
|
|
29
|
+
Returns the meta data for getdict
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
return "SafeSchema"
|
|
33
|
+
|
|
34
|
+
def _from_dict(self, manifest: Dict, keypath: Tuple[str], version: str = None) -> None:
|
|
25
35
|
if not isinstance(manifest, dict):
|
|
26
36
|
return
|
|
27
37
|
|
|
38
|
+
if "__meta__" in manifest:
|
|
39
|
+
del manifest["__meta__"]
|
|
40
|
+
|
|
28
41
|
for key, data in manifest.items():
|
|
29
42
|
obj = SafeSchema.__is_dict_leaf(data, keypath + [key], version)
|
|
30
43
|
if not obj:
|
|
@@ -35,3 +48,13 @@ class SafeSchema(BaseSchema):
|
|
|
35
48
|
self._BaseSchema__default = obj
|
|
36
49
|
else:
|
|
37
50
|
self._BaseSchema__manifest[key] = obj
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_manifest(cls, filepath: str = None, cfg: Dict = None) -> "SafeSchema":
|
|
54
|
+
if filepath:
|
|
55
|
+
cfg = BaseSchema._read_manifest(filepath)
|
|
56
|
+
|
|
57
|
+
if cfg and "__meta__" in cfg:
|
|
58
|
+
del cfg["__meta__"]
|
|
59
|
+
|
|
60
|
+
return super().from_manifest(filepath=None, cfg=cfg)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from . import EditableSchema, Parameter, Scope, PerNode
|
|
4
4
|
from .utils import trim
|
|
5
5
|
|
|
6
|
-
SCHEMA_VERSION = '0.51.
|
|
6
|
+
SCHEMA_VERSION = '0.51.5'
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
#############################################################################
|
|
@@ -59,16 +59,7 @@ def schema_cfg(schema):
|
|
|
59
59
|
# Basic schema setup
|
|
60
60
|
cfg = EditableSchema(schema)
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
sctype='str',
|
|
64
|
-
scope=Scope.GLOBAL,
|
|
65
|
-
defvalue=SCHEMA_VERSION,
|
|
66
|
-
require=True,
|
|
67
|
-
shorthelp="Schema version number",
|
|
68
|
-
lock=True,
|
|
69
|
-
switch="-schemaversion <str>",
|
|
70
|
-
example=["api: chip.get('schemaversion')"],
|
|
71
|
-
schelp="""SiliconCompiler schema version number.""")
|
|
62
|
+
schema_version(cfg)
|
|
72
63
|
|
|
73
64
|
# Design topmodule/entrypoint
|
|
74
65
|
scparam(cfg, ['design'],
|
|
@@ -139,6 +130,19 @@ def schema_cfg(schema):
|
|
|
139
130
|
cfg = schema_schematic(cfg)
|
|
140
131
|
|
|
141
132
|
|
|
133
|
+
def schema_version(cfg):
|
|
134
|
+
scparam(cfg, ['schemaversion'],
|
|
135
|
+
sctype='str',
|
|
136
|
+
scope=Scope.GLOBAL,
|
|
137
|
+
defvalue=SCHEMA_VERSION,
|
|
138
|
+
require=True,
|
|
139
|
+
shorthelp="Schema version number",
|
|
140
|
+
lock=True,
|
|
141
|
+
switch="-schemaversion <str>",
|
|
142
|
+
example=["api: chip.get('schemaversion')"],
|
|
143
|
+
schelp="""SiliconCompiler schema version number.""")
|
|
144
|
+
|
|
145
|
+
|
|
142
146
|
###############################################################################
|
|
143
147
|
# SCHEMATIC
|
|
144
148
|
###############################################################################
|
|
@@ -204,8 +208,8 @@ def schema_schematic(cfg):
|
|
|
204
208
|
# FPGA
|
|
205
209
|
###############################################################################
|
|
206
210
|
def schema_fpga(cfg):
|
|
207
|
-
from siliconcompiler.fpga import
|
|
208
|
-
cfg.insert("fpga",
|
|
211
|
+
from siliconcompiler.fpga import FPGASchemaTmp
|
|
212
|
+
cfg.insert("fpga", FPGASchemaTmp())
|
|
209
213
|
return cfg
|
|
210
214
|
|
|
211
215
|
|
|
@@ -213,8 +217,8 @@ def schema_fpga(cfg):
|
|
|
213
217
|
# PDK
|
|
214
218
|
###############################################################################
|
|
215
219
|
def schema_pdk(cfg):
|
|
216
|
-
from siliconcompiler.pdk import
|
|
217
|
-
cfg.insert("pdk", "default",
|
|
220
|
+
from siliconcompiler.pdk import PDKSchemaTmp
|
|
221
|
+
cfg.insert("pdk", "default", PDKSchemaTmp())
|
|
218
222
|
return cfg
|
|
219
223
|
|
|
220
224
|
|
|
@@ -1071,8 +1075,8 @@ def schema_arg(cfg):
|
|
|
1071
1075
|
# Metrics to Track
|
|
1072
1076
|
###########################################################################
|
|
1073
1077
|
def schema_metric(cfg):
|
|
1074
|
-
from siliconcompiler.metric import
|
|
1075
|
-
cfg.insert("metric",
|
|
1078
|
+
from siliconcompiler.metric import MetricSchemaTmp
|
|
1079
|
+
cfg.insert("metric", MetricSchemaTmp())
|
|
1076
1080
|
return cfg
|
|
1077
1081
|
|
|
1078
1082
|
|
|
@@ -1773,8 +1777,8 @@ def schema_option_frontend(cfg):
|
|
|
1773
1777
|
# Package information
|
|
1774
1778
|
############################################
|
|
1775
1779
|
def schema_package(cfg):
|
|
1776
|
-
from siliconcompiler.packageschema import
|
|
1777
|
-
cfg.insert("package",
|
|
1780
|
+
from siliconcompiler.packageschema import PackageSchemaTmp
|
|
1781
|
+
cfg.insert("package", PackageSchemaTmp())
|
|
1778
1782
|
return cfg
|
|
1779
1783
|
|
|
1780
1784
|
|
siliconcompiler/schema/utils.py
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import sys
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def trim(docstring):
|
|
10
|
+
def trim(docstring: str) -> str:
|
|
11
11
|
'''
|
|
12
12
|
Helper function for cleaning up indentation of docstring.
|
|
13
13
|
|
|
@@ -42,7 +42,7 @@ def trim(docstring):
|
|
|
42
42
|
return '\n'.join(trimmed)
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
def translate_loglevel(level):
|
|
45
|
+
def translate_loglevel(level: str) -> str:
|
|
46
46
|
if level == "quiet":
|
|
47
47
|
level = "error"
|
|
48
48
|
return level.upper()
|
siliconcompiler/schema_obj.py
CHANGED
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
from siliconcompiler.schema import BaseSchema
|
|
8
8
|
from siliconcompiler.schema import SafeSchema
|
|
9
9
|
from siliconcompiler.schema import EditableSchema
|
|
10
|
-
from siliconcompiler.
|
|
10
|
+
from siliconcompiler.cmdlineschema import CommandLineSchemaTmp
|
|
11
11
|
from siliconcompiler.schema import Parameter
|
|
12
|
-
from siliconcompiler.schema.baseschema import json
|
|
13
12
|
|
|
14
13
|
from siliconcompiler.schema.schema_cfg import schema_cfg
|
|
15
14
|
|
|
@@ -39,8 +38,16 @@ class Schema(BaseSchema):
|
|
|
39
38
|
|
|
40
39
|
return super()._from_dict(manifest, keypath, version=version)
|
|
41
40
|
|
|
41
|
+
@classmethod
|
|
42
|
+
def _getdict_type(cls) -> str:
|
|
43
|
+
"""
|
|
44
|
+
Returns the meta data for getdict
|
|
45
|
+
"""
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
return Schema.__name__
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class SchemaTmp(Schema, CommandLineSchemaTmp):
|
|
44
51
|
"""Object for storing and accessing configuration values corresponding to
|
|
45
52
|
the SiliconCompiler schema.
|
|
46
53
|
|
|
@@ -85,6 +92,9 @@ class SchemaTmp(Schema, CommandLineSchema):
|
|
|
85
92
|
|
|
86
93
|
super()._from_dict(manifest, keypath, version=version)
|
|
87
94
|
|
|
95
|
+
def _find_files_dataroot_resolvers(self):
|
|
96
|
+
return self.get("package", field="schema").get_resolvers()
|
|
97
|
+
|
|
88
98
|
def record_history(self):
|
|
89
99
|
'''
|
|
90
100
|
Copies all non-empty parameters from current job into the history
|
|
@@ -111,9 +121,18 @@ class SchemaTmp(Schema, CommandLineSchema):
|
|
|
111
121
|
EditableSchema(self).insert("history", job, blank)
|
|
112
122
|
return blank
|
|
113
123
|
|
|
124
|
+
@classmethod
|
|
125
|
+
def _getdict_type(cls) -> str:
|
|
126
|
+
"""
|
|
127
|
+
Returns the meta data for getdict
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
return SchemaTmp.__name__
|
|
131
|
+
|
|
114
132
|
|
|
115
133
|
##############################################################################
|
|
116
134
|
# Main routine
|
|
117
135
|
if __name__ == "__main__":
|
|
118
|
-
import json
|
|
119
|
-
|
|
136
|
+
import json
|
|
137
|
+
from siliconcompiler import Schema
|
|
138
|
+
print(json.dumps(Schema().getdict(), indent=4, sort_keys=True))
|