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,79 @@
|
|
|
1
|
+
###############################
|
|
2
|
+
# Reading SC Schema
|
|
3
|
+
###############################
|
|
4
|
+
|
|
5
|
+
source ./sc_manifest.tcl
|
|
6
|
+
|
|
7
|
+
yosys echo on
|
|
8
|
+
|
|
9
|
+
###############################
|
|
10
|
+
# Schema Adapter
|
|
11
|
+
###############################
|
|
12
|
+
|
|
13
|
+
set sc_tool yosys
|
|
14
|
+
set sc_step [sc_cfg_get arg step]
|
|
15
|
+
set sc_index [sc_cfg_get arg index]
|
|
16
|
+
set sc_flow [sc_cfg_get option flow]
|
|
17
|
+
set sc_task [sc_cfg_get flowgraph $sc_flow $sc_step $sc_index task]
|
|
18
|
+
set sc_refdir [sc_cfg_tool_task_get refdir]
|
|
19
|
+
|
|
20
|
+
####################
|
|
21
|
+
# DESIGNER's CHOICE
|
|
22
|
+
####################
|
|
23
|
+
|
|
24
|
+
set sc_design [sc_top]
|
|
25
|
+
set sc_flow [sc_cfg_get option flow]
|
|
26
|
+
set sc_optmode [sc_cfg_get option optmode]
|
|
27
|
+
set sc_pdk [sc_cfg_get option pdk]
|
|
28
|
+
|
|
29
|
+
########################################################
|
|
30
|
+
# Design Inputs
|
|
31
|
+
########################################################
|
|
32
|
+
|
|
33
|
+
# TODO: the original OpenFPGA synth script used read_verilog with -nolatches. Is
|
|
34
|
+
# that a flag we might want here?
|
|
35
|
+
|
|
36
|
+
# If UHDM, ilang, or Verilog inputs exist, read them in (this allows mixed
|
|
37
|
+
# inputs in designs). UHDM requires a version of Yosys built with this support.
|
|
38
|
+
|
|
39
|
+
if { [file exists "inputs/$sc_design.uhdm"] } {
|
|
40
|
+
set input_uhdm "inputs/$sc_design.uhdm"
|
|
41
|
+
yosys read_uhdm $input_uhdm
|
|
42
|
+
}
|
|
43
|
+
if { [file exists "inputs/$sc_design.ilang"] } {
|
|
44
|
+
set input_ilang "inputs/$sc_design.ilang"
|
|
45
|
+
yosys read_ilang $input_ilang
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if { [file exists "inputs/$sc_design.v"] } {
|
|
49
|
+
set input_verilog "inputs/$sc_design.v"
|
|
50
|
+
# Use -noblackbox to correctly interpret empty modules as empty,
|
|
51
|
+
# actual black boxes are read in later
|
|
52
|
+
# https://github.com/YosysHQ/yosys/issues/1468
|
|
53
|
+
yosys read_verilog -noblackbox -sv $input_verilog
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
########################################################
|
|
57
|
+
# Override top level parameters
|
|
58
|
+
########################################################
|
|
59
|
+
|
|
60
|
+
yosys chparam -list
|
|
61
|
+
if { [sc_cfg_exists option param] } {
|
|
62
|
+
dict for {key value} [sc_cfg_get option param] {
|
|
63
|
+
if { ![string is integer $value] } {
|
|
64
|
+
set value [concat \"$value\"]
|
|
65
|
+
}
|
|
66
|
+
yosys chparam -set $key $value $sc_design
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
########################################################
|
|
71
|
+
# Synthesis based on mode
|
|
72
|
+
########################################################
|
|
73
|
+
|
|
74
|
+
source "$sc_refdir/${sc_task}.tcl"
|
|
75
|
+
|
|
76
|
+
########################################################
|
|
77
|
+
# Write Netlist
|
|
78
|
+
########################################################
|
|
79
|
+
yosys write_verilog -noexpr -nohex -nodec "outputs/${sc_design}.vg"
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
|
|
2
|
+
from siliconcompiler.tools.yosys.yosys import syn_setup, syn_post_process
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
import siliconcompiler.tools.yosys.prepareLib as prepareLib
|
|
6
|
+
from siliconcompiler import sc_open
|
|
7
|
+
from siliconcompiler import utils
|
|
8
|
+
from siliconcompiler.tools._common.asic import set_tool_task_var, get_libraries, get_mainlib
|
|
9
|
+
from siliconcompiler.tools._common import get_tool_task
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def make_docs(chip):
|
|
13
|
+
chip.load_target("asap7_demo")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def setup(chip):
|
|
17
|
+
'''
|
|
18
|
+
Perform ASIC synthesis
|
|
19
|
+
'''
|
|
20
|
+
|
|
21
|
+
# Generic synthesis task setup.
|
|
22
|
+
syn_setup(chip)
|
|
23
|
+
|
|
24
|
+
# ASIC-specific setup.
|
|
25
|
+
setup_asic(chip)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def setup_asic(chip):
|
|
29
|
+
''' Helper method for configs specific to ASIC steps (both syn and lec).
|
|
30
|
+
'''
|
|
31
|
+
|
|
32
|
+
tool = 'yosys'
|
|
33
|
+
step = chip.get('arg', 'step')
|
|
34
|
+
index = chip.get('arg', 'index')
|
|
35
|
+
_, task = get_tool_task(chip, step, index)
|
|
36
|
+
|
|
37
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
38
|
+
",".join(['asic', 'logiclib']),
|
|
39
|
+
step=step, index=index)
|
|
40
|
+
|
|
41
|
+
syn_corners = get_synthesis_corner(chip)
|
|
42
|
+
|
|
43
|
+
if syn_corners is None:
|
|
44
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
45
|
+
",".join(['tool', tool, 'task', task, 'var', 'synthesis_corner']),
|
|
46
|
+
step=step, index=index)
|
|
47
|
+
|
|
48
|
+
if syn_corners is not None:
|
|
49
|
+
# add timing library requirements
|
|
50
|
+
for lib in get_libraries(chip, 'logic'):
|
|
51
|
+
# mandatory for logiclibs
|
|
52
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
53
|
+
",".join(_get_synthesis_library_key(chip, lib, syn_corners)),
|
|
54
|
+
step=step, index=index)
|
|
55
|
+
|
|
56
|
+
for lib in get_libraries(chip, 'macro'):
|
|
57
|
+
# optional for macrolibs
|
|
58
|
+
if chip.valid(*_get_synthesis_library_key(chip, lib, syn_corners)):
|
|
59
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
60
|
+
",".join(_get_synthesis_library_key(chip, lib, syn_corners)),
|
|
61
|
+
step=step, index=index)
|
|
62
|
+
elif chip.valid('library', lib, 'output', 'blackbox', 'verilog'):
|
|
63
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
64
|
+
",".join(['library', lib, 'output', 'blackbox', 'verilog']),
|
|
65
|
+
step=step, index=index)
|
|
66
|
+
|
|
67
|
+
if chip.valid('input', 'constraint', 'sdc') and \
|
|
68
|
+
chip.get('input', 'constraint', 'sdc', step=step, index=index):
|
|
69
|
+
chip.add('tool', tool, 'task', task, 'require', 'input,constraint,sdc',
|
|
70
|
+
step=step, index=index)
|
|
71
|
+
|
|
72
|
+
# set default control knobs
|
|
73
|
+
mainlib = get_mainlib(chip)
|
|
74
|
+
for option, value in [
|
|
75
|
+
('flatten', "true"),
|
|
76
|
+
('hier_iterations', "10"),
|
|
77
|
+
('hier_threshold', "1000"),
|
|
78
|
+
('autoname', "true"),
|
|
79
|
+
('add_buffers', "true")]:
|
|
80
|
+
chip.set('tool', tool, 'task', task, 'var', option, value,
|
|
81
|
+
step=step, index=index, clobber=False)
|
|
82
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
83
|
+
",".join(['tool', tool, 'task', task, 'var', option]),
|
|
84
|
+
step=step, index=index)
|
|
85
|
+
|
|
86
|
+
# Add conditionally required mainlib variables
|
|
87
|
+
if chip.valid('library', mainlib, 'option', 'var', 'yosys_buffer_cell'):
|
|
88
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
89
|
+
",".join(['library', mainlib, 'option', 'var', 'yosys_buffer_input']),
|
|
90
|
+
step=step, index=index)
|
|
91
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
92
|
+
",".join(['library', mainlib, 'option', 'var', 'yosys_buffer_output']),
|
|
93
|
+
step=step, index=index)
|
|
94
|
+
|
|
95
|
+
library_has_addermap = \
|
|
96
|
+
chip.valid('library', mainlib, 'option', 'file', 'yosys_addermap') and \
|
|
97
|
+
chip.get('library', mainlib, 'option', 'file', 'yosys_addermap')
|
|
98
|
+
chip.set('tool', tool, 'task', task, 'var', 'map_adders',
|
|
99
|
+
"true" if library_has_addermap else "false",
|
|
100
|
+
step=step, index=index, clobber=False)
|
|
101
|
+
if chip.get('tool', tool, 'task', task, 'var', 'map_adders', step=step, index=index)[0] == \
|
|
102
|
+
"true":
|
|
103
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
104
|
+
",".join(['tool', tool, 'task', task, 'var', 'map_adders']),
|
|
105
|
+
step=step, index=index)
|
|
106
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
107
|
+
",".join(['library', mainlib, 'option', 'file', 'yosys_addermap']),
|
|
108
|
+
step=step, index=index)
|
|
109
|
+
|
|
110
|
+
for var0, var1 in [('memory_libmap', 'memory_techmap')]:
|
|
111
|
+
key0 = ['tool', tool, 'tak', task, 'file', var0]
|
|
112
|
+
key1 = ['tool', tool, 'tak', task, 'file', var1]
|
|
113
|
+
if chip.valid(*key0) and chip.get(*key0, step=step, index=index):
|
|
114
|
+
chip.add('tool', tool, 'task', task, 'require', ",".join(key1), step=step, index=index)
|
|
115
|
+
if chip.valid(*key1) and chip.get(*key1, step=step, index=index):
|
|
116
|
+
chip.add('tool', tool, 'task', task, 'require', ",".join(key0), step=step, index=index)
|
|
117
|
+
|
|
118
|
+
chip.set('tool', tool, 'task', task, 'var', 'synthesis_corner', get_synthesis_corner(chip),
|
|
119
|
+
step=step, index=index, clobber=False)
|
|
120
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
121
|
+
",".join(['tool', tool, 'task', task, 'var', 'synthesis_corner']),
|
|
122
|
+
step=step, index=index)
|
|
123
|
+
|
|
124
|
+
# Require abc clock conversion factor, from library units to ps
|
|
125
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
126
|
+
','.join(['library', mainlib, 'option', 'var', 'yosys_abc_clock_multiplier']),
|
|
127
|
+
step=step, index=index)
|
|
128
|
+
abc_driver = get_abc_driver(chip)
|
|
129
|
+
if abc_driver:
|
|
130
|
+
chip.set('tool', tool, 'task', task, 'var', 'abc_constraint_driver', abc_driver,
|
|
131
|
+
step=step, index=index, clobber=False)
|
|
132
|
+
|
|
133
|
+
set_tool_task_var(chip, 'abc_constraint_load',
|
|
134
|
+
schelp='Capacitive load for the abc techmapping in fF, '
|
|
135
|
+
'if not specified it will not be used',
|
|
136
|
+
require='lib')
|
|
137
|
+
|
|
138
|
+
# document parameters
|
|
139
|
+
chip.set('tool', tool, 'task', task, 'var', 'preserve_modules',
|
|
140
|
+
'List of modules in input files to prevent flatten from "flattening"', field='help')
|
|
141
|
+
chip.set('tool', tool, 'task', task, 'var', 'blackbox_modules',
|
|
142
|
+
'List of modules in input files to exclude from synthesis by replacing them '
|
|
143
|
+
'with empty blackboxes"', field='help')
|
|
144
|
+
chip.set('tool', tool, 'task', task, 'var', 'flatten',
|
|
145
|
+
'true/false, invoke synth with the -flatten option', field='help')
|
|
146
|
+
chip.set('tool', tool, 'task', task, 'var', 'autoname',
|
|
147
|
+
'true/false, call autoname to rename wires based on registers', field='help')
|
|
148
|
+
chip.set('tool', tool, 'task', task, 'var', 'map_adders',
|
|
149
|
+
'true/false, techmap adders in Yosys', field='help')
|
|
150
|
+
chip.set('tool', tool, 'task', task, 'var', 'synthesis_corner',
|
|
151
|
+
'Timing corner to use for synthesis', field='help')
|
|
152
|
+
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty',
|
|
153
|
+
'Liberty file to use for flip-flop mapping, if not specified the first in the '
|
|
154
|
+
'logiclib is used', field='help')
|
|
155
|
+
chip.set('tool', tool, 'task', task, 'var', 'abc_constraint_driver',
|
|
156
|
+
'Buffer that drives the abc techmapping, defaults to first buffer specified',
|
|
157
|
+
field='help')
|
|
158
|
+
chip.set('tool', tool, 'task', task, 'file', 'abc_constraint_file',
|
|
159
|
+
'File used to pass in constraints to abc', field='help')
|
|
160
|
+
chip.set('tool', tool, 'task', task, 'var', 'abc_clock_period',
|
|
161
|
+
'Clock period to use for synthesis in ps, if more than one clock is specified, the '
|
|
162
|
+
'smallest period is used.', field='help')
|
|
163
|
+
chip.set('tool', tool, 'task', task, 'var', 'abc_clock_derating',
|
|
164
|
+
'Used to derate the clock period to further constrain the clock, '
|
|
165
|
+
'values between 0 and 1', field='help')
|
|
166
|
+
chip.set('tool', tool, 'task', task, 'file', 'techmap',
|
|
167
|
+
'File to use for techmapping in Yosys', field='help')
|
|
168
|
+
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty_file',
|
|
169
|
+
'File to use for the DFF mapping stage of Yosys', field='help')
|
|
170
|
+
chip.set('tool', tool, 'task', task, 'var', 'add_buffers',
|
|
171
|
+
'true/false, flag to indicate whether to add buffers or not.', field='help')
|
|
172
|
+
|
|
173
|
+
chip.set('tool', tool, 'task', task, 'var', 'hier_iterations',
|
|
174
|
+
'Number of iterations to attempt to determine the hierarchy to flatten',
|
|
175
|
+
field='help')
|
|
176
|
+
chip.set('tool', tool, 'task', task, 'var', 'hier_threshold',
|
|
177
|
+
'Instance limit for the number of cells in a module to preserve.',
|
|
178
|
+
field='help')
|
|
179
|
+
|
|
180
|
+
chip.set('tool', tool, 'task', task, 'var', 'strategy',
|
|
181
|
+
'ABC synthesis strategy. Allowed values are DELAY0-4, AREA0-3, or if the strategy '
|
|
182
|
+
'starts with a + it is assumed to be actual commands for ABC.',
|
|
183
|
+
field='help')
|
|
184
|
+
|
|
185
|
+
chip.set('tool', tool, 'task', task, 'file', 'memory_libmap',
|
|
186
|
+
'File used to map memories with yosys', field='help')
|
|
187
|
+
chip.set('tool', tool, 'task', task, 'file', 'memory_techmap',
|
|
188
|
+
'File used to techmap memories with yosys', field='help')
|
|
189
|
+
|
|
190
|
+
chip.add('tool', tool, 'task', task, 'file', 'synth_extra_map',
|
|
191
|
+
'tools/yosys/techmaps/lcu_kogge_stone.v', package='siliconcompiler',
|
|
192
|
+
step=step, index=index)
|
|
193
|
+
chip.set('tool', tool, 'task', task, 'file', 'synth_extra_map',
|
|
194
|
+
'Files used in synthesis to perform additional techmapping', field='help')
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
################################
|
|
198
|
+
# mark cells dont use and format liberty files for yosys and abc
|
|
199
|
+
################################
|
|
200
|
+
def prepare_synthesis_libraries(chip):
|
|
201
|
+
tool = 'yosys'
|
|
202
|
+
step = chip.get('arg', 'step')
|
|
203
|
+
index = chip.get('arg', 'index')
|
|
204
|
+
_, task = get_tool_task(chip, step, index)
|
|
205
|
+
corners = chip.get('tool', tool, 'task', task, 'var', 'synthesis_corner',
|
|
206
|
+
step=step, index=index)
|
|
207
|
+
|
|
208
|
+
# mark dff libery file with dont use
|
|
209
|
+
dff_liberty_file = chip.find_files('tool', tool, 'task', task, 'file', 'dff_liberty',
|
|
210
|
+
step=step, index=index)[0]
|
|
211
|
+
yosys_dff_file = chip.get('tool', tool, 'task', task, 'file', 'dff_liberty_file',
|
|
212
|
+
step=step, index=index)[0]
|
|
213
|
+
|
|
214
|
+
with open(yosys_dff_file, 'w') as f:
|
|
215
|
+
f.write(prepareLib.processLibertyFile(
|
|
216
|
+
dff_liberty_file,
|
|
217
|
+
logger=None if chip.get('option', 'quiet', step=step, index=index) else chip.logger
|
|
218
|
+
))
|
|
219
|
+
|
|
220
|
+
# Clear in case of rerun
|
|
221
|
+
for libtype in ('synthesis_libraries', 'synthesis_libraries_macros'):
|
|
222
|
+
chip.set('tool', tool, 'task', task, 'file', libtype, [],
|
|
223
|
+
step=step, index=index)
|
|
224
|
+
|
|
225
|
+
# Generate synthesis_libraries and synthesis_macro_libraries for Yosys use
|
|
226
|
+
|
|
227
|
+
# mark libs with dont_use since ABC cannot get this information via its commands
|
|
228
|
+
# this also ensures the liberty files have been decompressed and corrected formatting
|
|
229
|
+
# issues that generally cannot be handled by yosys or yosys-abc
|
|
230
|
+
def get_synthesis_libraries(lib):
|
|
231
|
+
keypath = _get_synthesis_library_key(chip, lib, corners)
|
|
232
|
+
if chip.valid(*keypath):
|
|
233
|
+
return chip.find_files(*keypath, step=step, index=index)
|
|
234
|
+
return []
|
|
235
|
+
|
|
236
|
+
for libtype in ('logic', 'macro'):
|
|
237
|
+
for lib in get_libraries(chip, libtype):
|
|
238
|
+
lib_content = {}
|
|
239
|
+
# Mark dont use
|
|
240
|
+
for lib_file in get_synthesis_libraries(lib):
|
|
241
|
+
# Ensure a unique name is used for library
|
|
242
|
+
lib_file_name_base = os.path.basename(lib_file)
|
|
243
|
+
if lib_file_name_base.lower().endswith('.gz'):
|
|
244
|
+
lib_file_name_base = lib_file_name_base[0:-3]
|
|
245
|
+
if lib_file_name_base.lower().endswith('.lib'):
|
|
246
|
+
lib_file_name_base = lib_file_name_base[0:-4]
|
|
247
|
+
|
|
248
|
+
lib_file_name = lib_file_name_base
|
|
249
|
+
unique_ident = 0
|
|
250
|
+
while lib_file_name in lib_content:
|
|
251
|
+
lib_file_name = f'{lib_file_name_base}_{unique_ident}'
|
|
252
|
+
unique_ident += 1
|
|
253
|
+
|
|
254
|
+
if lib_file == dff_liberty_file:
|
|
255
|
+
with sc_open(yosys_dff_file) as f:
|
|
256
|
+
lib_content[lib_file_name] = f.read()
|
|
257
|
+
continue
|
|
258
|
+
|
|
259
|
+
lib_content[lib_file_name] = prepareLib.processLibertyFile(
|
|
260
|
+
lib_file,
|
|
261
|
+
logger=None if chip.get('option', 'quiet',
|
|
262
|
+
step=step, index=index) else chip.logger)
|
|
263
|
+
|
|
264
|
+
if not lib_content:
|
|
265
|
+
continue
|
|
266
|
+
|
|
267
|
+
var_name = 'synthesis_libraries'
|
|
268
|
+
if libtype == "macro":
|
|
269
|
+
var_name = 'synthesis_libraries_macros'
|
|
270
|
+
|
|
271
|
+
for file, content in lib_content.items():
|
|
272
|
+
output_file = os.path.join(
|
|
273
|
+
chip.getworkdir(step=step, index=index),
|
|
274
|
+
'inputs',
|
|
275
|
+
f'sc_{libtype}_{lib}_{file}.lib'
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
with open(output_file, 'w') as f:
|
|
279
|
+
f.write(content)
|
|
280
|
+
|
|
281
|
+
chip.add('tool', tool, 'task', task, 'file', var_name, output_file,
|
|
282
|
+
step=step, index=index)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def create_abc_synthesis_constraints(chip):
|
|
286
|
+
|
|
287
|
+
tool = 'yosys'
|
|
288
|
+
step = chip.get('arg', 'step')
|
|
289
|
+
index = chip.get('arg', 'index')
|
|
290
|
+
_, task = get_tool_task(chip, step, index)
|
|
291
|
+
|
|
292
|
+
abc_driver = chip.get('tool', tool, 'task', task, 'var', 'abc_constraint_driver',
|
|
293
|
+
step=step, index=index)
|
|
294
|
+
if abc_driver:
|
|
295
|
+
abc_driver = abc_driver[0]
|
|
296
|
+
|
|
297
|
+
abc_load = chip.get('tool', tool, 'task', task, 'var', 'abc_constraint_load',
|
|
298
|
+
step=step, index=index)
|
|
299
|
+
if abc_load:
|
|
300
|
+
abc_load = abc_load[0]
|
|
301
|
+
|
|
302
|
+
if not abc_driver and not abc_load:
|
|
303
|
+
# neither is set so nothing to do
|
|
304
|
+
return
|
|
305
|
+
|
|
306
|
+
with open(chip.get('tool', tool, 'task', task, 'file', 'abc_constraint_file',
|
|
307
|
+
step=step, index=index)[0], "w") as f:
|
|
308
|
+
if abc_load:
|
|
309
|
+
# convert to fF
|
|
310
|
+
abc_load = re.match(r'([0-9]*\.?[0-9]*)\s*([fpa])[fF]?', abc_load)
|
|
311
|
+
|
|
312
|
+
if not abc_load:
|
|
313
|
+
raise ValueError(f'Unable to parse {abc_load}')
|
|
314
|
+
|
|
315
|
+
abc_load_unit = abc_load.group(2)
|
|
316
|
+
if not abc_load_unit:
|
|
317
|
+
abc_load_unit = chip.get('unit', 'capacitance')[0]
|
|
318
|
+
|
|
319
|
+
abc_load = float(abc_load.group(1))
|
|
320
|
+
|
|
321
|
+
if abc_load_unit == 'p':
|
|
322
|
+
abc_load *= 1000
|
|
323
|
+
elif abc_load_unit == 'a':
|
|
324
|
+
abc_load /= 1000
|
|
325
|
+
|
|
326
|
+
abc_template = utils.get_file_template('abc.const',
|
|
327
|
+
root=os.path.join(os.path.dirname(__file__),
|
|
328
|
+
'templates'))
|
|
329
|
+
f.write(abc_template.render(abc_driver=abc_driver, abc_load=abc_load))
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def get_synthesis_corner(chip):
|
|
333
|
+
tool = 'yosys'
|
|
334
|
+
step = chip.get('arg', 'step')
|
|
335
|
+
index = chip.get('arg', 'index')
|
|
336
|
+
_, task = get_tool_task(chip, step, index)
|
|
337
|
+
|
|
338
|
+
syn_corners = chip.get('tool', tool, 'task', task, 'var', 'synthesis_corner',
|
|
339
|
+
step=step, index=index)
|
|
340
|
+
if syn_corners:
|
|
341
|
+
return syn_corners
|
|
342
|
+
|
|
343
|
+
# determine corner based on setup corner from constraints
|
|
344
|
+
corner = None
|
|
345
|
+
for constraint in chip.getkeys('constraint', 'timing'):
|
|
346
|
+
checks = chip.get('constraint', 'timing', constraint, 'check', step=step, index=index)
|
|
347
|
+
if "setup" in checks and not corner:
|
|
348
|
+
corner = chip.get('constraint', 'timing', constraint, 'libcorner',
|
|
349
|
+
step=step, index=index)
|
|
350
|
+
|
|
351
|
+
if not corner:
|
|
352
|
+
# try getting it from first constraint with a valid libcorner
|
|
353
|
+
for constraint in chip.getkeys('constraint', 'timing'):
|
|
354
|
+
if not corner:
|
|
355
|
+
corner = chip.get('constraint', 'timing', constraint, 'libcorner',
|
|
356
|
+
step=step, index=index)
|
|
357
|
+
|
|
358
|
+
return corner
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def _get_synthesis_library_key(chip, lib, corners):
|
|
362
|
+
if chip.valid('library', lib, 'option', 'file', 'yosys_synthesis_libraries'):
|
|
363
|
+
return ('library', lib, 'option', 'file', 'yosys_synthesis_libraries')
|
|
364
|
+
|
|
365
|
+
step = chip.get('arg', 'step')
|
|
366
|
+
index = chip.get('arg', 'index')
|
|
367
|
+
delaymodel = chip.get('asic', 'delaymodel', step=step, index=index)
|
|
368
|
+
for corner in corners:
|
|
369
|
+
if chip.valid('library', lib, 'output', corner, delaymodel):
|
|
370
|
+
return ('library', lib, 'output', corner, delaymodel)
|
|
371
|
+
|
|
372
|
+
return ('library', lib, 'output', corners[0], delaymodel)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def get_dff_liberty_file(chip):
|
|
376
|
+
tool = 'yosys'
|
|
377
|
+
step = chip.get('arg', 'step')
|
|
378
|
+
index = chip.get('arg', 'index')
|
|
379
|
+
_, task = get_tool_task(chip, step, index)
|
|
380
|
+
|
|
381
|
+
dff_liberty = None
|
|
382
|
+
if chip.valid('tool', tool, 'task', task, 'file', 'dff_liberty'):
|
|
383
|
+
dff_liberty = chip.find_files('tool', tool, 'task', task, 'file', 'dff_liberty',
|
|
384
|
+
step=step, index=index)
|
|
385
|
+
if dff_liberty:
|
|
386
|
+
return dff_liberty[0]
|
|
387
|
+
|
|
388
|
+
mainlib = get_mainlib(chip)
|
|
389
|
+
if chip.valid('library', mainlib, 'option', 'file', 'yosys_dff_liberty'):
|
|
390
|
+
dff_liberty = chip.find_files('library', mainlib, 'option', 'file', 'yosys_dff_liberty')
|
|
391
|
+
if dff_liberty:
|
|
392
|
+
return dff_liberty[0]
|
|
393
|
+
|
|
394
|
+
corners = get_synthesis_corner(chip)
|
|
395
|
+
if corners is None:
|
|
396
|
+
return None
|
|
397
|
+
|
|
398
|
+
# if dff liberty file is not set, use the first liberty file defined
|
|
399
|
+
for lib in get_libraries(chip, 'logic'):
|
|
400
|
+
if not chip.valid(*_get_synthesis_library_key(chip, lib, corners)):
|
|
401
|
+
continue
|
|
402
|
+
|
|
403
|
+
lib_files = chip.find_files(*_get_synthesis_library_key(chip, lib, corners),
|
|
404
|
+
step=step, index=index)
|
|
405
|
+
if len(lib_files) > 0:
|
|
406
|
+
return lib_files[0]
|
|
407
|
+
|
|
408
|
+
return None
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def get_abc_period(chip):
|
|
412
|
+
|
|
413
|
+
tool = 'yosys'
|
|
414
|
+
step = chip.get('arg', 'step')
|
|
415
|
+
index = chip.get('arg', 'index')
|
|
416
|
+
_, task = get_tool_task(chip, step, index)
|
|
417
|
+
|
|
418
|
+
mainlib = get_mainlib(chip)
|
|
419
|
+
|
|
420
|
+
abc_clock_period = chip.get('tool', tool, 'task', task, 'var', 'abc_clock_period',
|
|
421
|
+
step=step, index=index)
|
|
422
|
+
if abc_clock_period:
|
|
423
|
+
return abc_clock_period[0]
|
|
424
|
+
|
|
425
|
+
period = None
|
|
426
|
+
|
|
427
|
+
abc_clock_multiplier = float(chip.get('library', mainlib, 'option', 'var',
|
|
428
|
+
'yosys_abc_clock_multiplier')[0])
|
|
429
|
+
|
|
430
|
+
# get clock information from sdc files
|
|
431
|
+
# TODO: fix for fpga/asic differentiation later
|
|
432
|
+
if chip.valid('input', 'constraint', 'sdc'):
|
|
433
|
+
for sdc in chip.find_files('input', 'constraint', 'sdc', step=step, index=index):
|
|
434
|
+
lines = []
|
|
435
|
+
with sc_open(sdc) as f:
|
|
436
|
+
lines = f.read().splitlines()
|
|
437
|
+
|
|
438
|
+
# collect simple variables in case clock is specified with a variable
|
|
439
|
+
re_var = r"[A-Za-z0-9_]+"
|
|
440
|
+
re_num = r"[0-9\.]+"
|
|
441
|
+
sdc_vars = {}
|
|
442
|
+
for line in lines:
|
|
443
|
+
tcl_variable = re.findall(fr"^\s*set\s+({re_var})\s+({re_num})", line)
|
|
444
|
+
if tcl_variable:
|
|
445
|
+
var_name, var_value = tcl_variable[0]
|
|
446
|
+
sdc_vars[f'${var_name}'] = float(var_value)
|
|
447
|
+
|
|
448
|
+
# TODO: handle line continuations
|
|
449
|
+
for line in lines:
|
|
450
|
+
clock_period = re.findall(fr"create_clock\s.*-period\s+({re_num}|\${re_var})",
|
|
451
|
+
line)
|
|
452
|
+
if clock_period:
|
|
453
|
+
clock_period = clock_period[0]
|
|
454
|
+
if clock_period[0] == '$':
|
|
455
|
+
if clock_period in sdc_vars:
|
|
456
|
+
clock_period = sdc_vars[clock_period]
|
|
457
|
+
else:
|
|
458
|
+
chip.logger.warning('Unable to identify clock period from '
|
|
459
|
+
f'{clock_period}.')
|
|
460
|
+
continue
|
|
461
|
+
else:
|
|
462
|
+
clock_period = float(clock_period)
|
|
463
|
+
|
|
464
|
+
clock_period = clock_period * abc_clock_multiplier
|
|
465
|
+
|
|
466
|
+
if period is None:
|
|
467
|
+
period = clock_period
|
|
468
|
+
else:
|
|
469
|
+
period = min(period, clock_period)
|
|
470
|
+
|
|
471
|
+
if period is None:
|
|
472
|
+
# get clock information from defined clocks
|
|
473
|
+
for pin in chip.getkeys('datasheet', 'pin'):
|
|
474
|
+
for mode in chip.getkeys('datasheet', 'pin', pin, 'type'):
|
|
475
|
+
if chip.get('datasheet', 'pin', pin, 'type', mode) == 'clock':
|
|
476
|
+
clock_period = min(chip.get('datasheet', 'pin', pin, 'tperiod', mode)) * 1e12
|
|
477
|
+
|
|
478
|
+
if period is None:
|
|
479
|
+
period = clock_period
|
|
480
|
+
else:
|
|
481
|
+
period = min(period, clock_period)
|
|
482
|
+
|
|
483
|
+
if period is None:
|
|
484
|
+
return None
|
|
485
|
+
|
|
486
|
+
abc_clock_derating = chip.get('tool', tool, 'task', task, 'var', 'abc_clock_derating',
|
|
487
|
+
step=step, index=index)
|
|
488
|
+
if abc_clock_derating:
|
|
489
|
+
derating = float(abc_clock_derating[0])
|
|
490
|
+
if derating > 1:
|
|
491
|
+
chip.logger.warning("abc_clock_derating is greater than 1.0")
|
|
492
|
+
elif derating > 0:
|
|
493
|
+
period *= (1.0 - derating)
|
|
494
|
+
else:
|
|
495
|
+
chip.logger.error("abc_clock_derating is negative")
|
|
496
|
+
|
|
497
|
+
return int(period)
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
def get_abc_driver(chip):
|
|
501
|
+
|
|
502
|
+
tool = 'yosys'
|
|
503
|
+
step = chip.get('arg', 'step')
|
|
504
|
+
index = chip.get('arg', 'index')
|
|
505
|
+
_, task = get_tool_task(chip, step, index)
|
|
506
|
+
|
|
507
|
+
abc_driver = chip.get('tool', tool, 'task', task, 'var', 'abc_constraint_driver',
|
|
508
|
+
step=step, index=index)
|
|
509
|
+
if abc_driver:
|
|
510
|
+
return abc_driver[0]
|
|
511
|
+
|
|
512
|
+
abc_driver = None
|
|
513
|
+
# get the first driver defined in the logic lib
|
|
514
|
+
for lib in get_libraries(chip, 'logic'):
|
|
515
|
+
if chip.valid('library', lib, 'option', 'var', 'yosys_driver_cell') and not abc_driver:
|
|
516
|
+
abc_driver = chip.get('library', lib, 'option', 'var', 'yosys_driver_cell')[0]
|
|
517
|
+
|
|
518
|
+
return abc_driver
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
##################################################
|
|
522
|
+
def pre_process(chip):
|
|
523
|
+
''' Tool specific function to run before step execution
|
|
524
|
+
'''
|
|
525
|
+
|
|
526
|
+
step = chip.get('arg', 'step')
|
|
527
|
+
index = chip.get('arg', 'index')
|
|
528
|
+
tool, task = get_tool_task(chip, step, index)
|
|
529
|
+
|
|
530
|
+
# copy techmapping from libraries
|
|
531
|
+
logiclibs = get_libraries(chip, 'logic')
|
|
532
|
+
macrolibs = get_libraries(chip, 'macro')
|
|
533
|
+
for lib in logiclibs + macrolibs:
|
|
534
|
+
if not chip.valid('library', lib, 'option', 'file', 'yosys_techmap'):
|
|
535
|
+
continue
|
|
536
|
+
for techmap in chip.find_files('library', lib, 'option', 'file', 'yosys_techmap'):
|
|
537
|
+
if techmap is None:
|
|
538
|
+
continue
|
|
539
|
+
chip.add('tool', tool, 'task', task, 'file', 'techmap', techmap, step=step, index=index)
|
|
540
|
+
|
|
541
|
+
# Constants needed by yosys, do not allow overriding of values so force clobbering
|
|
542
|
+
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty_file',
|
|
543
|
+
f"{chip.getworkdir(step=step, index=index)}/inputs/sc_dff_library.lib",
|
|
544
|
+
step=step, index=index, clobber=True)
|
|
545
|
+
chip.set('tool', tool, 'task', task, 'file', 'abc_constraint_file',
|
|
546
|
+
f"{chip.getworkdir(step=step, index=index)}/inputs/sc_abc.constraints",
|
|
547
|
+
step=step, index=index, clobber=True)
|
|
548
|
+
|
|
549
|
+
dff_liberty_file = get_dff_liberty_file(chip)
|
|
550
|
+
if dff_liberty_file:
|
|
551
|
+
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty', dff_liberty_file,
|
|
552
|
+
step=step, index=index, clobber=False)
|
|
553
|
+
|
|
554
|
+
abc_clock_period = get_abc_period(chip)
|
|
555
|
+
if abc_clock_period:
|
|
556
|
+
chip.set('tool', tool, 'task', task, 'var', 'abc_clock_period', str(abc_clock_period),
|
|
557
|
+
step=step, index=index, clobber=False)
|
|
558
|
+
|
|
559
|
+
prepare_synthesis_libraries(chip)
|
|
560
|
+
create_abc_synthesis_constraints(chip)
|
|
561
|
+
return
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
def post_process(chip):
|
|
565
|
+
syn_post_process(chip)
|