siliconcompiler 0.33.0__py3-none-any.whl → 0.33.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 (177) hide show
  1. siliconcompiler/_common.py +5 -0
  2. siliconcompiler/_metadata.py +1 -1
  3. siliconcompiler/apps/sc_install.py +7 -0
  4. siliconcompiler/apps/sc_remote.py +7 -2
  5. siliconcompiler/apps/utils/replay.py +5 -5
  6. siliconcompiler/core.py +38 -12
  7. siliconcompiler/data/templates/replay/replay.sh.j2 +18 -1
  8. siliconcompiler/metric.py +78 -0
  9. siliconcompiler/package/git.py +1 -1
  10. siliconcompiler/record.py +63 -7
  11. siliconcompiler/remote/client.py +57 -14
  12. siliconcompiler/remote/server.py +110 -60
  13. siliconcompiler/report/dashboard/cli/__init__.py +2 -0
  14. siliconcompiler/report/dashboard/cli/board.py +34 -31
  15. siliconcompiler/report/report.py +10 -5
  16. siliconcompiler/report/utils.py +12 -6
  17. siliconcompiler/scheduler/__init__.py +146 -976
  18. siliconcompiler/scheduler/run_node.py +12 -5
  19. siliconcompiler/scheduler/send_messages.py +9 -3
  20. siliconcompiler/scheduler/slurm.py +10 -43
  21. siliconcompiler/scheduler/taskscheduler.py +320 -0
  22. siliconcompiler/schema/baseschema.py +25 -4
  23. siliconcompiler/schema/journalingschema.py +4 -0
  24. siliconcompiler/schema/schema_cfg.py +3 -3
  25. siliconcompiler/tool.py +201 -32
  26. siliconcompiler/tools/_common/__init__.py +14 -11
  27. siliconcompiler/tools/_common/asic.py +5 -5
  28. siliconcompiler/tools/bluespec/convert.py +2 -1
  29. siliconcompiler/tools/builtin/_common.py +9 -2
  30. siliconcompiler/tools/builtin/concatenate.py +6 -2
  31. siliconcompiler/tools/builtin/minimum.py +7 -2
  32. siliconcompiler/tools/builtin/mux.py +7 -2
  33. siliconcompiler/tools/builtin/nop.py +7 -2
  34. siliconcompiler/tools/builtin/verify.py +7 -3
  35. siliconcompiler/tools/chisel/convert.py +10 -10
  36. siliconcompiler/tools/klayout/drc.py +2 -2
  37. siliconcompiler/tools/klayout/klayout_show.py +6 -6
  38. siliconcompiler/tools/klayout/klayout_utils.py +12 -12
  39. siliconcompiler/tools/netgen/count_lvs.py +2 -2
  40. siliconcompiler/tools/netgen/lvs.py +1 -1
  41. siliconcompiler/tools/openroad/_apr.py +2 -2
  42. siliconcompiler/tools/openroad/scripts/apr/sc_init_floorplan.tcl +1 -7
  43. siliconcompiler/tools/openroad/scripts/common/procs.tcl +18 -0
  44. siliconcompiler/tools/openroad/scripts/common/read_input_files.tcl +1 -7
  45. siliconcompiler/tools/opensta/scripts/sc_timing.tcl +10 -0
  46. siliconcompiler/tools/opensta/timing.py +11 -0
  47. siliconcompiler/tools/slang/__init__.py +6 -5
  48. siliconcompiler/tools/slang/elaborate.py +6 -6
  49. siliconcompiler/tools/slang/lint.py +1 -3
  50. siliconcompiler/tools/vpr/_xml_constraint.py +8 -8
  51. siliconcompiler/tools/yosys/prepareLib.py +2 -2
  52. siliconcompiler/tools/yosys/sc_synth_asic.tcl +43 -5
  53. siliconcompiler/tools/yosys/screenshot.py +1 -1
  54. siliconcompiler/tools/yosys/syn_asic.py +5 -5
  55. siliconcompiler/toolscripts/_tools.json +17 -10
  56. siliconcompiler/toolscripts/rhel8/install-chisel.sh +9 -2
  57. siliconcompiler/toolscripts/rhel8/install-icarus.sh +10 -3
  58. siliconcompiler/toolscripts/rhel8/install-klayout.sh +8 -1
  59. siliconcompiler/toolscripts/rhel8/install-magic.sh +9 -2
  60. siliconcompiler/toolscripts/rhel8/install-montage.sh +1 -1
  61. siliconcompiler/toolscripts/rhel8/install-netgen.sh +9 -2
  62. siliconcompiler/toolscripts/rhel8/install-slang.sh +11 -4
  63. siliconcompiler/toolscripts/rhel8/install-surelog.sh +9 -2
  64. siliconcompiler/toolscripts/rhel8/install-sv2v.sh +11 -4
  65. siliconcompiler/toolscripts/rhel8/install-verible.sh +11 -3
  66. siliconcompiler/toolscripts/rhel8/install-verilator.sh +10 -3
  67. siliconcompiler/toolscripts/rhel8/install-xyce.sh +15 -10
  68. siliconcompiler/toolscripts/rhel9/install-chisel.sh +9 -2
  69. siliconcompiler/toolscripts/rhel9/install-ghdl.sh +9 -2
  70. siliconcompiler/toolscripts/rhel9/install-gtkwave.sh +10 -3
  71. siliconcompiler/toolscripts/rhel9/install-icarus.sh +10 -3
  72. siliconcompiler/toolscripts/rhel9/install-klayout.sh +8 -1
  73. siliconcompiler/toolscripts/rhel9/install-magic.sh +9 -2
  74. siliconcompiler/toolscripts/rhel9/install-montage.sh +1 -1
  75. siliconcompiler/toolscripts/rhel9/install-netgen.sh +9 -2
  76. siliconcompiler/toolscripts/rhel9/install-openroad.sh +16 -3
  77. siliconcompiler/toolscripts/rhel9/install-opensta.sh +17 -5
  78. siliconcompiler/toolscripts/rhel9/install-slang.sh +11 -4
  79. siliconcompiler/toolscripts/rhel9/install-surelog.sh +9 -2
  80. siliconcompiler/toolscripts/rhel9/install-sv2v.sh +11 -4
  81. siliconcompiler/toolscripts/rhel9/install-verible.sh +11 -3
  82. siliconcompiler/toolscripts/rhel9/install-verilator.sh +10 -3
  83. siliconcompiler/toolscripts/rhel9/install-vpr.sh +9 -2
  84. siliconcompiler/toolscripts/rhel9/install-xdm.sh +10 -2
  85. siliconcompiler/toolscripts/rhel9/install-xyce.sh +15 -10
  86. siliconcompiler/toolscripts/rhel9/install-yosys-moosic.sh +9 -2
  87. siliconcompiler/toolscripts/rhel9/install-yosys-parmys.sh +10 -3
  88. siliconcompiler/toolscripts/rhel9/install-yosys-slang.sh +10 -2
  89. siliconcompiler/toolscripts/rhel9/install-yosys.sh +9 -2
  90. siliconcompiler/toolscripts/ubuntu20/install-bambu.sh +10 -2
  91. siliconcompiler/toolscripts/ubuntu20/install-bluespec.sh +10 -3
  92. siliconcompiler/toolscripts/ubuntu20/install-chisel.sh +9 -2
  93. siliconcompiler/toolscripts/ubuntu20/install-ghdl.sh +9 -2
  94. siliconcompiler/toolscripts/ubuntu20/install-gtkwave.sh +9 -2
  95. siliconcompiler/toolscripts/ubuntu20/install-icarus.sh +9 -2
  96. siliconcompiler/toolscripts/ubuntu20/install-icepack.sh +9 -2
  97. siliconcompiler/toolscripts/ubuntu20/install-klayout.sh +8 -1
  98. siliconcompiler/toolscripts/ubuntu20/install-magic.sh +9 -2
  99. siliconcompiler/toolscripts/ubuntu20/install-montage.sh +1 -1
  100. siliconcompiler/toolscripts/ubuntu20/install-netgen.sh +9 -2
  101. siliconcompiler/toolscripts/ubuntu20/install-nextpnr.sh +9 -2
  102. siliconcompiler/toolscripts/ubuntu20/install-openroad.sh +16 -3
  103. siliconcompiler/toolscripts/ubuntu20/install-opensta.sh +16 -5
  104. siliconcompiler/toolscripts/ubuntu20/install-slang.sh +11 -4
  105. siliconcompiler/toolscripts/ubuntu20/install-slurm.sh +9 -2
  106. siliconcompiler/toolscripts/ubuntu20/install-surelog.sh +10 -2
  107. siliconcompiler/toolscripts/ubuntu20/install-sv2v.sh +11 -4
  108. siliconcompiler/toolscripts/ubuntu20/install-verible.sh +11 -3
  109. siliconcompiler/toolscripts/ubuntu20/install-verilator.sh +9 -2
  110. siliconcompiler/toolscripts/ubuntu20/install-xdm.sh +10 -2
  111. siliconcompiler/toolscripts/ubuntu20/install-xyce.sh +13 -8
  112. siliconcompiler/toolscripts/ubuntu20/install-yosys-moosic.sh +9 -2
  113. siliconcompiler/toolscripts/ubuntu20/install-yosys.sh +9 -2
  114. siliconcompiler/toolscripts/ubuntu22/install-bambu.sh +10 -2
  115. siliconcompiler/toolscripts/ubuntu22/install-bluespec.sh +10 -3
  116. siliconcompiler/toolscripts/ubuntu22/install-chisel.sh +9 -2
  117. siliconcompiler/toolscripts/ubuntu22/install-ghdl.sh +9 -2
  118. siliconcompiler/toolscripts/ubuntu22/install-gtkwave.sh +9 -2
  119. siliconcompiler/toolscripts/ubuntu22/install-icarus.sh +9 -2
  120. siliconcompiler/toolscripts/ubuntu22/install-icepack.sh +9 -2
  121. siliconcompiler/toolscripts/ubuntu22/install-klayout.sh +12 -1
  122. siliconcompiler/toolscripts/ubuntu22/install-magic.sh +9 -2
  123. siliconcompiler/toolscripts/ubuntu22/install-montage.sh +1 -1
  124. siliconcompiler/toolscripts/ubuntu22/install-netgen.sh +9 -2
  125. siliconcompiler/toolscripts/ubuntu22/install-nextpnr.sh +9 -2
  126. siliconcompiler/toolscripts/ubuntu22/install-openroad.sh +16 -3
  127. siliconcompiler/toolscripts/ubuntu22/install-opensta.sh +17 -5
  128. siliconcompiler/toolscripts/ubuntu22/install-slang.sh +11 -4
  129. siliconcompiler/toolscripts/ubuntu22/install-slurm.sh +9 -2
  130. siliconcompiler/toolscripts/ubuntu22/install-surelog.sh +10 -2
  131. siliconcompiler/toolscripts/ubuntu22/install-sv2v.sh +11 -4
  132. siliconcompiler/toolscripts/ubuntu22/install-verible.sh +11 -3
  133. siliconcompiler/toolscripts/ubuntu22/install-verilator.sh +9 -2
  134. siliconcompiler/toolscripts/ubuntu22/install-vpr.sh +9 -2
  135. siliconcompiler/toolscripts/ubuntu22/install-xdm.sh +10 -2
  136. siliconcompiler/toolscripts/ubuntu22/install-xyce.sh +13 -8
  137. siliconcompiler/toolscripts/ubuntu22/install-yosys-moosic.sh +9 -2
  138. siliconcompiler/toolscripts/ubuntu22/install-yosys-parmys.sh +10 -3
  139. siliconcompiler/toolscripts/ubuntu22/install-yosys-slang.sh +10 -2
  140. siliconcompiler/toolscripts/ubuntu22/install-yosys.sh +9 -2
  141. siliconcompiler/toolscripts/ubuntu24/install-bambu.sh +12 -4
  142. siliconcompiler/toolscripts/ubuntu24/install-bluespec.sh +10 -3
  143. siliconcompiler/toolscripts/ubuntu24/install-chisel.sh +9 -2
  144. siliconcompiler/toolscripts/ubuntu24/install-ghdl.sh +9 -2
  145. siliconcompiler/toolscripts/ubuntu24/install-gtkwave.sh +9 -2
  146. siliconcompiler/toolscripts/ubuntu24/install-icarus.sh +9 -2
  147. siliconcompiler/toolscripts/ubuntu24/install-icepack.sh +9 -2
  148. siliconcompiler/toolscripts/ubuntu24/install-klayout.sh +12 -1
  149. siliconcompiler/toolscripts/ubuntu24/install-magic.sh +9 -2
  150. siliconcompiler/toolscripts/ubuntu24/install-montage.sh +1 -1
  151. siliconcompiler/toolscripts/ubuntu24/install-netgen.sh +9 -2
  152. siliconcompiler/toolscripts/ubuntu24/install-nextpnr.sh +9 -2
  153. siliconcompiler/toolscripts/ubuntu24/install-openroad.sh +16 -3
  154. siliconcompiler/toolscripts/ubuntu24/install-opensta.sh +17 -5
  155. siliconcompiler/toolscripts/ubuntu24/install-slang.sh +11 -4
  156. siliconcompiler/toolscripts/ubuntu24/install-slurm.sh +9 -2
  157. siliconcompiler/toolscripts/ubuntu24/install-surelog.sh +10 -2
  158. siliconcompiler/toolscripts/ubuntu24/install-sv2v.sh +11 -4
  159. siliconcompiler/toolscripts/ubuntu24/install-verible.sh +11 -3
  160. siliconcompiler/toolscripts/ubuntu24/install-verilator.sh +9 -2
  161. siliconcompiler/toolscripts/ubuntu24/install-vpr.sh +9 -2
  162. siliconcompiler/toolscripts/ubuntu24/install-xdm.sh +10 -2
  163. siliconcompiler/toolscripts/ubuntu24/install-xyce.sh +13 -8
  164. siliconcompiler/toolscripts/ubuntu24/install-yosys-moosic.sh +9 -2
  165. siliconcompiler/toolscripts/ubuntu24/install-yosys-parmys.sh +10 -3
  166. siliconcompiler/toolscripts/ubuntu24/install-yosys-slang.sh +10 -2
  167. siliconcompiler/toolscripts/ubuntu24/install-yosys.sh +9 -2
  168. siliconcompiler/utils/__init__.py +11 -0
  169. siliconcompiler/utils/flowgraph.py +6 -101
  170. siliconcompiler/utils/issue.py +15 -23
  171. siliconcompiler/utils/logging.py +2 -2
  172. {siliconcompiler-0.33.0.dist-info → siliconcompiler-0.33.2.dist-info}/METADATA +6 -5
  173. {siliconcompiler-0.33.0.dist-info → siliconcompiler-0.33.2.dist-info}/RECORD +177 -176
  174. {siliconcompiler-0.33.0.dist-info → siliconcompiler-0.33.2.dist-info}/WHEEL +1 -1
  175. {siliconcompiler-0.33.0.dist-info → siliconcompiler-0.33.2.dist-info}/entry_points.txt +0 -0
  176. {siliconcompiler-0.33.0.dist-info → siliconcompiler-0.33.2.dist-info}/licenses/LICENSE +0 -0
  177. {siliconcompiler-0.33.0.dist-info → siliconcompiler-0.33.2.dist-info}/top_level.txt +0 -0
