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
|
@@ -4,9 +4,6 @@ from siliconcompiler.schema.baseschema import BaseSchema
|
|
|
4
4
|
from siliconcompiler.schema.editableschema import EditableSchema
|
|
5
5
|
from siliconcompiler.schema.parameter import Parameter, Scope
|
|
6
6
|
from siliconcompiler.schema.namedschema import NamedSchema
|
|
7
|
-
from siliconcompiler.schema.utils import trim
|
|
8
|
-
|
|
9
|
-
from siliconcompiler.package import Resolver
|
|
10
7
|
|
|
11
8
|
|
|
12
9
|
class DependencySchema(BaseSchema):
|
|
@@ -15,9 +12,10 @@ class DependencySchema(BaseSchema):
|
|
|
15
12
|
'''
|
|
16
13
|
|
|
17
14
|
def __init__(self):
|
|
15
|
+
'''Initializes the DependencySchema.'''
|
|
18
16
|
super().__init__()
|
|
19
17
|
|
|
20
|
-
self.
|
|
18
|
+
self._reset_deps()
|
|
21
19
|
|
|
22
20
|
schema = EditableSchema(self)
|
|
23
21
|
schema.insert(
|
|
@@ -26,51 +24,24 @@ class DependencySchema(BaseSchema):
|
|
|
26
24
|
'[str]',
|
|
27
25
|
scope=Scope.GLOBAL,
|
|
28
26
|
lock=True,
|
|
29
|
-
shorthelp="List of dependencies",
|
|
27
|
+
shorthelp="List of object dependencies",
|
|
30
28
|
help="List of named object dependencies included via add_dep()."))
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
""")))
|
|
30
|
+
def _from_dict(self, manifest, keypath, version=None):
|
|
31
|
+
'''
|
|
32
|
+
Internal helper to load schema from a dictionary manifest.
|
|
57
33
|
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
""")))
|
|
34
|
+
This method temporarily unlocks the 'deps' parameter to allow it to be
|
|
35
|
+
populated from the manifest data.
|
|
72
36
|
|
|
73
|
-
|
|
37
|
+
Args:
|
|
38
|
+
manifest (dict): The dictionary to load data from.
|
|
39
|
+
keypath (list): The list of keys representing the path to the data.
|
|
40
|
+
version (str, optional): The schema version. Defaults to None.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
The result of the parent class's _from_dict method.
|
|
44
|
+
'''
|
|
74
45
|
self.set("deps", False, field="lock")
|
|
75
46
|
ret = super()._from_dict(manifest, keypath, version)
|
|
76
47
|
self.set("deps", True, field="lock")
|
|
@@ -81,9 +52,9 @@ class DependencySchema(BaseSchema):
|
|
|
81
52
|
Adds a module to this object.
|
|
82
53
|
|
|
83
54
|
Args:
|
|
84
|
-
obj (:class:`NamedSchema`): Module to add
|
|
55
|
+
obj (:class:`NamedSchema`): Module to add.
|
|
85
56
|
clobber (bool): If true will insert the object and overwrite any
|
|
86
|
-
existing with the same name
|
|
57
|
+
existing with the same name.
|
|
87
58
|
|
|
88
59
|
Returns:
|
|
89
60
|
True if object was imported, otherwise false.
|
|
@@ -92,16 +63,18 @@ class DependencySchema(BaseSchema):
|
|
|
92
63
|
if not isinstance(obj, NamedSchema):
|
|
93
64
|
raise TypeError(f"Cannot add an object of type: {type(obj)}")
|
|
94
65
|
|
|
95
|
-
if not clobber and obj.name
|
|
66
|
+
if not clobber and obj.name in self.__deps:
|
|
96
67
|
return False
|
|
97
68
|
|
|
98
|
-
if obj.name
|
|
69
|
+
if obj.name is None:
|
|
70
|
+
raise ValueError("Cannot add an unnamed dependency")
|
|
71
|
+
|
|
72
|
+
if not self.has_dep(obj):
|
|
99
73
|
self.set("deps", False, field="lock")
|
|
100
|
-
self.add("deps", obj.name
|
|
74
|
+
self.add("deps", obj.name)
|
|
101
75
|
self.set("deps", True, field="lock")
|
|
102
76
|
|
|
103
|
-
self.__deps[obj.name
|
|
104
|
-
obj._reset()
|
|
77
|
+
self.__deps[obj.name] = obj
|
|
105
78
|
|
|
106
79
|
return True
|
|
107
80
|
|
|
@@ -114,12 +87,12 @@ class DependencySchema(BaseSchema):
|
|
|
114
87
|
Renders and saves the dependency graph to a file.
|
|
115
88
|
|
|
116
89
|
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
|
|
90
|
+
filename (filepath): Output filepath.
|
|
91
|
+
fontcolor (str): Node font RGB color hex value.
|
|
92
|
+
background (str): Background color.
|
|
93
|
+
fontsize (str): Node text font size.
|
|
94
|
+
border (bool): Enables node border if True.
|
|
95
|
+
landscape (bool): Renders graph in landscape layout if True.
|
|
123
96
|
|
|
124
97
|
Examples:
|
|
125
98
|
>>> schema.write_depgraph('mydump.png')
|
|
@@ -148,11 +121,11 @@ class DependencySchema(BaseSchema):
|
|
|
148
121
|
dot.attr(bgcolor=background)
|
|
149
122
|
|
|
150
123
|
def make_label(dep):
|
|
151
|
-
return f"lib-{dep.name
|
|
124
|
+
return f"lib-{dep.name}"
|
|
152
125
|
|
|
153
126
|
nodes = {
|
|
154
|
-
self.name
|
|
155
|
-
"text": self.name
|
|
127
|
+
self.name: {
|
|
128
|
+
"text": self.name,
|
|
156
129
|
"shape": "box",
|
|
157
130
|
"color": background,
|
|
158
131
|
"connects_to": set([make_label(subdep) for subdep in self.__deps.values()])
|
|
@@ -160,7 +133,7 @@ class DependencySchema(BaseSchema):
|
|
|
160
133
|
}
|
|
161
134
|
for dep in self.get_dep():
|
|
162
135
|
nodes[make_label(dep)] = {
|
|
163
|
-
"text": dep.name
|
|
136
|
+
"text": dep.name,
|
|
164
137
|
"shape": "oval",
|
|
165
138
|
"color": background,
|
|
166
139
|
"connects_to": set([make_label(subdep) for subdep in dep.__deps.values()])
|
|
@@ -181,16 +154,25 @@ class DependencySchema(BaseSchema):
|
|
|
181
154
|
|
|
182
155
|
def __get_all_deps(self, seen: set) -> list:
|
|
183
156
|
'''
|
|
184
|
-
|
|
157
|
+
Recursively traverses the dependency tree to generate a flat list.
|
|
158
|
+
|
|
159
|
+
This method avoids cycles and duplicate entries by keeping track of
|
|
160
|
+
visited nodes in the 'seen' set.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
seen (set): A set of dependency names that have already been visited.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
list: A flat list of all dependency objects.
|
|
185
167
|
'''
|
|
186
168
|
deps = []
|
|
187
169
|
|
|
188
170
|
for obj in self.__deps.values():
|
|
189
|
-
if obj.name
|
|
171
|
+
if obj.name in seen:
|
|
190
172
|
continue
|
|
191
173
|
|
|
192
174
|
deps.append(obj)
|
|
193
|
-
seen.add(obj.name
|
|
175
|
+
seen.add(obj.name)
|
|
194
176
|
|
|
195
177
|
if not isinstance(obj, DependencySchema):
|
|
196
178
|
# nothing to iterate over
|
|
@@ -198,7 +180,7 @@ class DependencySchema(BaseSchema):
|
|
|
198
180
|
|
|
199
181
|
for obj_dep in obj.__get_all_deps(seen):
|
|
200
182
|
deps.append(obj_dep)
|
|
201
|
-
seen.add(obj_dep.name
|
|
183
|
+
seen.add(obj_dep.name)
|
|
202
184
|
|
|
203
185
|
return deps
|
|
204
186
|
|
|
@@ -207,16 +189,25 @@ class DependencySchema(BaseSchema):
|
|
|
207
189
|
Returns all dependencies associated with this object or a specific one if requested.
|
|
208
190
|
|
|
209
191
|
Raises:
|
|
210
|
-
KeyError: if the
|
|
192
|
+
KeyError: if the specific module is requested but not found.
|
|
211
193
|
|
|
212
194
|
Args:
|
|
213
|
-
name (str):
|
|
214
|
-
hierarchy (bool):
|
|
215
|
-
otherwise only this
|
|
195
|
+
name (str): Name of the module.
|
|
196
|
+
hierarchy (bool): If True, will return all modules including children,
|
|
197
|
+
otherwise only this object's modules are returned.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
list: A list of dependency objects.
|
|
216
201
|
'''
|
|
217
202
|
|
|
218
203
|
if name:
|
|
219
|
-
if
|
|
204
|
+
if not self.has_dep(name):
|
|
205
|
+
if "." in name:
|
|
206
|
+
name0, *name1 = name.split(".")
|
|
207
|
+
subdep = self.get_dep(name0)
|
|
208
|
+
if isinstance(subdep, DependencySchema):
|
|
209
|
+
return subdep.get_dep(".".join(name1))
|
|
210
|
+
raise KeyError(f"{name} does not contain dependency information")
|
|
220
211
|
raise KeyError(f"{name} is not an imported module")
|
|
221
212
|
|
|
222
213
|
return self.__deps[name]
|
|
@@ -225,19 +216,38 @@ class DependencySchema(BaseSchema):
|
|
|
225
216
|
return self.__get_all_deps(set())
|
|
226
217
|
return list(self.__deps.values())
|
|
227
218
|
|
|
219
|
+
def has_dep(self, name: str) -> bool:
|
|
220
|
+
'''
|
|
221
|
+
Checks if a specific dependency is present.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
name (str): Name of the module.
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
True if the module was found, False otherwise.
|
|
228
|
+
'''
|
|
229
|
+
|
|
230
|
+
if isinstance(name, NamedSchema):
|
|
231
|
+
name = name.name
|
|
232
|
+
|
|
233
|
+
return name in self.__deps
|
|
234
|
+
|
|
228
235
|
def remove_dep(self, name: str) -> bool:
|
|
229
236
|
'''
|
|
230
237
|
Removes a previously registered module.
|
|
231
238
|
|
|
232
239
|
Args:
|
|
233
|
-
name (str):
|
|
240
|
+
name (str): Name of the module.
|
|
234
241
|
|
|
235
242
|
Returns:
|
|
236
|
-
True if the module was removed, False
|
|
243
|
+
True if the module was removed, False if it was not found.
|
|
237
244
|
'''
|
|
238
|
-
if
|
|
245
|
+
if not self.has_dep(name):
|
|
239
246
|
return False
|
|
240
247
|
|
|
248
|
+
if isinstance(name, NamedSchema):
|
|
249
|
+
name = name.name
|
|
250
|
+
|
|
241
251
|
del self.__deps[name]
|
|
242
252
|
|
|
243
253
|
# Remove from dependency list
|
|
@@ -251,6 +261,15 @@ class DependencySchema(BaseSchema):
|
|
|
251
261
|
return True
|
|
252
262
|
|
|
253
263
|
def _populate_deps(self, module_map: dict):
|
|
264
|
+
'''
|
|
265
|
+
Internal method to populate the internal dependency dictionary.
|
|
266
|
+
|
|
267
|
+
This is used to reconstruct object references from a serialized format
|
|
268
|
+
by looking up dependency names in the provided map.
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
module_map (dict): A dictionary mapping module names to module objects.
|
|
272
|
+
'''
|
|
254
273
|
if self.__deps:
|
|
255
274
|
return
|
|
256
275
|
|
|
@@ -262,131 +281,6 @@ class DependencySchema(BaseSchema):
|
|
|
262
281
|
if isinstance(self.__deps[module], DependencySchema):
|
|
263
282
|
self.__deps[module]._populate_deps(module_map)
|
|
264
283
|
|
|
265
|
-
def
|
|
266
|
-
|
|
267
|
-
|
|
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)
|
|
284
|
+
def _reset_deps(self):
|
|
285
|
+
'''Resets the internal dependency dictionary.'''
|
|
286
|
+
self.__deps = {}
|