siliconcompiler 0.26.5__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 (251) hide show
  1. siliconcompiler/__init__.py +24 -0
  2. siliconcompiler/__main__.py +12 -0
  3. siliconcompiler/_common.py +49 -0
  4. siliconcompiler/_metadata.py +36 -0
  5. siliconcompiler/apps/__init__.py +0 -0
  6. siliconcompiler/apps/_common.py +76 -0
  7. siliconcompiler/apps/sc.py +92 -0
  8. siliconcompiler/apps/sc_dashboard.py +94 -0
  9. siliconcompiler/apps/sc_issue.py +178 -0
  10. siliconcompiler/apps/sc_remote.py +199 -0
  11. siliconcompiler/apps/sc_server.py +39 -0
  12. siliconcompiler/apps/sc_show.py +142 -0
  13. siliconcompiler/apps/smake.py +232 -0
  14. siliconcompiler/checklists/__init__.py +0 -0
  15. siliconcompiler/checklists/oh_tapeout.py +41 -0
  16. siliconcompiler/core.py +3221 -0
  17. siliconcompiler/data/RobotoMono/LICENSE.txt +202 -0
  18. siliconcompiler/data/RobotoMono/RobotoMono-Regular.ttf +0 -0
  19. siliconcompiler/data/heartbeat.v +18 -0
  20. siliconcompiler/data/logo.png +0 -0
  21. siliconcompiler/flowgraph.py +570 -0
  22. siliconcompiler/flows/__init__.py +0 -0
  23. siliconcompiler/flows/_common.py +67 -0
  24. siliconcompiler/flows/asicflow.py +180 -0
  25. siliconcompiler/flows/asictopflow.py +38 -0
  26. siliconcompiler/flows/dvflow.py +86 -0
  27. siliconcompiler/flows/fpgaflow.py +202 -0
  28. siliconcompiler/flows/generate_openroad_rcx.py +66 -0
  29. siliconcompiler/flows/lintflow.py +35 -0
  30. siliconcompiler/flows/screenshotflow.py +51 -0
  31. siliconcompiler/flows/showflow.py +59 -0
  32. siliconcompiler/flows/signoffflow.py +53 -0
  33. siliconcompiler/flows/synflow.py +128 -0
  34. siliconcompiler/fpgas/__init__.py +0 -0
  35. siliconcompiler/fpgas/lattice_ice40.py +42 -0
  36. siliconcompiler/fpgas/vpr_example.py +109 -0
  37. siliconcompiler/issue.py +300 -0
  38. siliconcompiler/libs/__init__.py +0 -0
  39. siliconcompiler/libs/asap7sc7p5t.py +8 -0
  40. siliconcompiler/libs/gf180mcu.py +8 -0
  41. siliconcompiler/libs/nangate45.py +8 -0
  42. siliconcompiler/libs/sky130hd.py +8 -0
  43. siliconcompiler/libs/sky130io.py +8 -0
  44. siliconcompiler/package.py +412 -0
  45. siliconcompiler/pdks/__init__.py +0 -0
  46. siliconcompiler/pdks/asap7.py +8 -0
  47. siliconcompiler/pdks/freepdk45.py +8 -0
  48. siliconcompiler/pdks/gf180.py +8 -0
  49. siliconcompiler/pdks/skywater130.py +8 -0
  50. siliconcompiler/remote/__init__.py +36 -0
  51. siliconcompiler/remote/client.py +891 -0
  52. siliconcompiler/remote/schema.py +106 -0
  53. siliconcompiler/remote/server.py +507 -0
  54. siliconcompiler/remote/server_schema/requests/cancel_job.json +51 -0
  55. siliconcompiler/remote/server_schema/requests/check_progress.json +61 -0
  56. siliconcompiler/remote/server_schema/requests/check_server.json +38 -0
  57. siliconcompiler/remote/server_schema/requests/delete_job.json +51 -0
  58. siliconcompiler/remote/server_schema/requests/get_results.json +48 -0
  59. siliconcompiler/remote/server_schema/requests/remote_run.json +40 -0
  60. siliconcompiler/remote/server_schema/responses/cancel_job.json +18 -0
  61. siliconcompiler/remote/server_schema/responses/check_progress.json +30 -0
  62. siliconcompiler/remote/server_schema/responses/check_server.json +32 -0
  63. siliconcompiler/remote/server_schema/responses/delete_job.json +18 -0
  64. siliconcompiler/remote/server_schema/responses/get_results.json +21 -0
  65. siliconcompiler/remote/server_schema/responses/remote_run.json +25 -0
  66. siliconcompiler/report/__init__.py +13 -0
  67. siliconcompiler/report/html_report.py +74 -0
  68. siliconcompiler/report/report.py +355 -0
  69. siliconcompiler/report/streamlit_report.py +137 -0
  70. siliconcompiler/report/streamlit_viewer.py +944 -0
  71. siliconcompiler/report/summary_image.py +117 -0
  72. siliconcompiler/report/summary_table.py +105 -0
  73. siliconcompiler/report/utils.py +163 -0
  74. siliconcompiler/scheduler/__init__.py +2092 -0
  75. siliconcompiler/scheduler/docker_runner.py +253 -0
  76. siliconcompiler/scheduler/run_node.py +138 -0
  77. siliconcompiler/scheduler/send_messages.py +178 -0
  78. siliconcompiler/scheduler/slurm.py +208 -0
  79. siliconcompiler/scheduler/validation/email_credentials.json +54 -0
  80. siliconcompiler/schema/__init__.py +7 -0
  81. siliconcompiler/schema/schema_cfg.py +4014 -0
  82. siliconcompiler/schema/schema_obj.py +1841 -0
  83. siliconcompiler/schema/utils.py +93 -0
  84. siliconcompiler/sphinx_ext/__init__.py +0 -0
  85. siliconcompiler/sphinx_ext/dynamicgen.py +1006 -0
  86. siliconcompiler/sphinx_ext/schemagen.py +221 -0
  87. siliconcompiler/sphinx_ext/utils.py +166 -0
  88. siliconcompiler/targets/__init__.py +0 -0
  89. siliconcompiler/targets/asap7_demo.py +68 -0
  90. siliconcompiler/targets/asic_demo.py +38 -0
  91. siliconcompiler/targets/fpgaflow_demo.py +47 -0
  92. siliconcompiler/targets/freepdk45_demo.py +59 -0
  93. siliconcompiler/targets/gf180_demo.py +77 -0
  94. siliconcompiler/targets/skywater130_demo.py +70 -0
  95. siliconcompiler/templates/email/general.j2 +66 -0
  96. siliconcompiler/templates/email/summary.j2 +43 -0
  97. siliconcompiler/templates/issue/README.txt +26 -0
  98. siliconcompiler/templates/issue/run.sh +6 -0
  99. siliconcompiler/templates/report/bootstrap.min.css +7 -0
  100. siliconcompiler/templates/report/bootstrap.min.js +7 -0
  101. siliconcompiler/templates/report/bootstrap_LICENSE.md +24 -0
  102. siliconcompiler/templates/report/sc_report.j2 +427 -0
  103. siliconcompiler/templates/slurm/run.sh +9 -0
  104. siliconcompiler/templates/tcl/manifest.tcl.j2 +137 -0
  105. siliconcompiler/tools/__init__.py +0 -0
  106. siliconcompiler/tools/_common/__init__.py +432 -0
  107. siliconcompiler/tools/_common/asic.py +115 -0
  108. siliconcompiler/tools/_common/sdc/sc_constraints.sdc +76 -0
  109. siliconcompiler/tools/_common/tcl/sc_pin_constraints.tcl +63 -0
  110. siliconcompiler/tools/bambu/bambu.py +32 -0
  111. siliconcompiler/tools/bambu/convert.py +77 -0
  112. siliconcompiler/tools/bluespec/bluespec.py +40 -0
  113. siliconcompiler/tools/bluespec/convert.py +103 -0
  114. siliconcompiler/tools/builtin/_common.py +155 -0
  115. siliconcompiler/tools/builtin/builtin.py +26 -0
  116. siliconcompiler/tools/builtin/concatenate.py +85 -0
  117. siliconcompiler/tools/builtin/join.py +27 -0
  118. siliconcompiler/tools/builtin/maximum.py +46 -0
  119. siliconcompiler/tools/builtin/minimum.py +57 -0
  120. siliconcompiler/tools/builtin/mux.py +70 -0
  121. siliconcompiler/tools/builtin/nop.py +38 -0
  122. siliconcompiler/tools/builtin/verify.py +83 -0
  123. siliconcompiler/tools/chisel/SCDriver.scala +10 -0
  124. siliconcompiler/tools/chisel/build.sbt +27 -0
  125. siliconcompiler/tools/chisel/chisel.py +37 -0
  126. siliconcompiler/tools/chisel/convert.py +140 -0
  127. siliconcompiler/tools/execute/exec_input.py +41 -0
  128. siliconcompiler/tools/execute/execute.py +17 -0
  129. siliconcompiler/tools/genfasm/bitstream.py +61 -0
  130. siliconcompiler/tools/genfasm/genfasm.py +40 -0
  131. siliconcompiler/tools/ghdl/convert.py +87 -0
  132. siliconcompiler/tools/ghdl/ghdl.py +41 -0
  133. siliconcompiler/tools/icarus/compile.py +87 -0
  134. siliconcompiler/tools/icarus/icarus.py +36 -0
  135. siliconcompiler/tools/icepack/bitstream.py +20 -0
  136. siliconcompiler/tools/icepack/icepack.py +43 -0
  137. siliconcompiler/tools/klayout/export.py +117 -0
  138. siliconcompiler/tools/klayout/klayout.py +119 -0
  139. siliconcompiler/tools/klayout/klayout_export.py +205 -0
  140. siliconcompiler/tools/klayout/klayout_operations.py +363 -0
  141. siliconcompiler/tools/klayout/klayout_show.py +242 -0
  142. siliconcompiler/tools/klayout/klayout_utils.py +176 -0
  143. siliconcompiler/tools/klayout/operations.py +194 -0
  144. siliconcompiler/tools/klayout/screenshot.py +98 -0
  145. siliconcompiler/tools/klayout/show.py +101 -0
  146. siliconcompiler/tools/magic/drc.py +49 -0
  147. siliconcompiler/tools/magic/extspice.py +19 -0
  148. siliconcompiler/tools/magic/magic.py +85 -0
  149. siliconcompiler/tools/magic/sc_drc.tcl +96 -0
  150. siliconcompiler/tools/magic/sc_extspice.tcl +54 -0
  151. siliconcompiler/tools/magic/sc_magic.tcl +47 -0
  152. siliconcompiler/tools/montage/montage.py +30 -0
  153. siliconcompiler/tools/montage/tile.py +66 -0
  154. siliconcompiler/tools/netgen/count_lvs.py +132 -0
  155. siliconcompiler/tools/netgen/lvs.py +90 -0
  156. siliconcompiler/tools/netgen/netgen.py +36 -0
  157. siliconcompiler/tools/netgen/sc_lvs.tcl +46 -0
  158. siliconcompiler/tools/nextpnr/apr.py +24 -0
  159. siliconcompiler/tools/nextpnr/nextpnr.py +59 -0
  160. siliconcompiler/tools/openfpgaloader/openfpgaloader.py +39 -0
  161. siliconcompiler/tools/openroad/__init__.py +0 -0
  162. siliconcompiler/tools/openroad/cts.py +45 -0
  163. siliconcompiler/tools/openroad/dfm.py +66 -0
  164. siliconcompiler/tools/openroad/export.py +131 -0
  165. siliconcompiler/tools/openroad/floorplan.py +70 -0
  166. siliconcompiler/tools/openroad/openroad.py +977 -0
  167. siliconcompiler/tools/openroad/physyn.py +27 -0
  168. siliconcompiler/tools/openroad/place.py +41 -0
  169. siliconcompiler/tools/openroad/rcx_bench.py +95 -0
  170. siliconcompiler/tools/openroad/rcx_extract.py +34 -0
  171. siliconcompiler/tools/openroad/route.py +45 -0
  172. siliconcompiler/tools/openroad/screenshot.py +60 -0
  173. siliconcompiler/tools/openroad/scripts/sc_apr.tcl +499 -0
  174. siliconcompiler/tools/openroad/scripts/sc_cts.tcl +64 -0
  175. siliconcompiler/tools/openroad/scripts/sc_dfm.tcl +20 -0
  176. siliconcompiler/tools/openroad/scripts/sc_export.tcl +98 -0
  177. siliconcompiler/tools/openroad/scripts/sc_floorplan.tcl +413 -0
  178. siliconcompiler/tools/openroad/scripts/sc_metrics.tcl +158 -0
  179. siliconcompiler/tools/openroad/scripts/sc_physyn.tcl +7 -0
  180. siliconcompiler/tools/openroad/scripts/sc_place.tcl +84 -0
  181. siliconcompiler/tools/openroad/scripts/sc_procs.tcl +423 -0
  182. siliconcompiler/tools/openroad/scripts/sc_rcx.tcl +63 -0
  183. siliconcompiler/tools/openroad/scripts/sc_rcx_bench.tcl +20 -0
  184. siliconcompiler/tools/openroad/scripts/sc_rcx_extract.tcl +12 -0
  185. siliconcompiler/tools/openroad/scripts/sc_route.tcl +133 -0
  186. siliconcompiler/tools/openroad/scripts/sc_screenshot.tcl +21 -0
  187. siliconcompiler/tools/openroad/scripts/sc_write.tcl +5 -0
  188. siliconcompiler/tools/openroad/scripts/sc_write_images.tcl +361 -0
  189. siliconcompiler/tools/openroad/show.py +94 -0
  190. siliconcompiler/tools/openroad/templates/pex.tcl +8 -0
  191. siliconcompiler/tools/opensta/__init__.py +101 -0
  192. siliconcompiler/tools/opensta/report_libraries.py +28 -0
  193. siliconcompiler/tools/opensta/scripts/sc_procs.tcl +47 -0
  194. siliconcompiler/tools/opensta/scripts/sc_report_libraries.tcl +74 -0
  195. siliconcompiler/tools/opensta/scripts/sc_timing.tcl +268 -0
  196. siliconcompiler/tools/opensta/timing.py +214 -0
  197. siliconcompiler/tools/slang/__init__.py +49 -0
  198. siliconcompiler/tools/slang/lint.py +101 -0
  199. siliconcompiler/tools/surelog/__init__.py +123 -0
  200. siliconcompiler/tools/surelog/parse.py +183 -0
  201. siliconcompiler/tools/surelog/templates/output.v +7 -0
  202. siliconcompiler/tools/sv2v/convert.py +46 -0
  203. siliconcompiler/tools/sv2v/sv2v.py +37 -0
  204. siliconcompiler/tools/template/template.py +125 -0
  205. siliconcompiler/tools/verilator/compile.py +139 -0
  206. siliconcompiler/tools/verilator/lint.py +19 -0
  207. siliconcompiler/tools/verilator/parse.py +27 -0
  208. siliconcompiler/tools/verilator/verilator.py +172 -0
  209. siliconcompiler/tools/vivado/__init__.py +7 -0
  210. siliconcompiler/tools/vivado/bitstream.py +21 -0
  211. siliconcompiler/tools/vivado/place.py +21 -0
  212. siliconcompiler/tools/vivado/route.py +21 -0
  213. siliconcompiler/tools/vivado/scripts/sc_bitstream.tcl +6 -0
  214. siliconcompiler/tools/vivado/scripts/sc_place.tcl +2 -0
  215. siliconcompiler/tools/vivado/scripts/sc_route.tcl +4 -0
  216. siliconcompiler/tools/vivado/scripts/sc_run.tcl +45 -0
  217. siliconcompiler/tools/vivado/scripts/sc_syn_fpga.tcl +25 -0
  218. siliconcompiler/tools/vivado/syn_fpga.py +20 -0
  219. siliconcompiler/tools/vivado/vivado.py +147 -0
  220. siliconcompiler/tools/vpr/_json_constraint.py +63 -0
  221. siliconcompiler/tools/vpr/_xml_constraint.py +109 -0
  222. siliconcompiler/tools/vpr/place.py +137 -0
  223. siliconcompiler/tools/vpr/route.py +124 -0
  224. siliconcompiler/tools/vpr/screenshot.py +54 -0
  225. siliconcompiler/tools/vpr/show.py +88 -0
  226. siliconcompiler/tools/vpr/vpr.py +357 -0
  227. siliconcompiler/tools/xyce/xyce.py +36 -0
  228. siliconcompiler/tools/yosys/lec.py +56 -0
  229. siliconcompiler/tools/yosys/prepareLib.py +59 -0
  230. siliconcompiler/tools/yosys/sc_lec.tcl +84 -0
  231. siliconcompiler/tools/yosys/sc_syn.tcl +79 -0
  232. siliconcompiler/tools/yosys/syn_asic.py +565 -0
  233. siliconcompiler/tools/yosys/syn_asic.tcl +377 -0
  234. siliconcompiler/tools/yosys/syn_asic_fpga_shared.tcl +31 -0
  235. siliconcompiler/tools/yosys/syn_fpga.py +146 -0
  236. siliconcompiler/tools/yosys/syn_fpga.tcl +233 -0
  237. siliconcompiler/tools/yosys/syn_strategies.tcl +81 -0
  238. siliconcompiler/tools/yosys/techmaps/lcu_kogge_stone.v +39 -0
  239. siliconcompiler/tools/yosys/templates/abc.const +2 -0
  240. siliconcompiler/tools/yosys/yosys.py +147 -0
  241. siliconcompiler/units.py +259 -0
  242. siliconcompiler/use.py +177 -0
  243. siliconcompiler/utils/__init__.py +423 -0
  244. siliconcompiler/utils/asic.py +158 -0
  245. siliconcompiler/utils/showtools.py +25 -0
  246. siliconcompiler-0.26.5.dist-info/LICENSE +190 -0
  247. siliconcompiler-0.26.5.dist-info/METADATA +195 -0
  248. siliconcompiler-0.26.5.dist-info/RECORD +251 -0
  249. siliconcompiler-0.26.5.dist-info/WHEEL +5 -0
  250. siliconcompiler-0.26.5.dist-info/entry_points.txt +12 -0
  251. siliconcompiler-0.26.5.dist-info/top_level.txt +1 -0