siliconcompiler/tool.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import contextlib
2
+ import logging
2
3
  import os
3
4
  import psutil
4
5
  import re
@@ -32,8 +33,7 @@ from siliconcompiler import utils
32
33
  from siliconcompiler import sc_open
33
34
 
34
35
  from siliconcompiler.record import RecordTool
35
-
36
- from siliconcompiler.scheduler import print_traceback
36
+ from siliconcompiler.flowgraph import RuntimeFlowgraph
37
37
 
38
38
 
39
39
  class TaskError(Exception):
@@ -93,7 +93,7 @@ class ToolSchema(NamedSchema):
93
93
 
94
94
  self.set_runtime(None)
95
95
 
96
- def set_runtime(self, chip):
96
+ def set_runtime(self, chip, step=None, index=None):
97
97
  '''
98
98
  Sets the runtime information needed to properly execute a task.
99
99
  Note: unstable API
@@ -109,19 +109,22 @@ class ToolSchema(NamedSchema):
109
109
  self.__schema_full = chip.schema
110
110
  self.__logger = chip.logger
111
111
 
112
- self.__step = None
113
- self.__index = None
112
+ self.__step = step
113
+ self.__index = index
114
114
  self.__tool = None
115
115
  self.__task = None
116
116
 
117
117
  self.__schema_record = None
118
118
  self.__schema_metric = None
119
+ self.__schema_flow = None
119
120
  if self.__schema_full:
120
121
  self.__schema_record = self.__schema_full.get("record", field="schema")
121
122
  self.__schema_metric = self.__schema_full.get("metric", field="schema")
122
123
 
123
- self.__step = self.__schema_full.get('arg', 'step')
124
- self.__index = self.__schema_full.get('arg', 'index')
124
+ if not self.__step:
125
+ self.__step = self.__schema_full.get('arg', 'step')
126
+ if not self.__index:
127
+ self.__index = self.__schema_full.get('arg', 'index')
125
128
 
126
129
  if not self.__step or not self.__index:
127
130
  raise RuntimeError("step or index not specified")
@@ -129,10 +132,9 @@ class ToolSchema(NamedSchema):
129
132
  flow = self.__schema_full.get('option', 'flow')
130
133
  if not flow:
131
134
  raise RuntimeError("flow not specified")
132
- self.__tool = self.__schema_full.get(
133
- 'flowgraph', flow, self.__step, self.__index, 'tool')
134
- self.__task = self.__schema_full.get(
135
- 'flowgraph', flow, self.__step, self.__index, 'task')
135
+ self.__schema_flow = self.__schema_full.get("flowgraph", flow, field="schema")
136
+ self.__tool = self.__schema_flow.get(self.__step, self.__index, 'tool')
137
+ self.__task = self.__schema_flow.get(self.__step, self.__index, 'task')
136
138
 
137
139
  def node(self):
138
140
  '''
