siliconcompiler 0.29.0__py3-none-any.whl → 0.29.2__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/_metadata.py +1 -1
  2. siliconcompiler/apps/__init__.py +26 -0
  3. siliconcompiler/apps/sc_install.py +1 -1
  4. siliconcompiler/apps/utils/replay.py +96 -38
  5. siliconcompiler/checklists/__init__.py +12 -0
  6. siliconcompiler/core.py +85 -15
  7. siliconcompiler/flows/__init__.py +34 -0
  8. siliconcompiler/flows/showflow.py +1 -1
  9. siliconcompiler/libs/__init__.py +5 -0
  10. siliconcompiler/optimizer/__init__.py +199 -0
  11. siliconcompiler/optimizer/vizier.py +259 -0
  12. siliconcompiler/pdks/__init__.py +5 -0
  13. siliconcompiler/scheduler/__init__.py +67 -49
  14. siliconcompiler/scheduler/send_messages.py +1 -1
  15. siliconcompiler/schema/schema_cfg.py +2 -2
  16. siliconcompiler/schema/schema_obj.py +13 -10
  17. siliconcompiler/schema/utils.py +2 -0
  18. siliconcompiler/sphinx_ext/__init__.py +85 -0
  19. siliconcompiler/sphinx_ext/dynamicgen.py +17 -33
  20. siliconcompiler/sphinx_ext/schemagen.py +3 -2
  21. siliconcompiler/targets/__init__.py +26 -0
  22. siliconcompiler/templates/replay/replay.py.j2 +62 -0
  23. siliconcompiler/templates/replay/requirements.txt +2 -1
  24. siliconcompiler/templates/replay/setup.sh +119 -6
  25. siliconcompiler/tools/__init__.py +62 -0
  26. siliconcompiler/tools/_common/asic.py +77 -6
  27. siliconcompiler/tools/_common/tcl/sc_pin_constraints.tcl +2 -2
  28. siliconcompiler/tools/ghdl/ghdl.py +1 -2
  29. siliconcompiler/tools/gtkwave/__init__.py +39 -0
  30. siliconcompiler/tools/gtkwave/scripts/sc_show.tcl +34 -0
  31. siliconcompiler/tools/gtkwave/show.py +70 -0
  32. siliconcompiler/tools/icarus/compile.py +4 -0
  33. siliconcompiler/tools/klayout/convert_drc_db.py +1 -1
  34. siliconcompiler/tools/klayout/drc.py +1 -1
  35. siliconcompiler/tools/klayout/export.py +8 -1
  36. siliconcompiler/tools/klayout/klayout.py +2 -2
  37. siliconcompiler/tools/klayout/klayout_convert_drc_db.py +2 -2
  38. siliconcompiler/tools/klayout/klayout_export.py +7 -5
  39. siliconcompiler/tools/klayout/klayout_operations.py +4 -3
  40. siliconcompiler/tools/klayout/klayout_show.py +3 -2
  41. siliconcompiler/tools/klayout/klayout_utils.py +1 -1
  42. siliconcompiler/tools/klayout/operations.py +8 -0
  43. siliconcompiler/tools/klayout/screenshot.py +6 -1
  44. siliconcompiler/tools/klayout/show.py +8 -1
  45. siliconcompiler/tools/magic/magic.py +1 -1
  46. siliconcompiler/tools/openroad/__init__.py +1 -1
  47. siliconcompiler/tools/openroad/_apr.py +11 -2
  48. siliconcompiler/tools/openroad/global_placement.py +23 -2
  49. siliconcompiler/tools/openroad/init_floorplan.py +1 -1
  50. siliconcompiler/tools/openroad/scripts/apr/preamble.tcl +1 -1
  51. siliconcompiler/tools/openroad/scripts/apr/sc_clock_tree_synthesis.tcl +4 -0
  52. siliconcompiler/tools/openroad/scripts/apr/sc_global_placement.tcl +64 -1
  53. siliconcompiler/tools/openroad/scripts/apr/sc_repair_design.tcl +4 -0
  54. siliconcompiler/tools/openroad/scripts/apr/sc_repair_timing.tcl +8 -2
  55. siliconcompiler/tools/openroad/scripts/common/procs.tcl +88 -0
  56. siliconcompiler/tools/openroad/scripts/common/reports.tcl +1 -1
  57. siliconcompiler/tools/openroad/scripts/common/write_images.tcl +10 -1
  58. siliconcompiler/tools/openroad/scripts/sc_show.tcl +5 -0
  59. siliconcompiler/tools/opensta/__init__.py +1 -1
  60. siliconcompiler/tools/opensta/check_library.py +27 -0
  61. siliconcompiler/tools/opensta/scripts/sc_check_library.tcl +255 -0
  62. siliconcompiler/tools/opensta/scripts/sc_timing.tcl +1 -1
  63. siliconcompiler/tools/sv2v/sv2v.py +1 -2
  64. siliconcompiler/tools/verilator/compile.py +11 -0
  65. siliconcompiler/tools/verilator/verilator.py +7 -8
  66. siliconcompiler/tools/vivado/vivado.py +1 -1
  67. siliconcompiler/tools/yosys/__init__.py +149 -0
  68. siliconcompiler/tools/yosys/lec.py +22 -9
  69. siliconcompiler/tools/yosys/sc_lec.tcl +94 -49
  70. siliconcompiler/tools/yosys/sc_syn.tcl +1 -0
  71. siliconcompiler/tools/yosys/screenshot.py +2 -2
  72. siliconcompiler/tools/yosys/syn_asic.py +98 -74
  73. siliconcompiler/tools/yosys/syn_asic.tcl +31 -6
  74. siliconcompiler/tools/yosys/syn_fpga.py +2 -3
  75. siliconcompiler/tools/yosys/syn_fpga.tcl +0 -1
  76. siliconcompiler/toolscripts/_tools.json +8 -3
  77. siliconcompiler/toolscripts/rhel9/install-gtkwave.sh +40 -0
  78. siliconcompiler/toolscripts/ubuntu20/install-gtkwave.sh +28 -0
  79. siliconcompiler/toolscripts/ubuntu22/install-gtkwave.sh +28 -0
  80. siliconcompiler/toolscripts/ubuntu22/install-slang.sh +0 -0
  81. siliconcompiler/toolscripts/ubuntu24/install-gtkwave.sh +29 -0
  82. siliconcompiler/utils/__init__.py +7 -3
  83. siliconcompiler/utils/showtools.py +3 -0
  84. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.2.dist-info}/METADATA +14 -11
  85. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.2.dist-info}/RECORD +88 -91
  86. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.2.dist-info}/WHEEL +1 -1
  87. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.2.dist-info}/entry_points.txt +13 -0
  88. siliconcompiler/libs/asap7sc7p5t.py +0 -8
  89. siliconcompiler/libs/gf180mcu.py +0 -8
  90. siliconcompiler/libs/interposer.py +0 -8
  91. siliconcompiler/libs/nangate45.py +0 -8
  92. siliconcompiler/libs/sg13g2_stdcell.py +0 -8
  93. siliconcompiler/libs/sky130hd.py +0 -8
  94. siliconcompiler/libs/sky130io.py +0 -8
  95. siliconcompiler/pdks/asap7.py +0 -8
  96. siliconcompiler/pdks/freepdk45.py +0 -8
  97. siliconcompiler/pdks/gf180.py +0 -8
  98. siliconcompiler/pdks/ihp130.py +0 -8
  99. siliconcompiler/pdks/interposer.py +0 -8
  100. siliconcompiler/pdks/skywater130.py +0 -8
  101. siliconcompiler/templates/replay/run.py.j2 +0 -22
  102. siliconcompiler/tools/yosys/yosys.py +0 -148
  103. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.2.dist-info}/LICENSE +0 -0
  104. {siliconcompiler-0.29.0.dist-info → siliconcompiler-0.29.2.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,62 @@
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 import gtkwave
9
+ from siliconcompiler.tools.icarus import icarus
10
+ from siliconcompiler.tools.icepack import icepack
11
+ from siliconcompiler.tools.klayout import klayout
12
+ from siliconcompiler.tools.magic import magic
13
+ from siliconcompiler.tools.montage import montage
14
+ from siliconcompiler.tools.netgen import netgen
15
+ from siliconcompiler.tools.nextpnr import nextpnr
16
+ from siliconcompiler.tools import openroad
17
+ from siliconcompiler.tools import opensta
18
+ from siliconcompiler.tools import slang
19
+ from siliconcompiler.tools import surelog
20
+ from siliconcompiler.tools.sv2v import sv2v
21
+ from siliconcompiler.tools.verilator import verilator
22
+ from siliconcompiler.tools.vivado import vivado
23
+ from siliconcompiler.tools.vpr import vpr
24
+ from siliconcompiler.tools import xdm
25
+ from siliconcompiler.tools import xyce
26
+ from siliconcompiler.tools import yosys
27
+
28
+
29
+ def get_tools():
30
+ '''
31
+ Returns a dict of builtin tools
32
+ '''
33
+ return {
34
+ module.__name__.split(".")[-1]: module for module in (
35
+ bambu,
36
+ bluespec,
37
+ builtin,
38
+ chisel,
39
+ execute,
40
+ genfasm,
41
+ ghdl,
42
+ gtkwave,
43
+ icarus,
44
+ icepack,
45
+ klayout,
46
+ magic,
47
+ montage,
48
+ netgen,
49
+ nextpnr,
50
+ openroad,
51
+ opensta,
52
+ slang,
53
+ surelog,
54
+ sv2v,
55
+ verilator,
56
+ vivado,
57
+ vpr,
58
+ xdm,
59
+ xyce,
60
+ yosys
61
+ )
62
+ }
@@ -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
 
@@ -134,6 +135,76 @@ def set_tool_task_var(chip,
134
135
  return value
135
136
 
136
137
 
138
+ def set_tool_task_lib_var(chip,
139
+ param_key,
140
+ default_value=None,
141
+ schelp=None,
142
+ option_key=None,
143
+ lib_key=None):
144
+ '''
145
+ Set parameter from libraries -> option -> default_value
146
+ '''
147
+ step = chip.get('arg', 'step')
148
+ index = chip.get('arg', 'index')
149
+ tool, task = get_tool_task(chip, step, index)
150
+
151
+ if schelp:
152
+ chip.set('tool', tool, 'task', task, 'var', param_key,
153
+ schelp, field='help')
154
+
155
+ if not option_key:
156
+ option_key = f'{tool}_{param_key}'
157
+ require_key, value = pick_key(chip, [('option', 'var', option_key)], step=step, index=index)
158
+
159
+ def check_value(val):
160
+ if isinstance(val, (list, tuple, set)):
161
+ return len(val) > 0
162
+ return val is not None
163
+
164
+ if check_value(value):
165
+ chip.set('tool', tool, 'task', task, 'var', param_key, value,
166
+ step=step, index=index, clobber=False)
167
+
168
+ if require_key:
169
+ chip.add('tool', tool, 'task', task, 'require',
170
+ ','.join(('option', option_key)),
171
+ step=step, index=index)
172
+
173
+ return value
174
+
175
+ # Add library key
176
+ if not lib_key:
177
+ lib_key = f'{tool}_{param_key}'
178
+ lib_keys = []
179
+ for lib in get_libraries(chip, 'logic'):
180
+ if chip.valid('library', lib, 'option', 'var', lib_key) and \
181
+ chip.get('library', lib, 'option', 'var', lib_key):
182
+ lib_keys.append(('library', lib, 'option', 'var', lib_key))
183
+
184
+ values = set()
185
+ for lib_key in lib_keys:
186
+ chip.add('tool', tool, 'task', task, 'require', ','.join(lib_key), step=step, index=index)
187
+
188
+ get_step = step
189
+ get_index = index
190
+
191
+ if chip.get(*lib_key, field='pernode') == 'never':
192
+ get_step = None
193
+ get_index = None
194
+
195
+ values.update(chip.get(*lib_key, step=get_step, index=get_index))
196
+
197
+ if check_value(values):
198
+ chip.set('tool', tool, 'task', task, 'var', param_key, values,
199
+ step=step, index=index, clobber=False)
200
+
201
+ chip.add('tool', tool, 'task', task, 'require',
202
+ ','.join(['tool', tool, 'task', task, 'var', param_key]),
203
+ step=step, index=index)
204
+
205
+ return values
206
+
207
+
137
208
  def get_tool_task_var(chip,
138
209
  param_key,
139
210
  option_key=None,
@@ -145,7 +216,7 @@ def get_tool_task_var(chip,
145
216
  '''
146
217
  step = chip.get('arg', 'step')
147
218
  index = chip.get('arg', 'index')
148
- tool, _ = _common.get_tool_task(chip, step, index)
219
+ tool, _ = get_tool_task(chip, step, index)
149
220
  pdkname = chip.get('option', 'pdk')
150
221
  stackup = chip.get('option', 'stackup')
151
222
 
@@ -174,7 +245,7 @@ def get_tool_task_var(chip,
174
245
  option_key = f'{tool}_{param_key}'
175
246
  check_keys.append(['option', 'var', option_key])
176
247
 
177
- _, value = _common.pick_key(chip, reversed(check_keys), step=step, index=index)
248
+ _, value = pick_key(chip, reversed(check_keys), step=step, index=index)
178
249
 
179
250
  return value
180
251
 
@@ -49,8 +49,8 @@ proc sc_collect_pin_constraints {
49
49
  }
50
50
 
51
51
  set side_pin_order []
52
- dict for {index pin} $pins {
53
- lappend side_pin_order {*}$pin
52
+ foreach index [lsort -integer [dict keys $pins]] {
53
+ lappend side_pin_order {*}[dict get $pins $index]
54
54
  }
55
55
 
56
56
  set pin_layer_ordering [dict create]
@@ -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
 
@@ -0,0 +1,39 @@
1
+ '''
2
+ GTKWave is a fully featured GTK+ based wave viewer for Unix, Win32, and
3
+ Mac OSX which reads LXT, LXT2, VZT, FST, and GHW files as well as standard
4
+ Verilog VCD/EVCD files and allows their viewing.
5
+
6
+ Documentation: https://gtkwave.github.io/gtkwave/
7
+
8
+ Sources: https://github.com/gtkwave/gtkwave
9
+
10
+ Installation: https://github.com/gtkwave/gtkwave
11
+ '''
12
+
13
+ from siliconcompiler.tools._common import \
14
+ get_tool_task
15
+
16
+
17
+ def setup(chip):
18
+ step = chip.get('arg', 'step')
19
+ index = chip.get('arg', 'index')
20
+ tool, task = get_tool_task(chip, step, index)
21
+
22
+ chip.set('tool', tool, 'exe', 'gtkwave')
23
+ chip.set('tool', tool, 'vswitch', '--version')
24
+ chip.set('tool', tool, 'version', '>=v3.3.116', clobber=False)
25
+ chip.set('tool', tool, 'format', 'tcl', clobber=False)
26
+
27
+
28
+ ################################
29
+ # Version Check
30
+ ################################
31
+ def parse_version(stdout):
32
+ # First line: GTKWave Analyzer v3.3.116 (w)1999-2023 BSI
33
+ return stdout.split()[2]
34
+
35
+
36
+ def normalize_version(version):
37
+ if version[0] == 'v':
38
+ return version[1:]
39
+ return version
@@ -0,0 +1,34 @@
1
+ ###############################
2
+ # Reading SC Schema
3
+ ###############################
4
+
5
+ source ./sc_manifest.tcl
6
+
7
+ ##############################
8
+ # Schema Adapter
9
+ ###############################
10
+
11
+ set sc_step [sc_cfg_get arg step]
12
+ set sc_index [sc_cfg_get arg index]
13
+ set sc_flow [sc_cfg_get option flow]
14
+ set sc_tool [sc_cfg_get flowgraph $sc_flow $sc_step $sc_index tool]
15
+ set sc_task [sc_cfg_get flowgraph $sc_flow $sc_step $sc_index task]
16
+
17
+ ###############################
18
+ # Source pre-scripts
19
+ ###############################
20
+
21
+ if { [sc_cfg_tool_task_exists prescript] } {
22
+ foreach sc_pre_script [sc_cfg_tool_task_get prescript] {
23
+ puts "Sourcing pre script: ${sc_pre_script}"
24
+ source $sc_pre_script
25
+ }
26
+ }
27
+
28
+ ###############################
29
+ # Handle exit
30
+ ###############################
31
+
32
+ if { [lindex [sc_cfg_tool_task_get {var} show_exit] 0] == "true" } {
33
+ exit
34
+ }