@@ -0,0 +1,46 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ from siliconcompiler.tools.builtin import minimum
3
+ from siliconcompiler.tools.builtin.builtin import set_io_files
4
+
5
+
6
+ def setup(chip):
7
+ '''
8
+ Selects the task with the maximum metric score from a list of inputs.
9
+
10
+ Sequence of operation:
11
+
12
+ 1. Check list of input tasks to see if all metrics meets goals
13
+ 2. Check list of input tasks to find global min/max for each metric
14
+ 3. Select MAX value if all metrics are met.
15
+ 4. Normalize the min value as sel = (val - MIN) / (MAX - MIN)
16
+ 5. Return normalized value and task name
17
+
18
+ Meeting metric goals takes precedence over compute metric scores.
19
+ Only goals with values set and metrics with weights set are considered
20
+ in the calculation.
21
+ '''
22
+
23
+ set_io_files(chip)
24
+
25
+
26
+ def _select_inputs(chip, step, index):
27
+ inputs = _common._select_inputs(chip, step, index)
28
+
29
+ score, sel_inputs = _common._minmax(chip, *inputs, op='maximum')
30
+
31
+ if sel_inputs:
32
+ chip.logger.info(f"Selected '{sel_inputs[0]}{sel_inputs[1]}' with score {score:.3f}")
33
+
34
+ return sel_inputs
35
+
36
+
37
+ def _gather_outputs(chip, step, index):
38
+ return minimum._gather_outputs(chip, step, index)
39
+
40
+
41
+ def run(chip):
42
+ return _common.run(chip)
43
+
44
+
45
+ def post_process(chip):
46
+ _common.post_process(chip)
@@ -0,0 +1,57 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ from siliconcompiler import flowgraph
3
+ from siliconcompiler.tools.builtin.builtin import set_io_files
4
+
5
+
6
+ def setup(chip):
7
+ '''
8
+ Selects the task with the minimum metric score from a list of inputs.
9
+
10
+ Sequence of operation:
11
+
12
+ 1. Check list of input tasks to see if all metrics meets goals
13
+ 2. Check list of input tasks to find global min/max for each metric
14
+ 3. Select MIN value if all metrics are met.
15
+ 4. Normalize the min value as sel = (val - MIN) / (MAX - MIN)
16
+ 5. Return normalized value and task name
17
+
18
+ Meeting metric goals takes precedence over compute metric scores.
19
+ Only goals with values set and metrics with weights set are considered
20
+ in the calculation.
21
+ '''
22
+
23
+ set_io_files(chip)
24
+
25
+
26
+ def _select_inputs(chip, step, index):
27
+ inputs = _common._select_inputs(chip, step, index)
28
+
29
+ score, sel_inputs = _common._minmax(chip, *inputs, op='minimum')
30
+
31
+ if sel_inputs:
32
+ chip.logger.info(f"Selected '{sel_inputs[0]}{sel_inputs[1]}' with score {score:.3f}")
33
+
34
+ return sel_inputs
35
+
36
+
37
+ def _gather_outputs(chip, step, index):
38
+ '''Return set of filenames that are guaranteed to be in outputs
39
+ directory after a successful run of step/index.'''
40
+
41
+ flow = chip.get('option', 'flow')
42
+
43
+ in_nodes = chip.get('flowgraph', flow, step, index, 'input')
44
+ in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
45
+
46
+ if len(in_task_outputs) > 0:
47
+ return in_task_outputs[0].intersection(*in_task_outputs[1:])
48
+
49
+ return []
50
+
51
+
52
+ def run(chip):
53
+ return _common.run(chip)
54
+
55
+
56
+ def post_process(chip):
57
+ _common.post_process(chip)
@@ -0,0 +1,70 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ import re
3
+ from siliconcompiler.tools.builtin.builtin import set_io_files
4
+ from siliconcompiler import flowgraph, SiliconCompilerError
5
+
6
+
7
+ def setup(chip):
8
+ '''
9
+ Selects a task from a list of inputs.
10
+
11
+ The selector criteria provided is used to create a custom function
12
+ for selecting the best step/index pair from the inputs. Metrics and
13
+ weights are passed in and used to select the step/index based on
14
+ the minimum or maximum score depending on the 'op' argument from
15
+ ['flowgraph', flow, step, index, 'args'] in the form 'minimum(metric)' or
16
+ 'maximum(metric)'.
17
+
18
+ The function can be used to bypass the flows weight functions for
19
+ the purpose of conditional flow execution and verification.
20
+ '''
21
+
22
+ set_io_files(chip)
23
+
24
+
25
+ def _select_inputs(chip, step, index):
26
+ chip.logger.info("Running builtin task 'mux'")
27
+
28
+ flow = chip.get('option', 'flow')
29
+ inputs = chip.get('flowgraph', flow, step, index, 'input')
30
+ arguments = chip.get('flowgraph', flow, step, index, 'args')
31
+
32
+ operations = []
33
+ for criteria in arguments:
34
+ m = re.match(r'(minimum|maximum)\((\w+)\)', criteria)
35
+ if not m:
36
+ raise SiliconCompilerError(f"Illegal mux criteria: {criteria}", chip=chip)
37
+
38
+ op = m.group(1)
39
+ metric = m.group(2)
40
+ if metric not in chip.getkeys('metric'):
41
+ raise SiliconCompilerError(
42
+ f"Criteria must use legal metrics only: {criteria}", chip=chip)
43
+
44
+ operations.append((metric, op))
45
+ score, sel_inputs = _common._mux(chip, *inputs, operations=operations)
46
+
47
+ if sel_inputs:
48
+ chip.logger.info(f"Selected '{sel_inputs[0]}{sel_inputs[1]}' with score {score:.3f}")
49
+
50
+ return sel_inputs
51
+
52
+
53
+ def _gather_outputs(chip, step, index):
54
+ flow = chip.get('option', 'flow')
55
+
56
+ in_nodes = chip.get('flowgraph', flow, step, index, 'input')
57
+ in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
58
+
59
+ if len(in_task_outputs) > 0:
60
+ return in_task_outputs[0].intersection(*in_task_outputs[1:])
61
+
62
+ return []
63
+
64
+
65
+ def run(chip):
66
+ return _common.run(chip)
67
+
68
+
69
+ def post_process(chip):
70
+ _common.post_process(chip)
@@ -0,0 +1,38 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ from siliconcompiler.tools.builtin.builtin import set_io_files
3
+ from siliconcompiler import flowgraph
4
+
5
+
6
+ def setup(chip):
7
+ '''
8
+ A no-operation that passes inputs to outputs.
9
+ '''
10
+
11
+ set_io_files(chip)
12
+
13
+
14
+ def _select_inputs(chip, step, index):
15
+ return _common._select_inputs(chip, step, index)
16
+
17
+
18
+ def _gather_outputs(chip, step, index):
19
+ '''Return set of filenames that are guaranteed to be in outputs
20
+ directory after a successful run of step/index.'''
21
+
22
+ flow = chip.get('option', 'flow')
23
+
24
+ in_nodes = chip.get('flowgraph', flow, step, index, 'input')
25
+ in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
26
+
27
+ if len(in_task_outputs) > 0:
28
+ return in_task_outputs[0].union(*in_task_outputs[1:])
29
+
30
+ return []
31
+
32
+
33
+ def run(chip):
34
+ return _common.run(chip)
35
+
36
+
37
+ def post_process(chip):
38
+ _common.post_process(chip)
@@ -0,0 +1,83 @@
1
+ from siliconcompiler.tools.builtin import _common
2
+ from siliconcompiler.schema import Schema
3
+ from siliconcompiler.scheduler import _haltstep
4
+ from siliconcompiler.tools.builtin.builtin import set_io_files
5
+ from siliconcompiler import utils, flowgraph, SiliconCompilerError
6
+
7
+ import re
8
+
9
+
10
+ def setup(chip):
11
+ '''
12
+ Tests an assertion on an input task.
13
+
14
+ The input to this task is verified to ensure that all assertions
15
+ are True. If any of the assertions fail, False is returned.
16
+ Assertions are passed in using ['flowgraph', flow, step, index, 'args'] in the form
17
+ 'metric==0.0'.
18
+ The allowed conditional operators are: >, <, >=, <=, ==
19
+ '''
20
+
21
+ set_io_files(chip, outputs=False)
22
+
23
+
24
+ def _select_inputs(chip, step, index):
25
+ inputs = _common._select_inputs(chip, step, index)
26
+ if len(inputs) != 1:
27
+ raise SiliconCompilerError(
28
+ f'{step}{index} receives {len(inputs)} inputs, but only supports one', chip=chip)
29
+ inputs = inputs[0]
30
+ flow = chip.get('option', 'flow')
31
+ arguments = chip.get('flowgraph', flow, step, index, 'args')
32
+
33
+ if len(arguments) == 0:
34
+ raise SiliconCompilerError(f'{step}{index} requires arguments for verify', chip=chip)
35
+
36
+ passes = True
37
+ for criteria in arguments:
38
+ m = re.match(r'(\w+)([\>\=\<]+)(\w+)', criteria)
39
+ if not m:
40
+ raise SiliconCompilerError(f"Illegal verify criteria: {criteria}", chip=chip)
41
+
42
+ metric = m.group(1)
43
+ op = m.group(2)
44
+ goal = m.group(3)
45
+ if metric not in chip.getkeys('metric'):
46
+ raise SiliconCompilerError(
47
+ f"Criteria must use legal metrics only: {criteria}", chip=chip)
48
+
49
+ value = chip.get('metric', metric, step=inputs[0], index=inputs[1])
50
+
51
+ if value is None:
52
+ raise SiliconCompilerError(
53
+ f"Missing metric for {metric} in {inputs[0]}{inputs[1]}", chip=chip)
54
+
55
+ metric_type = chip.get('metric', metric, field='type')
56
+ goal = Schema._normalize_value(goal, metric_type, "", None)
57
+ if not utils.safecompare(chip, value, op, goal):
58
+ chip.error(f"{step}{index} fails '{metric}' metric: {value}{op}{goal}")
59
+
60
+ if not passes:
61
+ _haltstep(chip, flow, step, index)
62
+
63
+ return inputs
64
+
65
+
66
+ def _gather_outputs(chip, step, index):
67
+ flow = chip.get('option', 'flow')
68
+
69
+ in_nodes = chip.get('flowgraph', flow, step, index, 'input')
70
+ in_task_outputs = [flowgraph._gather_outputs(chip, *node) for node in in_nodes]
71
+
72
+ if len(in_task_outputs) > 0:
73
+ return in_task_outputs[0].intersection(*in_task_outputs[1:])
74
+
75
+ return []
76
+
77
+
78
+ def run(chip):
79
+ return _common.run(chip)
80
+
81
+
82
+ def post_process(chip):
83
+ _common.post_process(chip)
@@ -0,0 +1,10 @@
1
+ import chisel3.stage.ChiselStage
2
+
3
+ import chisel3._
4
+
5
+ object SCDriver extends App {
6
+ (new ChiselStage).execute(
7
+ Array("-E", "verilog", "--target-dir", "chisel_work") ++ args,
8
+ Seq()
9
+ )
10
+ }
@@ -0,0 +1,27 @@
1
+ // Based on https://github.com/freechipsproject/chisel-template/blob/main/build.sbt
2
+
3
+ ThisBuild / scalaVersion := "2.12.13"
4
+
5
+ Compile / scalaSource := baseDirectory.value / "inputs"
6
+
7
+ lazy val root = (project in file("."))
8
+ .settings(
9
+ libraryDependencies ++= Seq(
10
+ "edu.berkeley.cs" %% "chisel3" % "3.4.3",
11
+ "edu.berkeley.cs" %% "chiseltest" % "0.3.3" % "test"
12
+ ),
13
+ scalacOptions ++= Seq(
14
+ "-Xsource:2.11",
15
+ "-language:reflectiveCalls",
16
+ "-deprecation",
17
+ "-feature",
18
+ "-Xcheckinit",
19
+ // Enables autoclonetype2 in 3.4.x (on by default in 3.5)
20
+ "-P:chiselplugin:useBundlePlugin"
21
+ ),
22
+ addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % "3.4.3" cross CrossVersion.full),
23
+ addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
24
+ )
25
+
26
+ // Prevents exception on exit
27
+ trapExit := false
@@ -0,0 +1,37 @@
1
+ '''
2
+ Chisel is a hardware design language that facilitates advanced circuit
3
+ generation and design reuse for both ASIC and FPGA digital logic designs.
4
+ Chisel adds hardware construction primitives to the Scala programming
5
+ language, providing designers with the power of a modern programming
6
+ language to write complex, parameterizable circuit generators that produce
7
+ synthesizable Verilog.
8
+
9
+ Documentation: https://www.chisel-lang.org/docs
10
+
11
+ Sources: https://github.com/chipsalliance/chisel
12
+
13
+ Installation: The Chisel plugin relies on having the Scala Build Tool (sbt)
14
+ installed. Instructions: https://www.scala-sbt.org/download.html.
15
+ '''
16
+
17
+ from siliconcompiler.tools.chisel import convert
18
+
19
+
20
+ ####################################################################
21
+ # Make Docs
22
+ ####################################################################
23
+ def make_docs(chip):
24
+ convert.setup(chip)
25
+ return chip
26
+
27
+
28
+ def parse_version(stdout):
29
+ # sbt version in this project: 1.5.5
30
+ # sbt script version: 1.5.5
31
+
32
+ for line in stdout.splitlines():
33
+ line = line.strip()
34
+ if 'sbt script version:' in line:
35
+ return line.split()[-1]
36
+
37
+ return None
@@ -0,0 +1,140 @@
1
+ import os
2
+ import shutil
3
+ import glob
4
+ from siliconcompiler.tools._common import add_frontend_requires, get_tool_task, has_input_files
5
+ from siliconcompiler import sc_open, SiliconCompilerError
6
+
7
+
8
+ def setup(chip):
9
+ '''
10
+ Performs high level synthesis to generate a verilog output
11
+ '''
12
+
13
+ if not has_input_files(chip, 'input', 'config', 'chisel') and \
14
+ not has_input_files(chip, 'input', 'hll', 'scala'):
15
+ return "no files in [input,hll,scala] or [input,config,chisel]"
16
+
17
+ tool = 'chisel'
18
+ step = chip.get('arg', 'step')
19
+ index = chip.get('arg', 'index')
20
+ _, task = get_tool_task(chip, step, index)
21
+
22
+ # Standard Setup
23
+ refdir = 'tools/' + tool
24
+ chip.set('tool', tool, 'exe', 'sbt')
25
+ chip.set('tool', tool, 'vswitch', '--version')
26
+ chip.set('tool', tool, 'version', '>=1.5.5', clobber=False)
27
+
28
+ chip.set('tool', tool, 'task', task, 'refdir', refdir,
29
+ step=step, index=index,
30
+ package='siliconcompiler', clobber=False)
31
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
32
+ step=step, index=index, clobber=False)
33
+
34
+ chip.set('tool', tool, 'task', task, 'option', ['-batch',
35
+ '--no-share',
36
+ '--no-global'],
37
+ step=step, index=index)
38
+
39
+ chip.set('tool', tool, 'task', task, 'var', 'application',
40
+ 'Application name of the chisel program',
41
+ field='help')
42
+ chip.set('tool', tool, 'task', task, 'var', 'argument',
43
+ 'Arguments for the chisel build',
44
+ field='help')
45
+
46
+ # Input/Output requirements
47
+ if chip.valid('input', 'config', 'chisel') and \
48
+ chip.get('input', 'config', 'chisel', step=step, index=index):
49
+ chip.add('tool', tool, 'task', task, 'require', 'input,config,chisel',
50
+ step=step, index=index)
51
+ if len(chip.get('input', 'config', 'chisel', step=step, index=index)) != 1:
52
+ raise SiliconCompilerError('Only one build.sbt is supported.', chip=chip)
53
+
54
+ if chip.valid('input', 'hll', 'scala') and \
55
+ chip.get('input', 'hll', 'scala', step=step, index=index):
56
+ chip.add('tool', tool, 'task', task, 'require', 'input,hll,scala',
57
+ step=step, index=index)
58
+
59
+ chip.add('tool', tool, 'task', task, 'output', chip.top() + '.v', step=step, index=index)
60
+
61
+ add_frontend_requires(chip, [])
62
+
63
+
64
+ def pre_process(chip):
65
+ tool = 'chisel'
66
+ step = chip.get('arg', 'step')
67
+ index = chip.get('arg', 'index')
68
+ _, task = get_tool_task(chip, step, index)
69
+
70
+ refdir = chip.find_files('tool', tool, 'task', task, 'refdir', step=step, index=index)[0]
71
+
72
+ if chip.valid('input', 'config', 'chisel') and \
73
+ chip.get('input', 'config', 'chisel', step=step, index=index):
74
+ build_file = chip.find_files('input', 'config', 'chisel', step=step, index=index)[0]
75
+ work_dir = chip.getworkdir(step=step, index=index)
76
+ build_dir = os.path.dirname(build_file)
77
+ # Expect file tree from: https://www.scala-sbt.org/1.x/docs/Directories.html
78
+ # copy build.sbt
79
+ # copy src/
80
+ shutil.copyfile(build_file, os.path.join(work_dir, 'build.sbt'))
81
+ shutil.copytree(os.path.join(build_dir, 'src'),
82
+ os.path.join(work_dir, 'src'))
83
+ if os.path.exists(os.path.join(build_dir, 'project')):
84
+ shutil.copytree(os.path.join(build_dir, 'project'),
85
+ os.path.join(work_dir, 'project'))
86
+ return
87
+
88
+ for filename in ('build.sbt', 'SCDriver.scala'):
89
+ src = os.path.join(refdir, filename)
90
+ dst = filename
91
+ shutil.copyfile(src, dst)
92
+
93
+ # Chisel driver relies on Scala files being collected into '$CWD/inputs'
94
+ chip.set('input', 'hll', 'scala', True, field='copy')
95
+ chip.collect(directory=os.path.join(chip.getworkdir(step=step, index=index), 'inputs'))
96
+
97
+
98
+ def runtime_options(chip):
99
+ step = chip.get('arg', 'step')
100
+ index = chip.get('arg', 'index')
101
+ tool, task = get_tool_task(chip, step, index)
102
+
103
+ design = chip.top()
104
+
105
+ runMain = ["runMain"]
106
+ if chip.valid('input', 'config', 'chisel') and \
107
+ chip.get('input', 'config', 'chisel', step=step, index=index):
108
+ app = design
109
+ if chip.valid('tool', tool, 'task', task, 'var', 'application') and \
110
+ chip.get('tool', tool, 'task', task, 'var', 'application', step=step, index=index):
111
+ app = chip.get('tool', tool, 'task', task, 'var', 'application',
112
+ step=step, index=index)[0]
113
+
114
+ runMain.append(f"{app}")
115
+
116
+ if chip.valid('tool', tool, 'task', task, 'var', 'argument') and \
117
+ chip.get('tool', tool, 'task', task, 'var', 'argument', step=step, index=index):
118
+ runMain.extend(chip.get('tool', tool, 'task', task, 'var', 'argument',
119
+ step=step, index=index))
120
+ runMain.append("--")
121
+
122
+ runMain.append("--target-dir chisel-output")
123
+ else:
124
+ # Use built in driver
125
+ runMain.append("SCDriver")
126
+ runMain.append(f"--module {chip.top(step=step, index=index)}")
127
+
128
+ runMain.append(f"--output-file ../outputs/{design}.v")
129
+
130
+ return [f'"{" ".join(runMain)}"']
131
+
132
+
133
+ def post_process(chip):
134
+ chisel_path = 'chisel-output'
135
+ if os.path.exists(chisel_path):
136
+ design = chip.top()
137
+ with open(f'outputs/{design}.v', 'w') as out:
138
+ for f in glob.glob(os.path.join(chisel_path, '*.v')):
139
+ with sc_open(f) as i_file:
140
+ out.writelines(i_file.readlines())
@@ -0,0 +1,41 @@
1
+ import glob
2
+ import os
3
+ import stat
4
+ from siliconcompiler.tools.execute.execute import setup as tool_setup
5
+ from siliconcompiler.tools._common import input_provides, get_tool_task
6
+
7
+
8
+ def setup(chip):
9
+ '''
10
+ Execute the output of the previous step directly.
11
+ This only works if the task receives a single file.
12
+ '''
13
+ tool_setup(chip)
14
+
15
+ step = chip.get('arg', 'step')
16
+ index = chip.get('arg', 'index')
17
+ tool, task = get_tool_task(chip, step, index)
18
+
19
+ chip.set('tool', tool, 'task', task, 'input',
20
+ list(input_provides(chip, step, index).keys()),
21
+ step=step, index=index)
22
+
23
+
24
+ def pre_process(chip):
25
+ step = chip.get('arg', 'step')
26
+ index = chip.get('arg', 'index')
27
+ tool, _ = get_tool_task(chip, step, index)
28
+
29
+ exec = None
30
+ for fin in glob.glob('inputs/*'):
31
+ if fin.endswith('.pkg.json'):
32
+ continue
33
+ exec = os.path.abspath(fin)
34
+ break
35
+
36
+ if not exec:
37
+ chip.error(f'{step}{index} did not receive an executable file')
38
+
39
+ chip.set('tool', tool, 'exe', exec)
40
+
41
+ os.chmod(exec, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
@@ -0,0 +1,17 @@
1
+ '''
2
+ This tool is used to execute the output of a previous step.
3
+ For example, if the flow contains a compile step which generates the
4
+ next executable needed in the flow.
5
+ '''
6
+
7
+ from siliconcompiler.tools._common import get_tool_task
8
+
9
+
10
+ def setup(chip):
11
+ step = chip.get('arg', 'step')
12
+ index = chip.get('arg', 'index')
13
+
14
+ tool, task = get_tool_task(chip, step, index)
15
+
16
+ chip.set('tool', tool, 'exe', ":exe:", clobber=False)
17
+ chip.set('tool', tool, 'task', task, 'option', [], step=step, index=index, clobber=False)
@@ -0,0 +1,61 @@
1
+ import os
2
+ import shutil
3
+ from siliconcompiler.tools.genfasm import genfasm
4
+ from siliconcompiler.tools.vpr import vpr
5
+ from siliconcompiler.tools._common import get_tool_task
6
+
7
+
8
+ def setup(chip):
9
+ '''
10
+ Generates a bitstream
11
+ '''
12
+ genfasm.setup(chip)
13
+
14
+ step = chip.get('arg', 'step')
15
+ index = chip.get('arg', 'index')
16
+ tool, task = get_tool_task(chip, step, index)
17
+
18
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
19
+ step=step, index=index, clobber=False)
20
+
21
+ chip.set('tool', tool, 'task', task, 'regex', 'warnings', "^Warning",
22
+ step=step, index=index, clobber=False)
23
+ chip.set('tool', tool, 'task', task, 'regex', 'errors', "^Error",
24
+ step=step, index=index, clobber=False)
25
+
26
+ design = chip.top()
27
+
28
+ chip.set('tool', tool, 'task', task, 'input', design + '.route', step=step, index=index)
29
+ chip.add('tool', tool, 'task', task, 'input', design + '.blif', step=step, index=index)
30
+ chip.add('tool', tool, 'task', task, 'input', design + '.net', step=step, index=index)
31
+ chip.add('tool', tool, 'task', task, 'input', design + '.place', step=step, index=index)
32
+
33
+ chip.add('tool', tool, 'task', task, 'output', design + '.fasm', step=step, index=index)
34
+
35
+
36
+ def runtime_options(chip):
37
+ options = vpr.runtime_options(chip)
38
+
39
+ design = chip.top()
40
+
41
+ blif = f"inputs/{design}.blif"
42
+ options.append(blif)
43
+
44
+ options.append(f'--net_file inputs/{design}.net')
45
+ options.append(f'--place_file inputs/{design}.place')
46
+ options.append(f'--route_file inputs/{design}.route')
47
+
48
+ return options
49
+
50
+ ################################
51
+ # Post_process (post executable)
52
+ ################################
53
+
54
+
55
+ def post_process(chip):
56
+ ''' Tool specific function to run after step execution
57
+ '''
58
+ vpr.vpr_post_process(chip)
59
+
60
+ design = chip.top()
61
+ shutil.move(f'{design}.fasm', 'outputs')
@@ -0,0 +1,40 @@
1
+ from siliconcompiler.tools.vpr.vpr import parse_version as vpr_parse_version
2
+ from siliconcompiler.tools.vpr.vpr import normalize_version as vpr_normalize_version
3
+
4
+ '''
5
+ Generate a `FSAM <https://github.com/chipsalliance/fasm>`_ file from the output of
6
+ `VPR <https://github.com/verilog-to-routing/vtr-verilog-to-routing>`_
7
+
8
+ Documentation: https://docs.verilogtorouting.org/en/latest/utils/fasm/
9
+
10
+ Sources: https://github.com/verilog-to-routing/vtr-verilog-to-routing/tree/master/utils/fasm
11
+ '''
12
+
13
+
14
+ ######################################################################
15
+ # Make Docs
16
+ ######################################################################
17
+ def make_docs(chip):
18
+ from siliconcompiler.tools.genfasm.bitstream import setup
19
+ setup(chip)
20
+ return chip
21
+
22
+
23
+ def setup(chip):
24
+ chip.set('tool', 'genfasm', 'exe', 'genfasm', clobber=False)
25
+ chip.set('tool', 'genfasm', 'vswitch', '--version')
26
+ chip.set('tool', 'genfasm', 'version', '>=8.1.0', clobber=False)
27
+
28
+
29
+ def parse_version(chip):
30
+ return vpr_parse_version(chip)
31
+
32
+
33
+ def normalize_version(chip):
34
+ return vpr_normalize_version(chip)
35
+
36
+
37
+ ##################################################
38
+ if __name__ == "__main__":
39
+ chip = make_docs()
40
+ chip.write_manifest("genfasm.json")