siliconcompiler 0.29.0__py3-none-any.whl → 0.29.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 (87) hide show
  1. siliconcompiler/_metadata.py +1 -1
  2. siliconcompiler/apps/__init__.py +26 -0
  3. siliconcompiler/apps/utils/replay.py +96 -38
  4. siliconcompiler/checklists/__init__.py +12 -0
  5. siliconcompiler/core.py +75 -10
  6. siliconcompiler/flows/__init__.py +34 -0
  7. siliconcompiler/flows/showflow.py +1 -1
  8. siliconcompiler/libs/__init__.py +5 -0
  9. siliconcompiler/optimizer/__init__.py +199 -0
  10. siliconcompiler/optimizer/vizier.py +259 -0
  11. siliconcompiler/pdks/__init__.py +5 -0
  12. siliconcompiler/scheduler/__init__.py +67 -49
  13. siliconcompiler/scheduler/send_messages.py +1 -1
  14. siliconcompiler/schema/schema_cfg.py +2 -2
  15. siliconcompiler/schema/schema_obj.py +13 -10
  16. siliconcompiler/schema/utils.py +2 -0
  17. siliconcompiler/sphinx_ext/__init__.py +85 -0
  18. siliconcompiler/sphinx_ext/dynamicgen.py +17 -33
  19. siliconcompiler/sphinx_ext/schemagen.py +3 -2
  20. siliconcompiler/targets/__init__.py +26 -0
  21. siliconcompiler/templates/replay/replay.py.j2 +62 -0
  22. siliconcompiler/templates/replay/requirements.txt +2 -1
  23. siliconcompiler/templates/replay/setup.sh +119 -6
  24. siliconcompiler/tools/__init__.py +60 -0
  25. siliconcompiler/tools/_common/asic.py +7 -6
  26. siliconcompiler/tools/ghdl/ghdl.py +1 -2
  27. siliconcompiler/tools/klayout/convert_drc_db.py +1 -1
  28. siliconcompiler/tools/klayout/drc.py +1 -1
  29. siliconcompiler/tools/klayout/export.py +8 -1
  30. siliconcompiler/tools/klayout/klayout.py +2 -2
  31. siliconcompiler/tools/klayout/klayout_convert_drc_db.py +2 -2
  32. siliconcompiler/tools/klayout/klayout_export.py +7 -5
  33. siliconcompiler/tools/klayout/klayout_operations.py +4 -3
  34. siliconcompiler/tools/klayout/klayout_show.py +3 -2
  35. siliconcompiler/tools/klayout/klayout_utils.py +1 -1
  36. siliconcompiler/tools/klayout/operations.py +8 -0
  37. siliconcompiler/tools/klayout/screenshot.py +6 -1
  38. siliconcompiler/tools/klayout/show.py +8 -1
  39. siliconcompiler/tools/magic/magic.py +1 -1
  40. siliconcompiler/tools/openroad/__init__.py +1 -1
  41. siliconcompiler/tools/openroad/_apr.py +2 -1
  42. siliconcompiler/tools/openroad/init_floorplan.py +1 -1
  43. siliconcompiler/tools/openroad/scripts/apr/preamble.tcl +1 -1
  44. siliconcompiler/tools/openroad/scripts/apr/sc_clock_tree_synthesis.tcl +4 -0
  45. siliconcompiler/tools/openroad/scripts/apr/sc_repair_timing.tcl +2 -2
  46. siliconcompiler/tools/openroad/scripts/common/procs.tcl +52 -0
  47. siliconcompiler/tools/openroad/scripts/common/reports.tcl +1 -1
  48. siliconcompiler/tools/openroad/scripts/sc_show.tcl +5 -0
  49. siliconcompiler/tools/opensta/__init__.py +1 -1
  50. siliconcompiler/tools/opensta/check_library.py +27 -0
  51. siliconcompiler/tools/opensta/scripts/sc_check_library.tcl +255 -0
  52. siliconcompiler/tools/opensta/scripts/sc_timing.tcl +1 -1
  53. siliconcompiler/tools/sv2v/sv2v.py +1 -2
  54. siliconcompiler/tools/verilator/verilator.py +6 -7
  55. siliconcompiler/tools/vivado/vivado.py +1 -1
  56. siliconcompiler/tools/yosys/__init__.py +149 -0
  57. siliconcompiler/tools/yosys/lec.py +22 -9
  58. siliconcompiler/tools/yosys/sc_lec.tcl +94 -49
  59. siliconcompiler/tools/yosys/sc_syn.tcl +1 -0
  60. siliconcompiler/tools/yosys/screenshot.py +2 -2
  61. siliconcompiler/tools/yosys/syn_asic.py +98 -74
  62. siliconcompiler/tools/yosys/syn_asic.tcl +31 -6
  63. siliconcompiler/tools/yosys/syn_fpga.py +2 -3
  64. siliconcompiler/tools/yosys/syn_fpga.tcl +0 -1
  65. siliconcompiler/toolscripts/_tools.json +3 -3
  66. siliconcompiler/utils/__init__.py +7 -3
  67. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.1.dist-info}/METADATA +13 -10
  68. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.1.dist-info}/RECORD +72 -82
  69. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.1.dist-info}/WHEEL +1 -1
  70. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.1.dist-info}/entry_points.txt +13 -0
  71. siliconcompiler/libs/asap7sc7p5t.py +0 -8
  72. siliconcompiler/libs/gf180mcu.py +0 -8
  73. siliconcompiler/libs/interposer.py +0 -8
  74. siliconcompiler/libs/nangate45.py +0 -8
  75. siliconcompiler/libs/sg13g2_stdcell.py +0 -8
  76. siliconcompiler/libs/sky130hd.py +0 -8
  77. siliconcompiler/libs/sky130io.py +0 -8
  78. siliconcompiler/pdks/asap7.py +0 -8
  79. siliconcompiler/pdks/freepdk45.py +0 -8
  80. siliconcompiler/pdks/gf180.py +0 -8
  81. siliconcompiler/pdks/ihp130.py +0 -8
  82. siliconcompiler/pdks/interposer.py +0 -8
  83. siliconcompiler/pdks/skywater130.py +0 -8
  84. siliconcompiler/templates/replay/run.py.j2 +0 -22
  85. siliconcompiler/tools/yosys/yosys.py +0 -148
  86. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.1.dist-info}/LICENSE +0 -0
  87. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.1.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@ from sphinx.util.docutils import SphinxDirective
