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,101 @@
1
+ '''
2
+ Lint system verilog
3
+ '''
4
+ from siliconcompiler.tools import slang
5
+ from siliconcompiler.tools._common import \
6
+ add_require_input, add_frontend_requires, get_frontend_options, get_input_files, get_tool_task
7
+ import os
8
+
9
+
10
+ def setup(chip):
11
+ slang.setup(chip)
12
+
13
+ step = chip.get('arg', 'step')
14
+ index = chip.get('arg', 'index')
15
+ tool, task = get_tool_task(chip, step, index)
16
+
17
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
18
+ clobber=False, step=step, index=index)
19
+
20
+ add_require_input(chip, 'input', 'rtl', 'verilog')
21
+ add_require_input(chip, 'input', 'rtl', 'systemverilog')
22
+ add_frontend_requires(chip, ['ydir', 'idir', 'vlib', 'libext', 'define', 'param'])
23
+
24
+
25
+ def runtime_options(chip):
26
+ options = ["-lint-only"]
27
+
28
+ step = chip.get('arg', 'step')
29
+ index = chip.get('arg', 'index')
30
+ tool, task = get_tool_task(chip, step, index)
31
+
32
+ options.extend(['-j', str(chip.get('tool', tool, 'task', task, 'threads',
33
+ step=step, index=index))])
34
+
35
+ opts = get_frontend_options(chip,
36
+ ['ydir',
37
+ 'idir',
38
+ 'vlib',
39
+ 'libext',
40
+ 'define',
41
+ 'param'])
42
+
43
+ if opts['libext']:
44
+ options.append(f'--libext {",".join(opts["libext"])}')
45
+
46
+ #####################
47
+ # Library directories
48
+ #####################
49
+ if opts['ydir']:
50
+ options.append(f'-y {",".join(opts["ydir"])}')
51
+
52
+ #####################
53
+ # Library files
54
+ #####################
55
+ if opts['vlib']:
56
+ options.append(f'-libfile {",".join(opts["vlib"])}')
57
+
58
+ #####################
59
+ # Include paths
60
+ #####################
61
+ if opts['idir']:
62
+ options.append(f'--include-directory {",".join(opts["idir"])}')
63
+
64
+ #######################
65
+ # Variable Definitions
66
+ #######################
67
+ for value in opts['define']:
68
+ options.append('-D ' + value)
69
+
70
+ #######################
71
+ # Command files
72
+ #######################
73
+ cmdfiles = get_input_files(chip, 'input', 'cmdfile', 'f')
74
+ if cmdfiles:
75
+ options.append(f'-F {",".join(cmdfiles)}')
76
+
77
+ #######################
78
+ # Sources
79
+ #######################
80
+ for value in get_input_files(chip, 'input', 'rtl', 'systemverilog'):
81
+ options.append(value)
82
+ for value in get_input_files(chip, 'input', 'rtl', 'verilog'):
83
+ options.append(value)
84
+
85
+ #######################
86
+ # Top Module
87
+ #######################
88
+ options.append('--top ' + chip.top())
89
+
90
+ ###############################
91
+ # Parameters (top module only)
92
+ ###############################
93
+ # Set up user-provided parameters to ensure we elaborate the correct modules
94
+ for param, value in opts['param']:
95
+ options.append(f'-G {param}={value}')
96
+
97
+ return options
98
+
99
+
100
+ def post_process(chip):
101
+ slang.post_process(chip)
@@ -0,0 +1,123 @@
1
+ '''
2
+ Surelog is a SystemVerilog pre-processor, parser, elaborator,
3
+ and UHDM compiler that provides IEEE design and testbench
4
+ C/C++ VPI and a Python AST API.
5
+
6
+ Documentation: https://github.com/chipsalliance/Surelog
7
+
8
+ Sources: https://github.com/chipsalliance/Surelog
9
+
10
+ Installation: https://github.com/chipsalliance/Surelog
11
+ '''
12
+
13
+ import surelog
14
+ from siliconcompiler.tools._common import get_tool_task
15
+
16
+
17
+ ################################
18
+ # Setup Tool (pre executable)
19
+ ################################
20
+ def setup(chip):
21
+ ''' Sets up default settings common to running Surelog.
22
+ '''
23
+
24
+ tool = 'surelog'
25
+ # Nothing in this method should rely on the value of 'step' or 'index', but they are used
26
+ # as schema keys in some important places, so we still need to fetch them.
27
+ step = chip.get('arg', 'step')
28
+ index = chip.get('arg', 'index')
29
+ exe = tool
30
+ _, task = get_tool_task(chip, step, index)
31
+
32
+ is_docker = chip.get('option', 'scheduler', 'name', step=step, index=index) == 'docker'
33
+ if not is_docker:
34
+ exe = surelog.get_bin()
35
+ else:
36
+ exe = surelog.get_bin('linux')
37
+
38
+ # Standard Setup
39
+ chip.set('tool', tool, 'exe', exe)
40
+ chip.set('tool', tool, 'vswitch', '--version')
41
+ chip.set('tool', tool, 'version', '>=1.51', clobber=False)
42
+
43
+ # We package SC wheels with a precompiled copy of Surelog installed to
44
+ # tools/surelog/bin. If the user doesn't have Surelog installed on their
45
+ # system path, set the path to the bundled copy in the schema.
46
+ if not surelog.has_system_surelog() and not is_docker:
47
+ chip.set('tool', tool, 'path', surelog.get_path(), clobber=False)
48
+
49
+ # Log file parsing
50
+ chip.set('tool', tool, 'task', task, 'regex', 'warnings', r'^\[WRN:',
51
+ step=step, index=index, clobber=False)
52
+ chip.set('tool', tool, 'task', task, 'regex', 'errors', r'^\[(ERR|FTL|SNT):',
53
+ step=step, index=index, clobber=False)
54
+
55
+ for warning in chip.get('tool', tool, 'task', task, 'warningoff', step=step, index=index):
56
+ chip.add('tool', tool, 'regex', step, index, 'warnings', f'-v {warning}',
57
+ step=step, index=index)
58
+
59
+ chip.set('tool', tool, 'task', task, 'var', 'enable_lowmem',
60
+ 'true/false, when true instructs Surelog to minimize its maximum memory usage.',
61
+ field='help')
62
+ chip.set('tool', tool, 'task', task, 'var', 'enable_lowmem', 'false',
63
+ step=step, index=index, clobber=False)
64
+
65
+ chip.set('tool', tool, 'task', task, 'var', 'disable_write_cache',
66
+ 'true/false, when true instructs Surelog to not write to its cache.',
67
+ field='help')
68
+ chip.set('tool', tool, 'task', task, 'var', 'disable_write_cache', 'false',
69
+ step=step, index=index, clobber=False)
70
+
71
+ chip.set('tool', tool, 'task', task, 'var', 'disable_info',
72
+ 'true/false, when true instructs Surelog to not log infos.',
73
+ field='help')
74
+ chip.set('tool', tool, 'task', task, 'var', 'disable_info', 'false',
75
+ step=step, index=index, clobber=False)
76
+
77
+ chip.set('tool', tool, 'task', task, 'var', 'disable_note',
78
+ 'true/false, when true instructs Surelog to not log notes.',
79
+ field='help')
80
+ chip.set('tool', tool, 'task', task, 'var', 'disable_note', 'false',
81
+ step=step, index=index, clobber=False)
82
+
83
+
84
+ def parse_version(stdout):
85
+ # Surelog --version output looks like:
86
+ # VERSION: 1.13
87
+ # BUILT : Nov 10 2021
88
+
89
+ # grab version # by splitting on whitespace
90
+ return stdout.split()[1]
91
+
92
+
93
+ def runtime_options(chip):
94
+ step = chip.get('arg', 'step')
95
+ index = chip.get('arg', 'index')
96
+ tool, task = get_tool_task(chip, step, index)
97
+
98
+ # Command-line options.
99
+ options = []
100
+
101
+ # With newer versions of Surelog (at least 1.35 and up), this option is
102
+ # necessary to make bundled versions work.
103
+ # TODO: why?
104
+ options.append('-nocache')
105
+
106
+ lowmem = chip.get('tool', tool, 'task', task, 'var', 'enable_lowmem', step=step, index=index)
107
+ if lowmem == ['true']:
108
+ options.append('-lowmem')
109
+
110
+ no_write_cache = chip.get('tool', tool, 'task', task, 'var', 'disable_write_cache', step=step,
111
+ index=index)
112
+ if no_write_cache == ['true']:
113
+ options.append('-nowritecache')
114
+
115
+ no_info = chip.get('tool', tool, 'task', task, 'var', 'disable_info', step=step, index=index)
116
+ if no_info == ['true']:
117
+ options.append('-noinfo')
118
+
119
+ no_note = chip.get('tool', tool, 'task', task, 'var', 'disable_note', step=step, index=index)
120
+ if no_note == ['true']:
121
+ options.append('-nonote')
122
+
123
+ return options
@@ -0,0 +1,183 @@
1
+ import os
2
+ import re
3
+ from siliconcompiler.tools._common import \
4
+ add_require_input, get_input_files, add_frontend_requires, get_frontend_options, \
5
+ get_tool_task, has_input_files
6
+ from siliconcompiler.tools.surelog import setup as setup_tool
7
+ from siliconcompiler.tools.surelog import runtime_options as runtime_options_tool
8
+ from siliconcompiler import sc_open
9
+ from siliconcompiler import utils
10
+
11
+
12
+ ##################################################
13
+ def setup(chip):
14
+ '''
15
+ Import verilog files
16
+ '''
17
+
18
+ if not has_input_files(chip, 'input', 'rtl', 'verilog') and \
19
+ not has_input_files(chip, 'input', 'rtl', 'systemverilog'):
20
+ return "no files in [input,rtl,systemverilog] or [input,rtl,verilog]"
21
+
22
+ # Generic tool setup.
23
+ setup_tool(chip)
24
+
25
+ tool = 'surelog'
26
+ step = chip.get('arg', 'step')
27
+ index = chip.get('arg', 'index')
28
+ _, task = get_tool_task(chip, step, index)
29
+
30
+ # Runtime parameters.
31
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
32
+ step=step, index=index, clobber=False)
33
+
34
+ # Input/Output requirements
35
+ chip.set('tool', tool, 'task', task, 'output', __outputfile(chip), step=step, index=index)
36
+
37
+ # Schema requirements
38
+ add_require_input(chip, 'input', 'rtl', 'verilog')
39
+ add_require_input(chip, 'input', 'rtl', 'systemverilog')
40
+ add_require_input(chip, 'input', 'cmdfile', 'f')
41
+ add_frontend_requires(chip, ['ydir', 'idir', 'vlib', 'libext', 'define', 'param'])
42
+
43
+
44
+ ################################
45
+ # Custom runtime options
46
+ ################################
47
+ def runtime_options(chip):
48
+
49
+ ''' Custom runtime options, returnst list of command line options.
50
+ '''
51
+
52
+ step = chip.get('arg', 'step')
53
+ index = chip.get('arg', 'index')
54
+
55
+ opts = get_frontend_options(chip,
56
+ ['ydir',
57
+ 'idir',
58
+ 'vlib',
59
+ 'libext',
60
+ 'define',
61
+ 'param'])
62
+
63
+ # Command-line options.
64
+ cmdlist = runtime_options_tool(chip)
65
+
66
+ # -parse is slow but ensures the SV code is valid
67
+ # we might want an option to control when to enable this
68
+ # or replace surelog with a SV linter for the validate step
69
+ cmdlist.append('-parse')
70
+ # We don't use UHDM currently, so disable. For large designs, this file is
71
+ # very big and takes a while to write out.
72
+ cmdlist.append('-nouhdm')
73
+
74
+ libext = opts['libext']
75
+ if libext:
76
+ libext_option = f"+libext+.{'+.'.join(libext)}"
77
+ else:
78
+ # default value for backwards compatibility
79
+ libext_option = '+libext+.sv+.v'
80
+ cmdlist.append(libext_option)
81
+
82
+ #####################
83
+ # Library directories
84
+ #####################
85
+ for value in opts['ydir']:
86
+ cmdlist.append('-y ' + value)
87
+
88
+ #####################
89
+ # Library files
90
+ #####################
91
+ for value in opts['vlib']:
92
+ cmdlist.append('-v ' + value)
93
+
94
+ #####################
95
+ # Include paths
96
+ #####################
97
+ for value in opts['idir']:
98
+ cmdlist.append('-I' + value)
99
+
100
+ #######################
101
+ # Variable Definitions
102
+ #######################
103
+ for value in opts['define']:
104
+ cmdlist.append('-D' + value)
105
+
106
+ #######################
107
+ # Command files
108
+ #######################
109
+ for value in get_input_files(chip, 'input', 'cmdfile', 'f'):
110
+ cmdlist.append('-f ' + value)
111
+
112
+ #######################
113
+ # Sources
114
+ #######################
115
+ for value in get_input_files(chip, 'input', 'rtl', 'systemverilog'):
116
+ cmdlist.append(value)
117
+ for value in get_input_files(chip, 'input', 'rtl', 'verilog'):
118
+ cmdlist.append(value)
119
+
120
+ #######################
121
+ # Top Module
122
+ #######################
123
+ cmdlist.append(f'-top {chip.top(step, index)}')
124
+
125
+ ###############################
126
+ # Parameters (top module only)
127
+ ###############################
128
+ # Set up user-provided parameters to ensure we elaborate the correct modules
129
+ for param, value in opts['param']:
130
+ cmdlist.append(f'-P{param}={value}')
131
+
132
+ return cmdlist
133
+
134
+
135
+ ##################################################
136
+ def post_process(chip):
137
+ ''' Tool specific function to run after step execution
138
+ '''
139
+
140
+ filemap = []
141
+ with sc_open('slpp_all/file_map.lst') as filelist:
142
+ for mapping in filelist:
143
+ filemap.append(mapping)
144
+
145
+ def lookup_sources(file):
146
+ for fmap in filemap:
147
+ if fmap.startswith(file):
148
+ return fmap[len(file):].strip()
149
+ return "unknown"
150
+
151
+ # https://github.com/chipsalliance/Surelog/issues/3776#issuecomment-1652465581
152
+ surelog_escape = re.compile(r"#~@([a-zA-Z_0-9.\$/\:\[\] ]*)#~@")
153
+
154
+ # Look in slpp_all/file_elab.lst for list of Verilog files included in
155
+ # design, read these and concatenate them into one pickled output file.
156
+ output_template = utils.get_file_template('output.v',
157
+ root=os.path.join(os.path.dirname(__file__),
158
+ 'templates'))
159
+
160
+ with sc_open('slpp_all/file_elab.lst') as filelist, \
161
+ open(f'outputs/{__outputfile(chip)}', 'w') as outfile:
162
+ for path in filelist.read().split('\n'):
163
+ path = path.strip('"')
164
+ if not path:
165
+ # skip empty lines
166
+ continue
167
+ with sc_open(path) as infile:
168
+ source_files = lookup_sources(path)
169
+ unescaped_data = surelog_escape.sub(r"\\\1 ", infile.read())
170
+
171
+ outfile.write(output_template.render(
172
+ source_file=source_files,
173
+ content=unescaped_data
174
+ ))
175
+
176
+ outfile.write('\n')
177
+
178
+
179
+ def __outputfile(chip):
180
+ is_systemverilog = has_input_files(chip, 'input', 'rtl', 'systemverilog')
181
+ if is_systemverilog:
182
+ return f'{chip.top()}.sv'
183
+ return f'{chip.top()}.v'
@@ -0,0 +1,7 @@
1
+ ////////////////////////////////////////////////////////////////
2
+ // Start of: {{ source_file }}
3
+
4
+ {{ content }}
5
+
6
+ // End of: {{ source_file }}
7
+ ////////////////////////////////////////////////////////////////
@@ -0,0 +1,46 @@
1
+ import os
2
+ from siliconcompiler.tools._common import input_provides
3
+
4
+
5
+ def setup(chip):
6
+ '''
7
+ Convert SystemVerilog to verilog
8
+ '''
9
+
10
+ chip.logger.debug("Setting up sv2v")
11
+
12
+ step = chip.get('arg', 'step')
13
+ index = chip.get('arg', 'index')
14
+
15
+ topmodule = chip.top()
16
+ if topmodule + ".sv" not in input_provides(chip, step, index):
17
+ return "will not receive systemverilog to convert"
18
+
19
+ tool = 'sv2v'
20
+ task = 'convert'
21
+
22
+ chip.set('tool', tool, 'exe', tool)
23
+ chip.set('tool', tool, 'vswitch', '--numeric-version')
24
+ chip.set('tool', tool, 'version', '>=0.0.9', clobber=False)
25
+
26
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
27
+ step=step, index=index, clobber=False)
28
+
29
+ # Since we run sv2v after the import/preprocess step, there should be no
30
+ # need for specifying include dirs/defines. However we don't want to pass
31
+ # --skip-preprocessor because there may still be unused preprocessor
32
+ # directives not removed by the importer and passing the --skip-preprocessor
33
+ # flag would cause sv2v to error.
34
+
35
+ # since this step should run after import, the top design module should be
36
+ # set and we can read the pickled Verilog without accessing the original
37
+ # sources
38
+ topmodule = chip.top()
39
+ chip.set('tool', tool, 'task', task, 'option', [], step=step, index=index)
40
+ chip.add('tool', tool, 'task', task, 'option', "inputs/" + topmodule + ".sv",
41
+ step=step, index=index)
42
+ chip.add('tool', tool, 'task', task, 'option', "--write=outputs/" + topmodule + ".v",
43
+ step=step, index=index)
44
+
45
+ chip.set('tool', tool, 'task', task, 'input', f'{topmodule}.sv', step=step, index=index)
46
+ chip.set('tool', tool, 'task', task, 'output', f'{topmodule}.v', step=step, index=index)
@@ -0,0 +1,37 @@
1
+ '''
2
+ sv2v converts SystemVerilog (IEEE 1800-2017) to Verilog
3
+ (IEEE 1364-2005), with an emphasis on supporting synthesizable
4
+ language constructs. The primary goal of this project is to
5
+ create a completely free and open-source tool for converting
6
+ SystemVerilog to Verilog. While methods for performing this
7
+ conversion already exist, they generally either rely on
8
+ commercial tools, or are limited in scope.
9
+
10
+ Documentation: https://github.com/zachjs/sv2v
11
+
12
+ Sources: https://github.com/zachjs/sv2v
13
+
14
+ Installation: https://github.com/zachjs/sv2v
15
+ '''
16
+
17
+ from siliconcompiler.tools.sv2v 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
+ # 0.0.7-130-g1aa30ea
30
+ return '-'.join(stdout.split('-')[:-1])
31
+
32
+
33
+ ##################################################
34
+ if __name__ == "__main__":
35
+
36
+ chip = make_docs()
37
+ chip.write_manifest("sv2v.json")
@@ -0,0 +1,125 @@
1
+ '''
2
+ Tool description
3
+
4
+ Documentation: https://
5
+
6
+ Sources: https://
7
+
8
+ Installation: https://
9
+ '''
10
+
11
+ import os
12
+ import siliconcompiler
13
+ from siliconcompiler.tools._common import get_tool_task
14
+
15
+
16
+ def make_docs():
17
+
18
+ chip = siliconcompiler.Chip('<design>')
19
+ chip.set('arg', 'step', '<step>')
20
+ chip.set('arg', 'index', '<index>')
21
+ setup(chip)
22
+ return chip
23
+
24
+
25
+ def setup(chip):
26
+ '''
27
+ Setup Tool (pre executable)
28
+ '''
29
+
30
+ ##################################
31
+ # Simple settings
32
+ ##################################
33
+
34
+ tool = 'template' # tool name, must match file name
35
+ exe = '' # name of executable
36
+ refdir = '' # path to reference scripts
37
+ script = '' # path to entry script
38
+ options = '' # executable command line options
39
+ outputs = [] # output files (inside ./outputs)
40
+ inputs = [] # input files (inside ./inputs)
41
+ requires = [] # required parameters
42
+ variables = {} # key/value tool variables
43
+
44
+ ##################################
45
+ # Advanced settings below
46
+ ##################################
47
+
48
+ # Fetching current step and index
49
+ step = chip.get('arg', 'step')
50
+ index = chip.get('arg', 'index')
51
+ _, task = get_tool_task(chip, step, index)
52
+
53
+ # Required for all
54
+ chip.set('tool', tool, 'exe', exe)
55
+ chip.set('tool', tool, 'vswitch', '-version')
56
+ chip.set('tool', tool, 'version', 'v2.0', clobber=False)
57
+
58
+ # Required for script tools
59
+ chip.set('tool', tool, 'format', 'tcl', clobber=False)
60
+
61
+ chip.set('tool', tool, 'task', task, 'option', options,
62
+ step=step, index=index, clobber=False)
63
+ chip.set('tool', tool, 'task', task, 'threads', os.cpu_count(),
64
+ step=step, index=index, clobber=False)
65
+
66
+ # Required for script based tools
67
+ chip.set('tool', tool, 'task', task, 'refdir', refdir,
68
+ step=step, index=index,
69
+ package='siliconcompiler', clobber=False)
70
+ chip.set('tool', tool, 'task', task, 'script', refdir + script,
71
+ step=step, index=index, clobber=False)
72
+ for key in variables:
73
+ chip.set('tool', tool, 'task', task, 'var', key, variables[key],
74
+ step=step, index=index, clobber=False)
75
+
76
+ # Required for checker
77
+ chip.add('tool', tool, 'task', task, 'output', outputs,
78
+ step=step, index=index)
79
+ chip.add('tool', tool, 'task', task, 'input', inputs,
80
+ step=step, index=index)
81
+ chip.add('tool', tool, 'task', task, 'require', requires,
82
+ step=step, index=index)
83
+
84
+
85
+ def runtime_options(chip):
86
+ '''
87
+ Custom runtime options, returns list of command line options.
88
+ '''
89
+
90
+ cmdlist = []
91
+
92
+ # resolve paths using chip.find_files
93
+
94
+ return cmdlist
95
+
96
+
97
+ def parse_version(stdout):
98
+ '''
99
+ Version check based on stdout
100
+ Depends on tool reported string
101
+ '''
102
+ # version = stdout.split()[1]
103
+ # return version.split('+')[0]
104
+ return 0
105
+
106
+
107
+ def pre_process(chip):
108
+ '''
109
+ Logic to run prior to executable
110
+ '''
111
+ pass
112
+
113
+
114
+ def post_process(chip):
115
+ '''
116
+ Logic to run after executable
117
+ '''
118
+ pass
119
+
120
+
121
+ ##################################################
122
+ if __name__ == "__main__":
123
+
124
+ chip = make_docs()
125
+ chip.write_manifest("template.json")