@@ -142,6 +144,14 @@ class ToolSchema(NamedSchema):
142
144
 
143
145
  return self.__step, self.__index
144
146
 
147
+ def tool(self):
148
+ '''
149
+ Returns:
150
+ task name
151
+ '''
152
+
153
+ return self.__tool
154
+
145
155
  def task(self):
146
156
  '''
147
157
  Returns:
@@ -173,6 +183,8 @@ class ToolSchema(NamedSchema):
173
183
  return self.__schema_record
174
184
  elif type == "metric":
175
185
  return self.__schema_metric
186
+ elif type == "flow":
187
+ return self.__schema_flow
176
188
  else:
177
189
  raise ValueError(f"{type} is not a schema section")
178
190
 
@@ -413,6 +425,10 @@ class ToolSchema(NamedSchema):
413
425
  replay_opts["exports"] = self.get_runtime_environmental_variables(include_path=include_path)
414
426
 
415
427
  replay_opts["executable"] = self.get('exe')
428
+ replay_opts["step"] = self.__step
429
+ replay_opts["index"] = self.__index
430
+ replay_opts["cfg_file"] = f"inputs/{self.__chip.design}.pkg.json"
431
+ replay_opts["node_only"] = 0 if replay_opts["executable"] else 1
416
432
 
417
433
  vswitch = self.get('vswitch')
418
434
  if vswitch:
@@ -424,23 +440,25 @@ class ToolSchema(NamedSchema):
424
440
  # detect file paths
425
441
  file_test = re.compile(r'^[/\.]')
426
442
 
427
- format_cmd = [replay_opts["executable"]]
443
+ if replay_opts["executable"]:
444
+ format_cmd = [replay_opts["executable"]]
428
445
 
429
- for cmdarg in self.get_runtime_arguments():
430
- add_new_line = len(format_cmd) == 1
446
+ for cmdarg in self.get_runtime_arguments():
447
+ add_new_line = len(format_cmd) == 1
431
448
 
432
- if arg_test.match(cmdarg) or file_test.match(cmdarg):
433
- add_new_line = True
434
- else:
435
- if not arg_test.match(format_cmd[-1]):
449
+ if arg_test.match(cmdarg) or file_test.match(cmdarg):
436
450
  add_new_line = True
451
+ else:
452
+ if not arg_test.match(format_cmd[-1]):
453
+ add_new_line = True
437
454
 
438
- cmdarg = shlex.quote(cmdarg)
439
- if add_new_line:
440
- format_cmd.append(cmdarg)
441
- else:
442
- format_cmd[-1] += f' {cmdarg}'
443
-
455
+ cmdarg = shlex.quote(cmdarg)
456
+ if add_new_line:
457
+ format_cmd.append(cmdarg)
458
+ else:
459
+ format_cmd[-1] += f' {cmdarg}'
460
+ else:
461
+ format_cmd = []
444
462
  replay_opts["cmds"] = format_cmd
445
463
 
446
464
  # create replay file
@@ -625,23 +643,22 @@ class ToolSchema(NamedSchema):
625
643
  retcode = self.run()
626
644
  except Exception as e:
627
645
  self.__logger.error(f'Failed in run() for {self.name()}/{self.__task}: {e}')
628
- retcode = 1 # default to non-zero
629
- print_traceback(self.__chip, e)
646
+ utils.print_traceback(self.__logger, e)
630
647
  raise e
631
648
  finally:
632
649
  with sc_open(stdout_file) as stdout_reader, \
633
650
  sc_open(stderr_file) as stderr_reader:
634
651
  read_stdio(stdout_reader, stderr_reader)
635
652
 
636
- try:
637
- if resource:
653
+ if resource:
654
+ try:
638
655
  # Since memory collection is not possible, collect the current process
639
656
  # peak memory
640
657
  max_mem_bytes = max(
641
658
  max_mem_bytes,
642
659
  1024 * resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
643
- except (OSError, ValueError, PermissionError):
644
- pass
660
+ except (OSError, ValueError, PermissionError):
661
+ pass
645
662
  else:
646
663
  cmdlist = self.get_runtime_arguments()
647
664
 
@@ -670,7 +687,7 @@ class ToolSchema(NamedSchema):
670
687
  data = os.read(fd, 1024)
671
688
  log_writer.write(data)
672
689
  return data
673
- retcode = pty.spawn(cmdlist, read)
690
+ retcode = pty.spawn([exe, *cmdlist], read)
674
691
  else:
675
692
  with open(stdout_file, 'w') as stdout_writer, \
676
693
  open(stdout_file, 'r', errors='replace_with_warning') as stdout_reader, \
@@ -715,7 +732,7 @@ class ToolSchema(NamedSchema):
715
732
 
716
733
  memory_usage = psutil.virtual_memory()
717
734
  if memory_usage.percent > MEMORY_WARN_LIMIT:
718
- self.__logger.warn(
735
+ self.__logger.warning(
719
736
  'Current system memory usage is '
720
737
  f'{memory_usage.percent:.1f}%')
721
738
 
@@ -774,6 +791,7 @@ class ToolSchema(NamedSchema):
774
791
  for key in list(state.keys()):
775
792
  if key.startswith("_ToolSchema__"):
776
793
  del state[key]
794
+
777
795
  return state
778
796
 
779
797
  def __setstate__(self, state):
@@ -782,6 +800,9 @@ class ToolSchema(NamedSchema):
782
800
  # Reinit runtime information
783
801
  self.set_runtime(None)
784
802
 
803
+ def get_output_files(self):
804
+ return set(self.get("task", self.__task, "output", step=self.__step, index=self.__index))
805
+
785
806
  ###############################################################
786
807
  def parse_version(self, stdout):
787
808
  raise NotImplementedError("must be implemented by the implementation class")
@@ -792,6 +813,15 @@ class ToolSchema(NamedSchema):
792
813
  def setup(self):
793
814
  pass
794
815
 
816
+ def select_input_nodes(self):
817
+ flow = self.schema("flow")
818
+ runtime = RuntimeFlowgraph(
819
+ flow,
820
+ from_steps=set([step for step, _ in flow.get_entry_nodes()]),
821
+ prune_nodes=self.__chip.get('option', 'prune'))
822
+
823
+ return runtime.get_node_inputs(self.__step, self.__index, record=self.schema("record"))
824
+
795
825
  def pre_process(self):
796
826
  pass
797
827
 
@@ -805,6 +835,145 @@ class ToolSchema(NamedSchema):
805
835
  pass
806
836
 
807
837
 
838
+ ###########################################################################
839
+ # Migration helper
840
+ ###########################################################################
841
+ class ToolSchemaTmp(ToolSchema):
842
+ def __module_func(self, name, modules):
843
+ for module in modules:
844
+ method = getattr(module, name, None)
845
+ if method:
846
+ return method
847
+ return None
848
+
849
+ def __tool_task_modules(self):
850
+ step, index = self.node()
851
+ flow = self._ToolSchema__chip.get('option', 'flow')
852
+ return \
853
+ self._ToolSchema__chip._get_tool_module(step, index, flow=flow), \
854
+ self._ToolSchema__chip._get_task_module(step, index, flow=flow)
855
+
856
+ def get_output_files(self):
857
+ _, task = self.__tool_task_modules()
858
+ method = self.__module_func("_gather_outputs", [task])
859
+ if method:
860
+ return method(self._ToolSchema__chip, *self.node())
861
+ return ToolSchema.get_output_files(self)
862
+
863
+ def parse_version(self, stdout):
864
+ tool, _ = self.__tool_task_modules()
865
+ method = self.__module_func("parse_version", [tool])
866
+ if method:
867
+ return method(stdout)
868
+ return ToolSchema.parse_version(self, stdout)
869
+
870
+ def normalize_version(self, version):
871
+ tool, _ = self.__tool_task_modules()
872
+ method = self.__module_func("normalize_version", [tool])
873
+ if method:
874
+ return method(version)
875
+ return ToolSchema.normalize_version(self, version)
876
+
877
+ def setup(self):
878
+ _, task = self.__tool_task_modules()
879
+ method = self.__module_func("setup", [task])
880
+ if method:
881
+ prev_step, prev_index = self._ToolSchema__chip.get('arg', 'step'), \
882
+ self._ToolSchema__chip.get('arg', 'index')
883
+ step, index = self.node()
884
+ self._ToolSchema__chip.set('arg', 'step', step)
885
+ self._ToolSchema__chip.set('arg', 'index', index)
886
+ ret = method(self._ToolSchema__chip)
887
+ self._ToolSchema__chip.set('arg', 'step', prev_step)
888
+ self._ToolSchema__chip.set('arg', 'index', prev_index)
889
+ return ret
890
+ return ToolSchema.setup(self)
891
+
892
+ def select_input_nodes(self):
893
+ _, task = self.__tool_task_modules()
894
+ method = self.__module_func("_select_inputs", [task])
895
+ if method:
896
+ prev_step, prev_index = self._ToolSchema__chip.get('arg', 'step'), \
897
+ self._ToolSchema__chip.get('arg', 'index')
898
+ step, index = self.node()
899
+ self._ToolSchema__chip.set('arg', 'step', step)
900
+ self._ToolSchema__chip.set('arg', 'index', index)
901
+ ret = method(self._ToolSchema__chip, *self.node())
902
+ self._ToolSchema__chip.set('arg', 'step', prev_step)
903
+ self._ToolSchema__chip.set('arg', 'index', prev_index)
904
+ return ret
905
+ return ToolSchema.select_input_nodes(self)
906
+
907
+ def pre_process(self):
908
+ _, task = self.__tool_task_modules()
909
+ method = self.__module_func("pre_process", [task])
910
+ if method:
911
+ prev_step, prev_index = self._ToolSchema__chip.get('arg', 'step'), \
912
+ self._ToolSchema__chip.get('arg', 'index')
913
+ step, index = self.node()
914
+ self._ToolSchema__chip.set('arg', 'step', step)
915
+ self._ToolSchema__chip.set('arg', 'index', index)
916
+ ret = method(self._ToolSchema__chip)
917
+ self._ToolSchema__chip.set('arg', 'step', prev_step)
918
+ self._ToolSchema__chip.set('arg', 'index', prev_index)
919
+ return ret
920
+ return ToolSchema.pre_process(self)
921
+
922
+ def runtime_options(self):
923
+ tool, task = self.__tool_task_modules()
924
+ method = self.__module_func("runtime_options", [task, tool])
925
+ if method:
926
+ prev_step, prev_index = self._ToolSchema__chip.get('arg', 'step'), \
927
+ self._ToolSchema__chip.get('arg', 'index')
928
+ step, index = self.node()
929
+ self._ToolSchema__chip.set('arg', 'step', step)
930
+ self._ToolSchema__chip.set('arg', 'index', index)
931
+ ret = method(self._ToolSchema__chip)
932
+ self._ToolSchema__chip.set('arg', 'step', prev_step)
933
+ self._ToolSchema__chip.set('arg', 'index', prev_index)
934
+ return ret
935
+ return ToolSchema.runtime_options(self)
936
+
937
+ def run(self):
938
+ _, task = self.__tool_task_modules()
939
+ method = self.__module_func("run", [task])
940
+ if method:
941
+ # Handle logger stdout suppression if quiet
942
+ step, index = self.node()
943
+ stdout_handler_level = self._ToolSchema__chip.logger._console.level
944
+ if self._ToolSchema__chip.get('option', 'quiet', step=step, index=index):
945
+ self._ToolSchema__chip.logger._console.setLevel(logging.CRITICAL)
946
+
947
+ prev_step, prev_index = self._ToolSchema__chip.get('arg', 'step'), \
948
+ self._ToolSchema__chip.get('arg', 'index')
949
+ step, index = self.node()
950
+ self._ToolSchema__chip.set('arg', 'step', step)
951
+ self._ToolSchema__chip.set('arg', 'index', index)
952
+ retcode = method(self._ToolSchema__chip)
953
+ self._ToolSchema__chip.set('arg', 'step', prev_step)
954
+ self._ToolSchema__chip.set('arg', 'index', prev_index)
955
+
956
+ self._ToolSchema__chip.logger._console.setLevel(stdout_handler_level)
957
+
958
+ return retcode
959
+ return ToolSchema.run(self)
960
+
961
+ def post_process(self):
962
+ _, task = self.__tool_task_modules()
963
+ method = self.__module_func("post_process", [task])
964
+ if method:
965
+ prev_step, prev_index = self._ToolSchema__chip.get('arg', 'step'), \
966
+ self._ToolSchema__chip.get('arg', 'index')
967
+ step, index = self.node()
968
+ self._ToolSchema__chip.set('arg', 'step', step)
969
+ self._ToolSchema__chip.set('arg', 'index', index)
970
+ ret = method(self._ToolSchema__chip)
971
+ self._ToolSchema__chip.set('arg', 'step', prev_step)
972
+ self._ToolSchema__chip.set('arg', 'index', prev_index)
973
+ return ret
974
+ return ToolSchema.post_process(self)
975
+
976
+
808
977
  ###########################################################################
809
978
  # Tool Setup
810
979
  ###########################################################################
@@ -377,17 +377,20 @@ def input_file_node_name(filename, step, index):
377
377
 
378
378
  file_type = get_file_ext(filename)
379
379
 
380
- base = filename
381
- total_ext = []
382
- ext = None
383
- while ext != file_type:
384
- base, ext = os.path.splitext(base)
385
- ext = ext[1:].lower()
386
- total_ext.append(ext)
387
-
388
- total_ext.reverse()
389
-
390
- return f'{base}.{step}{index}.{".".join(total_ext)}'
380
+ if file_type:
381
+ base = filename
382
+ ext = None
383
+ total_ext = []
384
+ while ext != file_type:
385
+ base, ext = os.path.splitext(base)
386
+ ext = ext[1:].lower()
387
+ total_ext.append(ext)
388
+
389
+ total_ext.reverse()
390
+
391
+ return f'{base}.{step}{index}.{".".join(total_ext)}'
392
+ else:
393
+ return f'{filename}.{step}{index}'
391
394
 
392
395
 
393
396
  def add_common_file(chip, key, file):
@@ -257,10 +257,10 @@ class CellArea:
257
257
  def __init__(self):
258
258
  self.__areas = {}
259
259
 
260
- def addCell(self, name=None, module=None,
261
- cellarea=None, cellcount=None,
262
- macroarea=None, macrocount=None,
263
- stdcellarea=None, stdcellcount=None):
260
+ def add_cell(self, name=None, module=None,
261
+ cellarea=None, cellcount=None,
262
+ macroarea=None, macrocount=None,
263
+ stdcellarea=None, stdcellcount=None):
264
264
  if not name and not module:
265
265
  return
266
266
 
@@ -294,6 +294,6 @@ class CellArea:
294
294
  def size(self):
295
295
  return len(self.__areas)
296
296
 
297
- def writeReport(self, path):
297
+ def write_report(self, path):
298
298
  with open(path, 'w') as f:
299
299
  json.dump(self.__areas, f, indent=4)
@@ -125,7 +125,8 @@ def post_process(chip):
125
125
  if os.path.exists(mod_path):
126
126
  extra_modules.add(mod_path)
127
127
  else:
128
- chip.logger.warn(f"Unable to find module {module} source files at: {BSC_LIB}")
128
+ chip.logger.warning(f"Unable to find module {module} source "
129
+ f"files at: {BSC_LIB}")
129
130
 
130
131
  # bsc outputs each compiled module to its own Verilog file, so we
131
132
  # concatenate them all to create a pickled output we can pass along.
@@ -3,7 +3,7 @@ from siliconcompiler import NodeStatus, SiliconCompilerError
3
3
  from siliconcompiler import utils
4
4
  import shutil
5
5
  from siliconcompiler.tools._common import get_tool_task
6
- from siliconcompiler.utils.flowgraph import _get_pruned_node_inputs
6
+ from siliconcompiler.flowgraph import RuntimeFlowgraph
7
7
 
8
8
 
9
9
  ###########################################################################
@@ -152,4 +152,11 @@ def _select_inputs(chip, step, index):
152
152
  chip.logger.info(f"Running builtin task '{task}'")
153
153
 
154
154
  flow = chip.get('option', 'flow')
155
- return _get_pruned_node_inputs(chip, flow, (step, index))
155
+
156
+ flow_schema = chip.schema.get("flowgraph", flow, field="schema")
157
+ runtime = RuntimeFlowgraph(
158
+ flow_schema,
159
+ from_steps=set([step for step, _ in flow_schema.get_entry_nodes()]),
160
+ prune_nodes=chip.get('option', 'prune'))
161
+
162
+ return runtime.get_node_inputs(step, index, record=chip.schema.get("record", field="schema"))
@@ -3,7 +3,6 @@ import os
3
3
  from siliconcompiler import sc_open, SiliconCompilerError
4
4
  from siliconcompiler import utils
5
5
  from siliconcompiler.tools._common import input_provides, input_file_node_name, get_tool_task
6
- from siliconcompiler.utils import flowgraph
7
6
  from siliconcompiler import scheduler
8
7
 
9
8
 
@@ -63,7 +62,12 @@ def _gather_outputs(chip, step, index):
63
62
  flow = chip.get('option', 'flow')
64
63
 
65
64
  in_nodes = chip.get('flowgraph', flow, step, index, 'input')
66
- in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
65
+ in_task_outputs = []
66
+ for in_step, in_index in in_nodes:
67
+ in_tool, _ = get_tool_task(chip, in_step, in_index, flow=flow)
68
+ task_class = chip.get("tool", in_tool, field="schema")
69
+ task_class.set_runtime(chip, step=in_step, index=in_index)
70
+ in_task_outputs.append(task_class.get_output_files())
67
71
 
68
72
  if len(in_task_outputs) > 0:
69
73
  return in_task_outputs[0].union(*in_task_outputs[1:])
@@ -1,6 +1,6 @@
1
1
  from siliconcompiler.tools.builtin import _common
2
- from siliconcompiler.utils import flowgraph
3
2
  from siliconcompiler.tools.builtin.builtin import set_io_files
3
+ from siliconcompiler.tools._common import get_tool_task
4
4
 
5
5
 
6
6
  def setup(chip):
@@ -41,7 +41,12 @@ def _gather_outputs(chip, step, index):
41
41
  flow = chip.get('option', 'flow')
42
42
 
43
43
  in_nodes = chip.get('flowgraph', flow, step, index, 'input')
44
- in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
44
+ in_task_outputs = []
45
+ for in_step, in_index in in_nodes:
46
+ in_tool, _ = get_tool_task(chip, in_step, in_index, flow=flow)
47
+ task_class = chip.get("tool", in_tool, field="schema")
48
+ task_class.set_runtime(chip, step=in_step, index=in_index)
49
+ in_task_outputs.append(task_class.get_output_files())
45
50
 
46
51
  if len(in_task_outputs) > 0:
47
52
  return in_task_outputs[0].intersection(*in_task_outputs[1:])
@@ -2,7 +2,7 @@ from siliconcompiler.tools.builtin import _common
2
2
  import re
3
3
  from siliconcompiler.tools.builtin.builtin import set_io_files
4
4
  from siliconcompiler import SiliconCompilerError
5
- from siliconcompiler.utils import flowgraph
5
+ from siliconcompiler.tools._common import get_tool_task
6
6
 
7
7
 
8
8
  def setup(chip):
@@ -55,7 +55,12 @@ def _gather_outputs(chip, step, index):
55
55
  flow = chip.get('option', 'flow')
56
56
 
57
57
  in_nodes = chip.get('flowgraph', flow, step, index, 'input')
58
- in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
58
+ in_task_outputs = []
59
+ for in_step, in_index in in_nodes:
60
+ in_tool, _ = get_tool_task(chip, in_step, in_index, flow=flow)
61
+ task_class = chip.get("tool", in_tool, field="schema")
62
+ task_class.set_runtime(chip, step=in_step, index=in_index)
63
+ in_task_outputs.append(task_class.get_output_files())
59
64
 
60
65
  if len(in_task_outputs) > 0:
61
66
  return in_task_outputs[0].intersection(*in_task_outputs[1:])
@@ -1,6 +1,6 @@
1
1
  from siliconcompiler.tools.builtin import _common
2
2
  from siliconcompiler.tools.builtin.builtin import set_io_files
3
- from siliconcompiler.utils import flowgraph
3
+ from siliconcompiler.tools._common import get_tool_task
4
4
 
5
5
 
6
6
  def setup(chip):
@@ -22,7 +22,12 @@ def _gather_outputs(chip, step, index):
22
22
  flow = chip.get('option', 'flow')
23
23
 
24
24
  in_nodes = chip.get('flowgraph', flow, step, index, 'input')
25
- in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
25
+ in_task_outputs = []
26
+ for in_step, in_index in in_nodes:
27
+ in_tool, _ = get_tool_task(chip, in_step, in_index, flow=flow)
28
+ task_class = chip.get("tool", in_tool, field="schema")
29
+ task_class.set_runtime(chip, step=in_step, index=in_index)
30
+ in_task_outputs.append(task_class.get_output_files())
26
31
 
27
32
  if len(in_task_outputs) > 0:
28
33
  return in_task_outputs[0].union(*in_task_outputs[1:])
@@ -3,11 +3,10 @@ from siliconcompiler.schema.parametertype import NodeType
3
3
  from siliconcompiler.scheduler import _haltstep
4
4
  from siliconcompiler.tools.builtin.builtin import set_io_files
5
5
  from siliconcompiler import utils, SiliconCompilerError
6
+ from siliconcompiler.tools._common import get_tool_task
6
7
 
7
8
  import re
8
9
 
9
- from siliconcompiler.utils import flowgraph
10
-
11
10
 
12
11
  def setup(chip):
13
12
  '''