9
9
  from sphinx.domains.std import StandardDomain
10
10
  from sphinx.addnodes import pending_xref
11
11
  import docutils
12
- from siliconcompiler import __version__ as sc_version
12
+ from siliconcompiler.utils import get_plugins
13
13
 
14
14
  import importlib
15
15
  import pkgutil
@@ -17,6 +17,7 @@ import os
17
17
  import subprocess
18
18
 
19
19
  import siliconcompiler
20
+ from siliconcompiler.sphinx_ext import sc_root as SC_ROOT
20
21
  from siliconcompiler.schema import Schema, utils
21
22
  from siliconcompiler.sphinx_ext.utils import (
22
23
  strong,
@@ -37,9 +38,6 @@ from siliconcompiler.sphinx_ext.utils import (
37
38
  # Helpers
38
39
  #############
39
40
 
40
- # We need this in a few places, so just make it global
41
- SC_ROOT = os.path.abspath(f'{__file__}/../../../')
42
-
43
41
 
44
42
  def build_schema_value_table(cfg, refdoc, keypath_prefix=None, skip_zero_weight=False):
45
43
  '''Helper function for displaying values set in schema as a docutils table.'''
@@ -194,6 +192,7 @@ class DynamicGen(SphinxDirective):
194
192
  # Then use setup doc string
195
193
  self.generate_documentation_from_object(setup, path, s)
196
194
 
195
+ chips = None
197
196
  try:
198
197
  chips = self.configure_chip_for_docs(module)
199
198
  except Exception as e:
@@ -251,22 +250,14 @@ class DynamicGen(SphinxDirective):
251
250
 
252
251
  This function explicitly searches builtins.
253
252
  '''
254
- builtins_dir = f'{SC_ROOT}/siliconcompiler/{self.PATH}'
255
- if 'nobuiltins' not in self.options:
256
- modules = self.get_modules_in_dir(builtins_dir)
257
- else:
258
- modules = []
259
253
 
260
- external_paths = os.getenv(self.SEARCH_ENV, "").split(':')
261
- for scpath in external_paths:
262
- if not scpath:
263
- continue
264
- if not os.path.isdir(scpath):
265
- print(f'{scpath} not found')
266
- raise FileNotFoundError(scpath)
267
- if builtins_dir == scpath:
268
- continue
269
- modules.extend(self.get_modules_in_dir(scpath))
254
+ modules = []
255
+ for plugin in get_plugins("docs", name=self.PATH):
256
+ for mod in plugin():
257
+ if isinstance(mod, str):
258
+ modules.extend(self.get_modules_in_dir(mod))
259
+ else:
260
+ modules.append(mod)
270
261
 
271
262
  return modules
272
263
 
@@ -321,15 +312,15 @@ class DynamicGen(SphinxDirective):
321
312
  else:
322
313
  return False
323
314
 
324
- builtin = os.path.abspath(path).startswith(SC_ROOT)
315
+ src_link = None
316
+ for docs_link in get_plugins("docs", name="linkcode"):
317
+ src_link = docs_link(file=path)
318
+ if src_link:
319
+ break
325
320
 
326
- if builtin:
327
- relpath = path[len(SC_ROOT) + 1:]
328
- gh_root = f'https://github.com/siliconcompiler/siliconcompiler/blob/v{sc_version}'
329
- gh_link = f'{gh_root}/{relpath}'
330
- filename = os.path.basename(relpath)
321
+ if src_link:
331
322
  p = para('Setup file: ')
332
- p += link(gh_link, text=filename)
323
+ p += link(src_link, text=os.path.basename(path))
333
324
  s += p
334
325
 
335
326
  return True
@@ -478,7 +469,6 @@ class DynamicGen(SphinxDirective):
478
469
  class FlowGen(DynamicGen):
479
470
  PATH = 'flows'
480
471
  REF_PREFIX = 'flows'
481
- SEARCH_ENV = "SC_DOCS_FLOWS"
482
472
 
483
473
  def extra_content(self, chip, modname):
484
474
  flow_path = os.path.join(self.env.app.outdir, f'_images/gen/{modname}.svg')
@@ -525,7 +515,6 @@ class FlowGen(DynamicGen):
525
515
  class PDKGen(DynamicGen):
526
516
  PATH = 'pdks'
527
517
  REF_PREFIX = 'pdks'
528
- SEARCH_ENV = "SC_DOCS_PDKS"
529
518
 
530
519
  def display_config(self, chip, modname):
531
520
  '''Display parameters under `pdk`, `asic`, and `library` in nested form.'''
@@ -550,7 +539,6 @@ class PDKGen(DynamicGen):
550
539
  class LibGen(DynamicGen):
551
540
  PATH = 'libs'
552
541
  REF_PREFIX = 'libs'
553
- SEARCH_ENV = "SC_DOCS_LIBS"
554
542
 
555
543
  def extra_content(self, chip, modname):
556
544
  # assume same pdk for all libraries configured by this module
@@ -593,7 +581,6 @@ class LibGen(DynamicGen):
593
581
  class ToolGen(DynamicGen):
594
582
  PATH = 'tools'
595
583
  REF_PREFIX = 'tools'
596
- SEARCH_ENV = "SC_DOCS_TOOLS"
597
584
 
598
585
  def make_chip(self):
599
586
  chip = super().make_chip()
@@ -810,7 +797,6 @@ class ToolGen(DynamicGen):
810
797
  class TargetGen(DynamicGen):
811
798
  PATH = 'targets'
812
799
  REF_PREFIX = 'targets'
813
- SEARCH_ENV = "SC_DOCS_TARGETS"
814
800
 
815
801
  def build_module_list(self, chip, header, modtype, targetname, *refprefix):
816
802
  modules = chip._loaded_modules[modtype]
@@ -878,7 +864,6 @@ class TargetGen(DynamicGen):
878
864
  class AppGen(DynamicGen):
879
865
  PATH = 'apps'
880
866
  REF_PREFIX = 'apps'
881
- SEARCH_ENV = "SC_DOCS_APPS"
882
867
 
883
868
  def document_module(self, module, modname, path):
884
869
  if modname[0] == "_":
@@ -898,7 +883,6 @@ class AppGen(DynamicGen):
898
883
  class ChecklistGen(DynamicGen):
899
884
  PATH = 'checklists'
900
885
  REF_PREFIX = 'checklists'
901
- SEARCH_ENV = "SC_DOCS_CHECKLISTS"
902
886
 
903
887
  def display_config(self, chip, modname):
904
888
  '''Display parameters under in nested form.'''
@@ -16,14 +16,15 @@ from siliconcompiler.sphinx_ext.utils import (
16
16
  build_list
17
17
  )
18
18
  from siliconcompiler.schema import utils
19
+ from siliconcompiler.sphinx_ext import sc_root as SC_ROOT
19
20
 
20
21
 
21
22
  # Main Sphinx plugin
22
23
  class SchemaGen(SphinxDirective):
23
24
 
24
25
  def run(self):
25
- cfg_path = os.path.dirname(siliconcompiler.__file__)
26
- self.env.note_dependency(os.path.join(cfg_path, 'schema', 'schema_cfg.py'))
26
+ self.env.note_dependency(
27
+ os.path.join(SC_ROOT, 'siliconcompiler', 'schema', 'schema_cfg.py'))
27
28
  self.env.note_dependency(__file__)
28
29
  self.env.note_dependency(utils.__file__)
29
30
 
@@ -0,0 +1,26 @@
1
+ from siliconcompiler.targets import asap7_demo
2
+ from siliconcompiler.targets import asic_demo
3
+ from siliconcompiler.targets import fpgaflow_demo
4
+ from siliconcompiler.targets import freepdk45_demo
5
+ from siliconcompiler.targets import gf180_demo
6
+ from siliconcompiler.targets import ihp130_demo
7
+ from siliconcompiler.targets import interposer_demo
8
+ from siliconcompiler.targets import skywater130_demo
9
+
10
+
11
+ def get_targets():
12
+ '''
13
+ Returns a dict of builtin targets
14
+ '''
15
+ return {
16
+ module.__name__.split(".")[-1]: module for module in (
17
+ asap7_demo,
18
+ asic_demo,
19
+ fpgaflow_demo,
20
+ freepdk45_demo,
21
+ gf180_demo,
22
+ ihp130_demo,
23
+ interposer_demo,
24
+ skywater130_demo
25
+ )
26
+ }
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env python3
2
+ # SiliconCompiler Replay
3
+ # Design: {{ design }}
4
+ # Jobname: {{ jobname }}
5
+ # Date: {{ date }}
6
+
7
+ import base64
8
+ import os.path
9
+ import tarfile
10
+ import sys
11
+
12
+ from io import BytesIO
13
+
14
+ from siliconcompiler import Chip
15
+
16
+ # Input files as a tarball encoded as base64
17
+ INPUT_FILES = \{% for line in src_file %}
18
+ "{{ line }}"{% if not loop.last %} \{% endif %}{% endfor %}
19
+
20
+
21
+ if __name__ == "__main__":
22
+ chip = Chip("{{ design }}")
23
+ chip.read_manifest(os.path.join(os.path.dirname(__file__), "sc_manifest.json"))
24
+
25
+ args = chip.create_cmdline(
26
+ progname="{{ design }}",
27
+ description="Replay script for {{ design }} / {{ jobname }}",
28
+ switchlist=[
29
+ "-builddir",
30
+ "-cachedir",
31
+ "-jobname",
32
+ "-to",
33
+ "-from",
34
+ "-novercheck",
35
+ "-continue"
36
+ ],
37
+ additional_args={
38
+ "-check_files": {
39
+ "action": "store_true",
40
+ "help": "Do not run, just check files"
41
+ }
42
+ })
43
+
44
+ # Extract input files
45
+ with BytesIO(base64.b64decode(INPUT_FILES.encode())) as fd:
46
+ with tarfile.open(fileobj=fd, mode='r:gz') as tar:
47
+ tar.extractall(path=chip._getcollectdir())
48
+
49
+ # Set tool versions{% for node, tool, version in tool_versions %}
50
+ chip.set("tool", "{{ tool }}", "version", "=={{ version }}", step="{{ node[0] }}", index="{{ node[1] }}"){% endfor %}
51
+
52
+ if args["check_files"]:
53
+ if chip.check_filepaths():
54
+ sys.exit(0)
55
+ else:
56
+ sys.exit(1)
57
+
58
+ # Run
59
+ chip.run()
60
+
61
+ # Report summary
62
+ chip.summary()
@@ -1,6 +1,7 @@
1
1
  # SiliconCompiler Replay Environment
2
- # From {{ source }}
2
+ # Design: {{ design }}
3
3
  # Jobname: {{ jobname }}
4
+ # Date: {{ date }}
4
5
 
5
6
  {% for pkg in pkgs %}{{ pkg }}
6
7
  {% endfor %}
@@ -1,17 +1,130 @@
1
1
  #!/usr/bin/env bash
2
2
  # SiliconCompiler Replay Setup
3
- # From {{ source }}
3
+ # Design: {{ design }}
4
4
  # Jobname: {{ jobname }}
5
+ # Date: {{ date }}
6
+
7
+ if ! [ "${BASH_SOURCE[0]}" -ef "$0" ];
8
+ then
9
+ echo "${BASH_SOURCE[0]} must be executed"
10
+ return 1
11
+ fi
12
+
13
+ _help() {
14
+ cat <<EOF
15
+ {{ description }}
16
+ Usage: $0 -dir=DIR
17
+ # Directory to use for extraction, defaults to "./replay"
18
+ $0 -venv=DIR
19
+ # Name of virtual environment, defaults to "venv"
20
+ $0 -print_tools
21
+ # Print tool version and exit
22
+ $0 -extract_only
23
+ # Only extract the files
24
+ $0 -setup_only
25
+ # Only setup the runtime environment
26
+ $0 -assert_python
27
+ # Require python versions match
28
+ $0 -help
29
+ # Print this help information
30
+ EOF
31
+ }
32
+
33
+ _print_tools() {
34
+ cat <<EOF{% for line in tools %}
35
+ {{ line }}{% endfor %}
36
+ EOF
37
+ }
38
+
39
+ path=$(realpath replay)
40
+ venv="venv"
41
+ extract_only="no"
42
+ setup_only="no"
43
+ assert_python="no"
44
+
45
+ while [ "$#" -gt 0 ]; do
46
+ case "${1}" in
47
+ -h|-help)
48
+ _help
49
+ exit 0
50
+ ;;
51
+ -extract_only)
52
+ extract_only="yes"
53
+ ;;
54
+ -setup_only)
55
+ setup_only="yes"
56
+ ;;
57
+ -assert_python)
58
+ assert_python="yes"
59
+ ;;
60
+ -print_tools)
61
+ _print_tools
62
+ exit 0
63
+ ;;
64
+ -dir=*)
65
+ path=$(realpath ${1#-dir=})
66
+ ;;
67
+ -venv=*)
68
+ venv=${1#-venv=}
69
+ ;;
70
+ *)
71
+ echo "Unknown option: ${1}" >&2
72
+ _help
73
+ exit 1
74
+ ;;
75
+ esac
76
+ shift 1
77
+ done
78
+
79
+ # Create output path
80
+ mkdir -p "$path"
81
+
82
+ # Change to output path directory
83
+ cd "$path"
84
+
85
+ # Add gitignore
86
+ echo "*" > .gitignore
87
+
88
+ # Extract files
89
+ read -r -d '' SCRIPT << PythonScript{% for line in script %}
90
+ {{ line }}{% endfor %}
91
+ PythonScript
92
+
93
+ echo "$SCRIPT" | base64 --decode | gunzip > replay.py
94
+ chmod +x replay.py
95
+
96
+ read -r -d '' MANIFEST << Manifest{% for line in manifest %}
97
+ {{ line }}{% endfor %}
98
+ Manifest
99
+
100
+ echo "$MANIFEST" | base64 --decode | gunzip > sc_manifest.json
101
+
102
+ cat > requirements.txt << PythonRequirements{% for line in requirements %}
103
+ {{ line }}{% endfor %}
104
+ PythonRequirements
105
+
106
+ if [ "$extract_only" == "yes" ]; then
107
+ exit 0
108
+ fi
5
109
 
6
110
  if [ "$(python3 -V)" != "Python {{ pythonversion }}" ]; then
7
111
  echo "Python version mismatch: $(python3 -V) != {{ pythonversion }}"
112
+
113
+ if [ "$assert_python" == "yes" ]; then
114
+ exit 1
115
+ fi
8
116
  fi
9
117
 
10
- python3 -m venv {{ design }}_venv --clear
11
- echo "*" > gcd_venv/.gitignore
118
+ python3 -m venv $venv --clear
12
119
 
13
- . {{ design }}_venv/bin/activate
120
+ . $venv/bin/activate
14
121
  pip3 install -r requirements.txt
15
122
 
16
- echo "To enable run environment: . {{ design }}_venv/bin/activate"
17
- echo "To replay: ./run.py"
123
+ echo "To enable run environment: . $path/$venv/bin/activate"
124
+ echo "To replay: $path/replay.py"
125
+
126
+ if [ "$setup_only" == "yes" ]; then
127
+ exit 0
128
+ fi
129
+
130
+ ./replay.py
@@ -0,0 +1,60 @@
1
+ from siliconcompiler.tools.bambu import bambu
2
+ from siliconcompiler.tools.bluespec import bluespec
3
+ from siliconcompiler.tools.builtin import builtin
4
+ from siliconcompiler.tools.chisel import chisel
5
+ from siliconcompiler.tools.execute import execute
6
+ from siliconcompiler.tools.genfasm import genfasm
7
+ from siliconcompiler.tools.ghdl import ghdl
8
+ from siliconcompiler.tools.icarus import icarus
9
+ from siliconcompiler.tools.icepack import icepack
10
+ from siliconcompiler.tools.klayout import klayout
11
+ from siliconcompiler.tools.magic import magic
12
+ from siliconcompiler.tools.montage import montage
13
+ from siliconcompiler.tools.netgen import netgen
14
+ from siliconcompiler.tools.nextpnr import nextpnr
15
+ from siliconcompiler.tools import openroad
16
+ from siliconcompiler.tools import opensta
17
+ from siliconcompiler.tools import slang
18
+ from siliconcompiler.tools import surelog
19
+ from siliconcompiler.tools.sv2v import sv2v
20
+ from siliconcompiler.tools.verilator import verilator
21
+ from siliconcompiler.tools.vivado import vivado
22
+ from siliconcompiler.tools.vpr import vpr
23
+ from siliconcompiler.tools import xdm
24
+ from siliconcompiler.tools import xyce
25
+ from siliconcompiler.tools import yosys
26
+
27
+
28
+ def get_tools():
29
+ '''
30
+ Returns a dict of builtin tools
31
+ '''
32
+ return {
33
+ module.__name__.split(".")[-1]: module for module in (
34
+ bambu,
35
+ bluespec,
36
+ builtin,
37
+ chisel,
38
+ execute,
39
+ genfasm,
40
+ ghdl,
41
+ icarus,
42
+ icepack,
43
+ klayout,
44
+ magic,
45
+ montage,
46
+ netgen,
47
+ nextpnr,
48
+ openroad,
49
+ opensta,
50
+ slang,
51
+ surelog,
52
+ sv2v,
53
+ verilator,
54
+ vivado,
55
+ vpr,
56
+ xdm,
57
+ xyce,
58
+ yosys
59
+ )
60
+ }
@@ -1,4 +1,5 @@
1
- from .. import _common
1
+ from . import get_libraries as common_get_libraries
2
+ from . import get_tool_task, pick_key
2
3
  import json
3
4
 
4
5
 
@@ -19,7 +20,7 @@ def get_libraries(chip, type):
19
20
  continue
20
21
  libs.append(lib)
21
22
 
22
- for lib in _common.get_libraries(chip, include_asic=False):
23
+ for lib in common_get_libraries(chip, include_asic=False):
23
24
  if not chip.valid('library', lib, 'asic', f'{type}lib'):
24
25
  continue
25
26
  for sublib in chip.get('library', lib, 'asic', f'{type}lib', step=step, index=index):
@@ -55,7 +56,7 @@ def set_tool_task_var(chip,
55
56
  '''
56
57
  step = chip.get('arg', 'step')
57
58
  index = chip.get('arg', 'index')
58
- tool, task = _common.get_tool_task(chip, step, index)
59
+ tool, task = get_tool_task(chip, step, index)
59
60
  pdkname = chip.get('option', 'pdk')
60
61
  stackup = chip.get('option', 'stackup')
61
62
 
@@ -107,7 +108,7 @@ def set_tool_task_var(chip,
107
108
  return len(val) > 0
108
109
  return val is not None
109
110
 
110
- require_key, value = _common.pick_key(chip, reversed(check_keys), step=step, index=index)
111
+ require_key, value = pick_key(chip, reversed(check_keys), step=step, index=index)
111
112
  if not check_value(value):
112
113
  value = default_value
113
114
 
@@ -145,7 +146,7 @@ def get_tool_task_var(chip,
145
146
  '''
146
147
  step = chip.get('arg', 'step')
147
148
  index = chip.get('arg', 'index')
148
- tool, _ = _common.get_tool_task(chip, step, index)
149
+ tool, _ = get_tool_task(chip, step, index)
149
150
  pdkname = chip.get('option', 'pdk')
150
151
  stackup = chip.get('option', 'stackup')
151
152
 
@@ -174,7 +175,7 @@ def get_tool_task_var(chip,
174
175
  option_key = f'{tool}_{param_key}'
175
176
  check_keys.append(['option', 'var', option_key])
176
177
 
177
- _, value = _common.pick_key(chip, reversed(check_keys), step=step, index=index)
178
+ _, value = pick_key(chip, reversed(check_keys), step=step, index=index)
178
179
 
179
180
  return value
180
181
 
@@ -12,13 +12,12 @@ Sources: https://github.com/ghdl/ghdl
12
12
  Installation: https://github.com/ghdl/ghdl
13
13
  '''
14
14
 
15
- from siliconcompiler.tools.ghdl import convert
16
-
17
15
 
18
16
  #####################################################################
19
17
  # Make Docs
20
18
  #####################################################################
21
19
  def make_docs(chip):
20
+ from siliconcompiler.tools.ghdl import convert
22
21
  convert.setup(chip)
23
22
  return chip
24
23
 
@@ -1,10 +1,10 @@
1
1
  from siliconcompiler.tools._common import input_provides, input_file_node_name, get_tool_task
2
2
 
3
- from siliconcompiler.tools.klayout import klayout
4
3
  from siliconcompiler.tools.klayout.klayout import setup as setup_tool
5
4
 
6
5
 
7
6
  def make_docs(chip):
7
+ from siliconcompiler.tools.klayout import klayout
8
8
  klayout.make_docs(chip)
9
9
 
10
10
 
@@ -5,12 +5,12 @@ from siliconcompiler.tools._common import input_provides, has_input_files, \
5
5
  get_input_files, get_tool_task, record_metric
6
6
  from siliconcompiler.tools._common.asic import set_tool_task_var, get_tool_task_var
7
7
 
8
- from siliconcompiler.tools.klayout import klayout
9
8
  from siliconcompiler.tools.klayout.klayout import setup as setup_tool
10
9
  import xml.etree.ElementTree as ET
11
10
 
12
11
 
13
12
  def make_docs(chip):
13
+ from siliconcompiler.tools.klayout import klayout
14
14
  klayout.make_docs(chip)
15
15
  chip.set('tool', 'klayout', 'task', 'drc', 'var', 'drc_name', '<drc_name>',
16
16
  step='<step>', index='<index>')
@@ -1,5 +1,6 @@
1
-
1
+ import os
2
2
  from siliconcompiler.tools.klayout.klayout import setup as setup_tool
3
+ from siliconcompiler.tools.klayout.klayout import runtime_options as runtime_options_tool
3
4
  from siliconcompiler.tools.klayout.screenshot import setup_gui_screenshot
4
5
  from siliconcompiler.tools._common import input_provides, get_tool_task
5
6
  from siliconcompiler.tools._common.asic import get_libraries
@@ -120,3 +121,9 @@ def setup(chip):
120
121
  if chip.get('tool', tool, 'task', task, 'var', 'screenshot',
121
122
  step=step, index=index) == ['true']:
122
123
  setup_gui_screenshot(chip, require_input=False)
124
+
125
+
126
+ def runtime_options(chip):
127
+ return runtime_options_tool(chip) + [
128
+ '-rd', f'SC_TOOLS_ROOT={os.path.dirname(os.path.dirname(__file__))}'
129
+ ]
@@ -15,13 +15,13 @@ from pathlib import Path
15
15
  import platform
16
16
  import shutil
17
17
  from siliconcompiler.tools._common import get_tool_task
18
- from siliconcompiler.targets import freepdk45_demo
19
18
 
20
19
 
21
20
  ####################################################################
22
21
  # Make Docs
23
22
  ####################################################################
24
23
  def make_docs(chip):
24
+ from siliconcompiler.targets import freepdk45_demo
25
25
  chip.use(freepdk45_demo)
26
26
 
27
27
 
@@ -102,7 +102,7 @@ def runtime_options(chip):
102
102
  # that has no 3rd-party dependencies.
103
103
  # This must be done at runtime to work in a remote context.
104
104
 
105
- return ['-rd', f'SC_ROOT={chip.scroot}']
105
+ return ['-rd', f'SC_KLAYOUT_ROOT={os.path.dirname(__file__)}']
106
106
 
107
107
 
108
108
  ################################
@@ -150,9 +150,9 @@ def convert_drc(view, path):
150
150
 
151
151
  def main():
152
152
  # SC_ROOT provided by CLI
153
- sys.path.append(SC_ROOT) # noqa: F821
153
+ sys.path.append(SC_KLAYOUT_ROOT) # noqa: F821
154
154
 
155
- from tools.klayout.klayout_utils import get_schema
155
+ from klayout_utils import get_schema
156
156
 
157
157
  schema = get_schema(manifest='sc_manifest.json')
158
158
 
@@ -42,7 +42,7 @@ import fnmatch
42
42
  def gds_export(design_name, in_def, in_files, out_file, tech, allow_missing, config_file='',
43
43
  seal_file='',
44
44
  timestamps=True):
45
- from tools.klayout.klayout_utils import get_write_options # noqa E402
45
+ from klayout_utils import get_write_options # noqa E402
46
46
 
47
47
  # Load def file
48
48
  main_layout = pya.Layout()
@@ -119,16 +119,18 @@ def gds_export(design_name, in_def, in_files, out_file, tech, allow_missing, con
119
119
 
120
120
  def main():
121
121
  # SC_ROOT provided by CLI
122
- sys.path.append(SC_ROOT) # noqa: F821
122
+ sys.path.append(SC_KLAYOUT_ROOT) # noqa: F821
123
+ sys.path.append(SC_TOOLS_ROOT) # noqa: F821
124
+ print(sys.path)
123
125
 
124
- from tools.klayout.klayout_utils import (
126
+ from klayout_utils import (
125
127
  technology,
126
128
  get_streams,
127
129
  save_technology,
128
130
  get_schema
129
131
  )
130
- from tools.klayout.klayout_show import show
131
- from tools._common.asic import get_libraries
132
+ from klayout_show import show
133
+ from _common.asic import get_libraries
132
134
 
133
135
  schema = get_schema(manifest='sc_manifest.json')
134
136
 
@@ -148,7 +148,7 @@ def rename_cell(base_layout, old_name, new_name):
148
148
 
149
149
 
150
150
  def write_stream(layout, outfile, timestamps):
151
- from tools.klayout.klayout_utils import get_write_options
151
+ from klayout_utils import get_write_options
152
152
 
153
153
  print(f"[INFO] Writing layout: '{outfile}'")
154
154
 
@@ -324,9 +324,10 @@ def parse_operations(schema, base_layout, steps):
324
324
 
325
325
  if __name__ == "__main__":
326
326
  # SC_ROOT provided by CLI
327
- sys.path.append(SC_ROOT) # noqa: F821
327
+ sys.path.append(SC_KLAYOUT_ROOT) # noqa: F821
328
+ sys.path.append(SC_TOOLS_ROOT) # noqa: F821
328
329
 
329
- from tools.klayout.klayout_utils import (
330
+ from klayout_utils import (
330
331
  technology,
331
332
  get_streams,
332
333
  get_schema
@@ -205,9 +205,10 @@ def __screenshot_montage(schema, view, xbins, ybins):
205
205
 
206
206
  def main():
207
207
  # SC_ROOT provided by CLI, and is only accessible when this is main module
208
- sys.path.append(SC_ROOT) # noqa: F821
208
+ sys.path.append(SC_KLAYOUT_ROOT) # noqa: F821
209
+ sys.path.append(SC_TOOLS_ROOT) # noqa: F821
209
210
 
210
- from tools.klayout.klayout_utils import (
211
+ from klayout_utils import (
211
212
  technology,
212
213
  get_schema
213
214
  )
@@ -21,7 +21,7 @@ def get_streams(schema):
21
21
 
22
22
 
23
23
  def technology(design, schema):
24
- from tools._common.asic import get_libraries
24
+ from _common.asic import get_libraries
25
25
 
26
26
  sc_step = schema.get('arg', 'step')
27
27
  sc_index = schema.get('arg', 'index')