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.
- siliconcompiler/__init__.py +24 -0
- siliconcompiler/__main__.py +12 -0
- siliconcompiler/_common.py +49 -0
- siliconcompiler/_metadata.py +36 -0
- siliconcompiler/apps/__init__.py +0 -0
- siliconcompiler/apps/_common.py +76 -0
- siliconcompiler/apps/sc.py +92 -0
- siliconcompiler/apps/sc_dashboard.py +94 -0
- siliconcompiler/apps/sc_issue.py +178 -0
- siliconcompiler/apps/sc_remote.py +199 -0
- siliconcompiler/apps/sc_server.py +39 -0
- siliconcompiler/apps/sc_show.py +142 -0
- siliconcompiler/apps/smake.py +232 -0
- siliconcompiler/checklists/__init__.py +0 -0
- siliconcompiler/checklists/oh_tapeout.py +41 -0
- siliconcompiler/core.py +3221 -0
- siliconcompiler/data/RobotoMono/LICENSE.txt +202 -0
- siliconcompiler/data/RobotoMono/RobotoMono-Regular.ttf +0 -0
- siliconcompiler/data/heartbeat.v +18 -0
- siliconcompiler/data/logo.png +0 -0
- siliconcompiler/flowgraph.py +570 -0
- siliconcompiler/flows/__init__.py +0 -0
- siliconcompiler/flows/_common.py +67 -0
- siliconcompiler/flows/asicflow.py +180 -0
- siliconcompiler/flows/asictopflow.py +38 -0
- siliconcompiler/flows/dvflow.py +86 -0
- siliconcompiler/flows/fpgaflow.py +202 -0
- siliconcompiler/flows/generate_openroad_rcx.py +66 -0
- siliconcompiler/flows/lintflow.py +35 -0
- siliconcompiler/flows/screenshotflow.py +51 -0
- siliconcompiler/flows/showflow.py +59 -0
- siliconcompiler/flows/signoffflow.py +53 -0
- siliconcompiler/flows/synflow.py +128 -0
- siliconcompiler/fpgas/__init__.py +0 -0
- siliconcompiler/fpgas/lattice_ice40.py +42 -0
- siliconcompiler/fpgas/vpr_example.py +109 -0
- siliconcompiler/issue.py +300 -0
- siliconcompiler/libs/__init__.py +0 -0
- siliconcompiler/libs/asap7sc7p5t.py +8 -0
- siliconcompiler/libs/gf180mcu.py +8 -0
- siliconcompiler/libs/nangate45.py +8 -0
- siliconcompiler/libs/sky130hd.py +8 -0
- siliconcompiler/libs/sky130io.py +8 -0
- siliconcompiler/package.py +412 -0
- siliconcompiler/pdks/__init__.py +0 -0
- siliconcompiler/pdks/asap7.py +8 -0
- siliconcompiler/pdks/freepdk45.py +8 -0
- siliconcompiler/pdks/gf180.py +8 -0
- siliconcompiler/pdks/skywater130.py +8 -0
- siliconcompiler/remote/__init__.py +36 -0
- siliconcompiler/remote/client.py +891 -0
- siliconcompiler/remote/schema.py +106 -0
- siliconcompiler/remote/server.py +507 -0
- siliconcompiler/remote/server_schema/requests/cancel_job.json +51 -0
- siliconcompiler/remote/server_schema/requests/check_progress.json +61 -0
- siliconcompiler/remote/server_schema/requests/check_server.json +38 -0
- siliconcompiler/remote/server_schema/requests/delete_job.json +51 -0
- siliconcompiler/remote/server_schema/requests/get_results.json +48 -0
- siliconcompiler/remote/server_schema/requests/remote_run.json +40 -0
- siliconcompiler/remote/server_schema/responses/cancel_job.json +18 -0
- siliconcompiler/remote/server_schema/responses/check_progress.json +30 -0
- siliconcompiler/remote/server_schema/responses/check_server.json +32 -0
- siliconcompiler/remote/server_schema/responses/delete_job.json +18 -0
- siliconcompiler/remote/server_schema/responses/get_results.json +21 -0
- siliconcompiler/remote/server_schema/responses/remote_run.json +25 -0
- siliconcompiler/report/__init__.py +13 -0
- siliconcompiler/report/html_report.py +74 -0
- siliconcompiler/report/report.py +355 -0
- siliconcompiler/report/streamlit_report.py +137 -0
- siliconcompiler/report/streamlit_viewer.py +944 -0
- siliconcompiler/report/summary_image.py +117 -0
- siliconcompiler/report/summary_table.py +105 -0
- siliconcompiler/report/utils.py +163 -0
- siliconcompiler/scheduler/__init__.py +2092 -0
- siliconcompiler/scheduler/docker_runner.py +253 -0
- siliconcompiler/scheduler/run_node.py +138 -0
- siliconcompiler/scheduler/send_messages.py +178 -0
- siliconcompiler/scheduler/slurm.py +208 -0
- siliconcompiler/scheduler/validation/email_credentials.json +54 -0
- siliconcompiler/schema/__init__.py +7 -0
- siliconcompiler/schema/schema_cfg.py +4014 -0
- siliconcompiler/schema/schema_obj.py +1841 -0
- siliconcompiler/schema/utils.py +93 -0
- siliconcompiler/sphinx_ext/__init__.py +0 -0
- siliconcompiler/sphinx_ext/dynamicgen.py +1006 -0
- siliconcompiler/sphinx_ext/schemagen.py +221 -0
- siliconcompiler/sphinx_ext/utils.py +166 -0
- siliconcompiler/targets/__init__.py +0 -0
- siliconcompiler/targets/asap7_demo.py +68 -0
- siliconcompiler/targets/asic_demo.py +38 -0
- siliconcompiler/targets/fpgaflow_demo.py +47 -0
- siliconcompiler/targets/freepdk45_demo.py +59 -0
- siliconcompiler/targets/gf180_demo.py +77 -0
- siliconcompiler/targets/skywater130_demo.py +70 -0
- siliconcompiler/templates/email/general.j2 +66 -0
- siliconcompiler/templates/email/summary.j2 +43 -0
- siliconcompiler/templates/issue/README.txt +26 -0
- siliconcompiler/templates/issue/run.sh +6 -0
- siliconcompiler/templates/report/bootstrap.min.css +7 -0
- siliconcompiler/templates/report/bootstrap.min.js +7 -0
- siliconcompiler/templates/report/bootstrap_LICENSE.md +24 -0
- siliconcompiler/templates/report/sc_report.j2 +427 -0
- siliconcompiler/templates/slurm/run.sh +9 -0
- siliconcompiler/templates/tcl/manifest.tcl.j2 +137 -0
- siliconcompiler/tools/__init__.py +0 -0
- siliconcompiler/tools/_common/__init__.py +432 -0
- siliconcompiler/tools/_common/asic.py +115 -0
- siliconcompiler/tools/_common/sdc/sc_constraints.sdc +76 -0
- siliconcompiler/tools/_common/tcl/sc_pin_constraints.tcl +63 -0
- siliconcompiler/tools/bambu/bambu.py +32 -0
- siliconcompiler/tools/bambu/convert.py +77 -0
- siliconcompiler/tools/bluespec/bluespec.py +40 -0
- siliconcompiler/tools/bluespec/convert.py +103 -0
- siliconcompiler/tools/builtin/_common.py +155 -0
- siliconcompiler/tools/builtin/builtin.py +26 -0
- siliconcompiler/tools/builtin/concatenate.py +85 -0
- siliconcompiler/tools/builtin/join.py +27 -0
- siliconcompiler/tools/builtin/maximum.py +46 -0
- siliconcompiler/tools/builtin/minimum.py +57 -0
- siliconcompiler/tools/builtin/mux.py +70 -0
- siliconcompiler/tools/builtin/nop.py +38 -0
- siliconcompiler/tools/builtin/verify.py +83 -0
- siliconcompiler/tools/chisel/SCDriver.scala +10 -0
- siliconcompiler/tools/chisel/build.sbt +27 -0
- siliconcompiler/tools/chisel/chisel.py +37 -0
- siliconcompiler/tools/chisel/convert.py +140 -0
- siliconcompiler/tools/execute/exec_input.py +41 -0
- siliconcompiler/tools/execute/execute.py +17 -0
- siliconcompiler/tools/genfasm/bitstream.py +61 -0
- siliconcompiler/tools/genfasm/genfasm.py +40 -0
- siliconcompiler/tools/ghdl/convert.py +87 -0
- siliconcompiler/tools/ghdl/ghdl.py +41 -0
- siliconcompiler/tools/icarus/compile.py +87 -0
- siliconcompiler/tools/icarus/icarus.py +36 -0
- siliconcompiler/tools/icepack/bitstream.py +20 -0
- siliconcompiler/tools/icepack/icepack.py +43 -0
- siliconcompiler/tools/klayout/export.py +117 -0
- siliconcompiler/tools/klayout/klayout.py +119 -0
- siliconcompiler/tools/klayout/klayout_export.py +205 -0
- siliconcompiler/tools/klayout/klayout_operations.py +363 -0
- siliconcompiler/tools/klayout/klayout_show.py +242 -0
- siliconcompiler/tools/klayout/klayout_utils.py +176 -0
- siliconcompiler/tools/klayout/operations.py +194 -0
- siliconcompiler/tools/klayout/screenshot.py +98 -0
- siliconcompiler/tools/klayout/show.py +101 -0
- siliconcompiler/tools/magic/drc.py +49 -0
- siliconcompiler/tools/magic/extspice.py +19 -0
- siliconcompiler/tools/magic/magic.py +85 -0
- siliconcompiler/tools/magic/sc_drc.tcl +96 -0
- siliconcompiler/tools/magic/sc_extspice.tcl +54 -0
- siliconcompiler/tools/magic/sc_magic.tcl +47 -0
- siliconcompiler/tools/montage/montage.py +30 -0
- siliconcompiler/tools/montage/tile.py +66 -0
- siliconcompiler/tools/netgen/count_lvs.py +132 -0
- siliconcompiler/tools/netgen/lvs.py +90 -0
- siliconcompiler/tools/netgen/netgen.py +36 -0
- siliconcompiler/tools/netgen/sc_lvs.tcl +46 -0
- siliconcompiler/tools/nextpnr/apr.py +24 -0
- siliconcompiler/tools/nextpnr/nextpnr.py +59 -0
- siliconcompiler/tools/openfpgaloader/openfpgaloader.py +39 -0
- siliconcompiler/tools/openroad/__init__.py +0 -0
- siliconcompiler/tools/openroad/cts.py +45 -0
- siliconcompiler/tools/openroad/dfm.py +66 -0
- siliconcompiler/tools/openroad/export.py +131 -0
- siliconcompiler/tools/openroad/floorplan.py +70 -0
- siliconcompiler/tools/openroad/openroad.py +977 -0
- siliconcompiler/tools/openroad/physyn.py +27 -0
- siliconcompiler/tools/openroad/place.py +41 -0
- siliconcompiler/tools/openroad/rcx_bench.py +95 -0
- siliconcompiler/tools/openroad/rcx_extract.py +34 -0
- siliconcompiler/tools/openroad/route.py +45 -0
- siliconcompiler/tools/openroad/screenshot.py +60 -0
- siliconcompiler/tools/openroad/scripts/sc_apr.tcl +499 -0
- siliconcompiler/tools/openroad/scripts/sc_cts.tcl +64 -0
- siliconcompiler/tools/openroad/scripts/sc_dfm.tcl +20 -0
- siliconcompiler/tools/openroad/scripts/sc_export.tcl +98 -0
- siliconcompiler/tools/openroad/scripts/sc_floorplan.tcl +413 -0
- siliconcompiler/tools/openroad/scripts/sc_metrics.tcl +158 -0
- siliconcompiler/tools/openroad/scripts/sc_physyn.tcl +7 -0
- siliconcompiler/tools/openroad/scripts/sc_place.tcl +84 -0
- siliconcompiler/tools/openroad/scripts/sc_procs.tcl +423 -0
- siliconcompiler/tools/openroad/scripts/sc_rcx.tcl +63 -0
- siliconcompiler/tools/openroad/scripts/sc_rcx_bench.tcl +20 -0
- siliconcompiler/tools/openroad/scripts/sc_rcx_extract.tcl +12 -0
- siliconcompiler/tools/openroad/scripts/sc_route.tcl +133 -0
- siliconcompiler/tools/openroad/scripts/sc_screenshot.tcl +21 -0
- siliconcompiler/tools/openroad/scripts/sc_write.tcl +5 -0
- siliconcompiler/tools/openroad/scripts/sc_write_images.tcl +361 -0
- siliconcompiler/tools/openroad/show.py +94 -0
- siliconcompiler/tools/openroad/templates/pex.tcl +8 -0
- siliconcompiler/tools/opensta/__init__.py +101 -0
- siliconcompiler/tools/opensta/report_libraries.py +28 -0
- siliconcompiler/tools/opensta/scripts/sc_procs.tcl +47 -0
- siliconcompiler/tools/opensta/scripts/sc_report_libraries.tcl +74 -0
- siliconcompiler/tools/opensta/scripts/sc_timing.tcl +268 -0
- siliconcompiler/tools/opensta/timing.py +214 -0
- siliconcompiler/tools/slang/__init__.py +49 -0
- siliconcompiler/tools/slang/lint.py +101 -0
- siliconcompiler/tools/surelog/__init__.py +123 -0
- siliconcompiler/tools/surelog/parse.py +183 -0
- siliconcompiler/tools/surelog/templates/output.v +7 -0
- siliconcompiler/tools/sv2v/convert.py +46 -0
- siliconcompiler/tools/sv2v/sv2v.py +37 -0
- siliconcompiler/tools/template/template.py +125 -0
- siliconcompiler/tools/verilator/compile.py +139 -0
- siliconcompiler/tools/verilator/lint.py +19 -0
- siliconcompiler/tools/verilator/parse.py +27 -0
- siliconcompiler/tools/verilator/verilator.py +172 -0
- siliconcompiler/tools/vivado/__init__.py +7 -0
- siliconcompiler/tools/vivado/bitstream.py +21 -0
- siliconcompiler/tools/vivado/place.py +21 -0
- siliconcompiler/tools/vivado/route.py +21 -0
- siliconcompiler/tools/vivado/scripts/sc_bitstream.tcl +6 -0
- siliconcompiler/tools/vivado/scripts/sc_place.tcl +2 -0
- siliconcompiler/tools/vivado/scripts/sc_route.tcl +4 -0
- siliconcompiler/tools/vivado/scripts/sc_run.tcl +45 -0
- siliconcompiler/tools/vivado/scripts/sc_syn_fpga.tcl +25 -0
- siliconcompiler/tools/vivado/syn_fpga.py +20 -0
- siliconcompiler/tools/vivado/vivado.py +147 -0
- siliconcompiler/tools/vpr/_json_constraint.py +63 -0
- siliconcompiler/tools/vpr/_xml_constraint.py +109 -0
- siliconcompiler/tools/vpr/place.py +137 -0
- siliconcompiler/tools/vpr/route.py +124 -0
- siliconcompiler/tools/vpr/screenshot.py +54 -0
- siliconcompiler/tools/vpr/show.py +88 -0
- siliconcompiler/tools/vpr/vpr.py +357 -0
- siliconcompiler/tools/xyce/xyce.py +36 -0
- siliconcompiler/tools/yosys/lec.py +56 -0
- siliconcompiler/tools/yosys/prepareLib.py +59 -0
- siliconcompiler/tools/yosys/sc_lec.tcl +84 -0
- siliconcompiler/tools/yosys/sc_syn.tcl +79 -0
- siliconcompiler/tools/yosys/syn_asic.py +565 -0
- siliconcompiler/tools/yosys/syn_asic.tcl +377 -0
- siliconcompiler/tools/yosys/syn_asic_fpga_shared.tcl +31 -0
- siliconcompiler/tools/yosys/syn_fpga.py +146 -0
- siliconcompiler/tools/yosys/syn_fpga.tcl +233 -0
- siliconcompiler/tools/yosys/syn_strategies.tcl +81 -0
- siliconcompiler/tools/yosys/techmaps/lcu_kogge_stone.v +39 -0
- siliconcompiler/tools/yosys/templates/abc.const +2 -0
- siliconcompiler/tools/yosys/yosys.py +147 -0
- siliconcompiler/units.py +259 -0
- siliconcompiler/use.py +177 -0
- siliconcompiler/utils/__init__.py +423 -0
- siliconcompiler/utils/asic.py +158 -0
- siliconcompiler/utils/showtools.py +25 -0
- siliconcompiler-0.26.5.dist-info/LICENSE +190 -0
- siliconcompiler-0.26.5.dist-info/METADATA +195 -0
- siliconcompiler-0.26.5.dist-info/RECORD +251 -0
- siliconcompiler-0.26.5.dist-info/WHEEL +5 -0
- siliconcompiler-0.26.5.dist-info/entry_points.txt +12 -0
- 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,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")
|