@@ -69,7 +68,12 @@ def _gather_outputs(chip, step, index):
69
68
  flow = chip.get('option', 'flow')
70
69
 
71
70
  in_nodes = chip.get('flowgraph', flow, step, index, 'input')
72
- in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
71
+ in_task_outputs = []
72
+ for in_step, in_index in in_nodes:
73
+ in_tool, _ = get_tool_task(chip, in_step, in_index, flow=flow)
74
+ task_class = chip.get("tool", in_tool, field="schema")
75
+ task_class.set_runtime(chip, step=in_step, index=in_index)
76
+ in_task_outputs.append(task_class.get_output_files())
73
77
 
74
78
  if len(in_task_outputs) > 0:
75
79
  return in_task_outputs[0].intersection(*in_task_outputs[1:])
@@ -103,7 +103,7 @@ def runtime_options(chip):
103
103
 
104
104
  design = chip.top()
105
105
 
106
- runMain = ["runMain"]
106
+ run_main = ["runMain"]
107
107
  if chip.valid('input', 'config', 'chisel') and \
108
108
  chip.get('input', 'config', 'chisel', step=step, index=index):
109
109
  app = design
@@ -112,23 +112,23 @@ def runtime_options(chip):
112
112
  app = chip.get('tool', tool, 'task', task, 'var', 'application',
113
113
  step=step, index=index)[0]
114
114
 
115
- runMain.append(f"{app}")
115
+ run_main.append(f"{app}")
116
116
 
117
117
  if chip.valid('tool', tool, 'task', task, 'var', 'argument') and \
118
118
  chip.get('tool', tool, 'task', task, 'var', 'argument', step=step, index=index):
119
- runMain.extend(chip.get('tool', tool, 'task', task, 'var', 'argument',
120
- step=step, index=index))
121
- runMain.append("--")
119
+ run_main.extend(chip.get('tool', tool, 'task', task, 'var', 'argument',
120
+ step=step, index=index))
121
+ run_main.append("--")
122
122
 
123
- runMain.extend(["--target-dir", "chisel-output"])
123
+ run_main.extend(["--target-dir", "chisel-output"])
124
124
  else:
125
125
  # Use built in driver
126
- runMain.append("SCDriver")
127
- runMain.extend(["--module", chip.top(step=step, index=index)])
126
+ run_main.append("SCDriver")
127
+ run_main.extend(["--module", chip.top(step=step, index=index)])
128
128
 
129
- runMain.extend(["--output-file", f"../outputs/{design}.v"])
129
+ run_main.extend(["--output-file", f"../outputs/{design}.v"])
130
130
 
131
- return [" ".join(runMain)]
131
+ return [" ".join(run_main)]
132
132
 
133
133
 
134
134
  def post_process(chip):
@@ -6,7 +6,7 @@ from siliconcompiler.tools._common import input_provides, has_input_files, \
6
6
  from siliconcompiler.tools._common.asic import set_tool_task_var, get_tool_task_var
7
7
 
8
8
  from siliconcompiler.tools.klayout.klayout import setup as setup_tool
9
- import xml.etree.ElementTree as ET
9
+ from xml.etree import ElementTree
10
10
  from siliconcompiler import utils
11
11
 
12
12
 
@@ -144,7 +144,7 @@ def post_process(chip):
144
144
  drc_report = None
145
145
  if os.path.isfile(drc_db):
146
146
  with open(drc_db, "r") as f:
147
- drc_report = ET.fromstring(f.read())
147
+ drc_report = ElementTree.fromstring(f.read())
148
148
  if drc_report is None:
149
149
  drc_db = []
150
150
 
@@ -17,18 +17,18 @@ def show(schema, tech, input_path, output_path, screenshot=False, report=None):
17
17
  sc_hide_layers = []
18
18
 
19
19
  # Load KLayout technology file
20
- layoutOptions = tech.load_layout_options
20
+ layout_options = tech.load_layout_options
21
21
 
22
22
  # These may be disabled in our KLayout tech file for reasons relating to GDS
23
23
  # export, but for the purposes of viewing we'll hardcode them to True.
24
- layoutOptions.lefdef_config.produce_blockages = True
25
- layoutOptions.lefdef_config.produce_cell_outlines = True
26
- layoutOptions.lefdef_config.produce_obstructions = True
24
+ layout_options.lefdef_config.produce_blockages = True
25
+ layout_options.lefdef_config.produce_cell_outlines = True
26
+ layout_options.lefdef_config.produce_obstructions = True
27
27
 
28
28
  # Always use LEF geometry even when LEF file contains FOREIGN statement.
29
- layoutOptions.lefdef_config.macro_resolution_mode = 1
29
+ layout_options.lefdef_config.macro_resolution_mode = 1
30
30
 
31
- tech.load_layout_options = layoutOptions
31
+ tech.load_layout_options = layout_options
32
32
 
33
33
  app = pya.Application.instance()
34
34
  main_window = pya.MainWindow.instance()