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,377 @@
|
|
|
1
|
+
####################
|
|
2
|
+
# Helper functions
|
|
3
|
+
####################
|
|
4
|
+
source "$sc_refdir/syn_asic_fpga_shared.tcl"
|
|
5
|
+
|
|
6
|
+
proc preserve_modules {} {
|
|
7
|
+
global sc_cfg
|
|
8
|
+
global sc_tool
|
|
9
|
+
global sc_task
|
|
10
|
+
|
|
11
|
+
if { [sc_cfg_tool_task_exists var preserve_modules] } {
|
|
12
|
+
foreach pmodule [sc_cfg_tool_task_get var preserve_modules] {
|
|
13
|
+
foreach module [get_modules $pmodule] {
|
|
14
|
+
yosys log "Preserving module hierarchy: $module"
|
|
15
|
+
yosys select -module $module
|
|
16
|
+
yosys setattr -mod -set keep_hierarchy 1
|
|
17
|
+
yosys select -clear
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
proc get_modules { { find "*" } } {
|
|
24
|
+
yosys echo off
|
|
25
|
+
set modules_ls [yosys tee -q -s result.string ls]
|
|
26
|
+
yosys echo on
|
|
27
|
+
# Grab only the modules and not the header and footer
|
|
28
|
+
set modules [list]
|
|
29
|
+
foreach module [lrange [split $modules_ls \n] 2 end-1] {
|
|
30
|
+
set module [string trim $module]
|
|
31
|
+
if { [string length $module] == 0 } {
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
lappend modules $module
|
|
35
|
+
}
|
|
36
|
+
set modules [lsearch -all -inline $modules $find]
|
|
37
|
+
if { [llength $modules] == 0 } {
|
|
38
|
+
yosys log "Warning: Unable to find modules matching: $find"
|
|
39
|
+
}
|
|
40
|
+
return [lsort $modules]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
proc determine_keep_hierarchy { iter cell_limit } {
|
|
44
|
+
global sc_design
|
|
45
|
+
|
|
46
|
+
# Grab only the modules and not the header and footer
|
|
47
|
+
set modules [get_modules]
|
|
48
|
+
|
|
49
|
+
# Save a copy of the current design so we can do a few optimizations and techmap
|
|
50
|
+
yosys design -save hierarchy_checkpoint
|
|
51
|
+
yosys techmap
|
|
52
|
+
yosys opt -fast -full -purge
|
|
53
|
+
|
|
54
|
+
set cell_counts [dict create]
|
|
55
|
+
|
|
56
|
+
foreach module $modules {
|
|
57
|
+
yosys stat -top $module
|
|
58
|
+
yosys echo off
|
|
59
|
+
set cells_count [yosys tee -q -s result.string scratchpad -get stat.num_cells]
|
|
60
|
+
yosys echo on
|
|
61
|
+
dict set cell_counts $module [expr { int($cells_count) }]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Restore design
|
|
65
|
+
yosys design -load hierarchy_checkpoint
|
|
66
|
+
foreach module $modules {
|
|
67
|
+
yosys select -module $module
|
|
68
|
+
yosys setattr -mod -set keep_hierarchy \
|
|
69
|
+
[expr { [dict get $cell_counts $module] > $cell_limit }]
|
|
70
|
+
yosys select -clear
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
preserve_modules
|
|
74
|
+
|
|
75
|
+
# Rerun coarse synth with flatten
|
|
76
|
+
yosys synth -flatten -top $sc_design -run coarse:fine
|
|
77
|
+
|
|
78
|
+
return [expr { [llength $modules] != [llength [get_modules]] }]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
####################
|
|
82
|
+
# DESIGNER's CHOICE
|
|
83
|
+
####################
|
|
84
|
+
|
|
85
|
+
set sc_logiclibs [sc_get_asic_libraries logic]
|
|
86
|
+
set sc_macrolibs [sc_get_asic_libraries macro]
|
|
87
|
+
|
|
88
|
+
set sc_libraries [sc_cfg_tool_task_get {file} synthesis_libraries]
|
|
89
|
+
if { [sc_cfg_tool_task_exists {file} synthesis_libraries_macros] } {
|
|
90
|
+
set sc_macro_libraries \
|
|
91
|
+
[sc_cfg_tool_task_get {file} synthesis_libraries_macros]
|
|
92
|
+
} else {
|
|
93
|
+
set sc_macro_libraries []
|
|
94
|
+
}
|
|
95
|
+
set sc_mainlib [lindex $sc_logiclibs 0]
|
|
96
|
+
|
|
97
|
+
set sc_dff_library \
|
|
98
|
+
[lindex [sc_cfg_tool_task_get {file} dff_liberty_file] 0]
|
|
99
|
+
set sc_abc_constraints \
|
|
100
|
+
[lindex [sc_cfg_tool_task_get {file} abc_constraint_file] 0]
|
|
101
|
+
|
|
102
|
+
set sc_blackboxes []
|
|
103
|
+
foreach lib $sc_macrolibs {
|
|
104
|
+
if { [sc_cfg_exists library $lib output blackbox verilog] } {
|
|
105
|
+
foreach lib_f [sc_cfg_get library $lib output blackbox verilog] {
|
|
106
|
+
lappend sc_blackboxes $lib_f
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
set sc_memory_libmap_files ""
|
|
112
|
+
if { [sc_cfg_tool_task_exists file memory_libmap] } {
|
|
113
|
+
set sc_memory_libmap_files [sc_cfg_tool_task_get file memory_libmap]
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
set sc_memory_techmap_files ""
|
|
117
|
+
if { [sc_cfg_tool_task_exists file memory_techmap] } {
|
|
118
|
+
set sc_memory_techmap_files [sc_cfg_tool_task_get file memory_techmap]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
#########################
|
|
122
|
+
# Schema helper functions
|
|
123
|
+
#########################
|
|
124
|
+
|
|
125
|
+
proc has_tie_cell { type } {
|
|
126
|
+
upvar sc_cfg sc_cfg
|
|
127
|
+
upvar sc_mainlib sc_mainlib
|
|
128
|
+
upvar sc_tool sc_tool
|
|
129
|
+
|
|
130
|
+
return [expr { [sc_cfg_exists library $sc_mainlib option {var} yosys_tie${type}_cell] && \
|
|
131
|
+
[sc_cfg_exists library $sc_mainlib option {var} yosys_tie${type}_port] }]
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
proc get_tie_cell { type } {
|
|
135
|
+
upvar sc_cfg sc_cfg
|
|
136
|
+
upvar sc_mainlib sc_mainlib
|
|
137
|
+
upvar sc_tool sc_tool
|
|
138
|
+
|
|
139
|
+
set cell \
|
|
140
|
+
[lindex [sc_cfg_get library $sc_mainlib option {var} yosys_tie${type}_cell] 0]
|
|
141
|
+
set port \
|
|
142
|
+
[lindex [sc_cfg_get library $sc_mainlib option {var} yosys_tie${type}_port] 0]
|
|
143
|
+
|
|
144
|
+
return "$cell $port"
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
proc has_buffer_cell { } {
|
|
148
|
+
upvar sc_cfg sc_cfg
|
|
149
|
+
upvar sc_mainlib sc_mainlib
|
|
150
|
+
upvar sc_tool sc_tool
|
|
151
|
+
|
|
152
|
+
return [expr { [sc_cfg_exists library $sc_mainlib option {var} yosys_buffer_cell] && \
|
|
153
|
+
[sc_cfg_exists library $sc_mainlib option {var} yosys_buffer_input] && \
|
|
154
|
+
[sc_cfg_exists library $sc_mainlib option {var} yosys_buffer_output] }]
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
proc get_buffer_cell { } {
|
|
158
|
+
upvar sc_cfg sc_cfg
|
|
159
|
+
upvar sc_mainlib sc_mainlib
|
|
160
|
+
upvar sc_tool sc_tool
|
|
161
|
+
|
|
162
|
+
set cell [lindex [sc_cfg_get library $sc_mainlib option {var} yosys_buffer_cell] 0]
|
|
163
|
+
set in [lindex [sc_cfg_get library $sc_mainlib option {var} yosys_buffer_input] 0]
|
|
164
|
+
set out [lindex [sc_cfg_get library $sc_mainlib option {var} yosys_buffer_output] 0]
|
|
165
|
+
|
|
166
|
+
return "$cell $in $out"
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
########################################################
|
|
170
|
+
# Read Libraries
|
|
171
|
+
########################################################
|
|
172
|
+
|
|
173
|
+
foreach lib_file "$sc_libraries $sc_macro_libraries" {
|
|
174
|
+
yosys read_liberty -lib $lib_file
|
|
175
|
+
}
|
|
176
|
+
foreach bb_file $sc_blackboxes {
|
|
177
|
+
yosys log "Reading blackbox model file: $bb_file"
|
|
178
|
+
yosys read_verilog -sv $bb_file
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
########################################################
|
|
182
|
+
# Synthesis
|
|
183
|
+
########################################################
|
|
184
|
+
|
|
185
|
+
# Before working on the design, we mask out any module supplied via
|
|
186
|
+
# `blackbox_modules`. This allows synthesis of parts of the design without having
|
|
187
|
+
# to modify the input RTL.
|
|
188
|
+
if { [sc_cfg_tool_task_exists var blackbox_modules] } {
|
|
189
|
+
foreach bb [sc_cfg_tool_task_get var blackbox_modules] {
|
|
190
|
+
foreach module [get_modules $bb] {
|
|
191
|
+
yosys log "Blackboxing module: $module"
|
|
192
|
+
yosys blackbox $module
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# Although the `synth` command also runs `hierarchy`, we run it here without the
|
|
198
|
+
# `-check` flag first in order to resolve parameters before looking for missing
|
|
199
|
+
# modules. This works around the fact that Surelog doesn't pickle modules that
|
|
200
|
+
# are instantiated inside generate blocks that will get eliminated. This seems
|
|
201
|
+
# to give us the same behavior as passing the `-defer` flag to read_verilog, but
|
|
202
|
+
# `-defer` gave us different post-synth results on one of our test cases (while
|
|
203
|
+
# this appears to result in no differences). Note this must be called after the
|
|
204
|
+
# read_liberty calls for it to not affect synthesis results.
|
|
205
|
+
yosys hierarchy -top $sc_design
|
|
206
|
+
|
|
207
|
+
# Mark modules to keep from getting removed in flattening
|
|
208
|
+
preserve_modules
|
|
209
|
+
|
|
210
|
+
set flatten_design [expr { [lindex [sc_cfg_tool_task_get var flatten] 0] \
|
|
211
|
+
== "true" }]
|
|
212
|
+
set synth_args []
|
|
213
|
+
if { $flatten_design } {
|
|
214
|
+
lappend synth_args "-flatten"
|
|
215
|
+
}
|
|
216
|
+
if { [sc_cfg_tool_task_exists file synth_extra_map] } {
|
|
217
|
+
foreach extra_map [sc_cfg_tool_task_get file synth_extra_map] {
|
|
218
|
+
lappend synth_args "-extra-map" $extra_map
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
# Start synthesis
|
|
223
|
+
yosys synth {*}$synth_args -top $sc_design -run begin:fine
|
|
224
|
+
|
|
225
|
+
# Perform memory mapping, if available
|
|
226
|
+
sc_map_memory $sc_memory_libmap_files $sc_memory_techmap_files 0
|
|
227
|
+
|
|
228
|
+
# Perform hierarchy flattening
|
|
229
|
+
if { !$flatten_design } {
|
|
230
|
+
set sc_hier_iterations \
|
|
231
|
+
[lindex [sc_cfg_tool_task_get var hier_iterations] 0]
|
|
232
|
+
set sc_hier_threshold \
|
|
233
|
+
[lindex [sc_cfg_tool_task_get var hier_threshold] 0]
|
|
234
|
+
for { set i 0 } { $i < $sc_hier_iterations } { incr i } {
|
|
235
|
+
if { [determine_keep_hierarchy $i $sc_hier_threshold] == 0 } {
|
|
236
|
+
break
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
# Finish synthesis
|
|
242
|
+
yosys synth {*}$synth_args -top $sc_design -run fine:check
|
|
243
|
+
|
|
244
|
+
# https://github.com/hdl/bazel_rules_hdl/blob/4cca75f32a3869a57c0635bc7426a696a15ec143/synthesis/synth.tcl#L54C1-L58C26
|
|
245
|
+
# Remove $print cells. These cells represent Verilog $display() tasks.
|
|
246
|
+
# Some place and route tools cannot handle these in the output Verilog,
|
|
247
|
+
# so remove them here.
|
|
248
|
+
yosys delete {*/t:$print}
|
|
249
|
+
|
|
250
|
+
yosys opt -purge
|
|
251
|
+
|
|
252
|
+
########################################################
|
|
253
|
+
# Technology Mapping
|
|
254
|
+
########################################################
|
|
255
|
+
|
|
256
|
+
if { [sc_cfg_tool_task_get var map_adders] == "true" } {
|
|
257
|
+
set sc_adder_techmap \
|
|
258
|
+
[lindex [sc_cfg_get library $sc_mainlib option {file} yosys_addermap] 0]
|
|
259
|
+
# extract the full adders
|
|
260
|
+
yosys extract_fa
|
|
261
|
+
# map full adders
|
|
262
|
+
yosys techmap -map $sc_adder_techmap
|
|
263
|
+
post_techmap -fast
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if { [sc_cfg_tool_task_exists {file} techmap] } {
|
|
267
|
+
foreach mapfile [sc_cfg_tool_task_get {file} techmap] {
|
|
268
|
+
yosys techmap -map $mapfile
|
|
269
|
+
post_techmap -fast
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if { [sc_cfg_tool_task_get var autoname] == "true" } {
|
|
274
|
+
# use autoname to preserve some design naming
|
|
275
|
+
# by doing it before dfflibmap the names will be slightly shorter since they will
|
|
276
|
+
# only contain the $DFF_P names vs. the full library name of the associated flip-flop
|
|
277
|
+
yosys rename -wire
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
set dfflibmap_dont_use []
|
|
281
|
+
foreach lib "$sc_logiclibs $sc_macrolibs" {
|
|
282
|
+
foreach cell [sc_cfg_get library $lib asic cells dontuse] {
|
|
283
|
+
lappend dfflibmap_dont_use -dont_use $cell
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
yosys dfflibmap {*}$dfflibmap_dont_use -liberty $sc_dff_library
|
|
288
|
+
|
|
289
|
+
# perform final techmap and opt in case previous techmaps introduced constructs that need
|
|
290
|
+
# techmapping
|
|
291
|
+
post_techmap
|
|
292
|
+
|
|
293
|
+
source "$sc_refdir/syn_strategies.tcl"
|
|
294
|
+
|
|
295
|
+
set script ""
|
|
296
|
+
set sc_strategy [sc_cfg_tool_task_get var strategy]
|
|
297
|
+
if { [string length $sc_strategy] == 0 } {
|
|
298
|
+
# Do nothing
|
|
299
|
+
} elseif { [dict exists $syn_strategies $sc_strategy] } {
|
|
300
|
+
set script [dict get $syn_strategies $sc_strategy]
|
|
301
|
+
} elseif { [string match "+*" $sc_strategy] } {
|
|
302
|
+
# ABC script passthrough
|
|
303
|
+
set script $sc_strategy
|
|
304
|
+
} else {
|
|
305
|
+
yosys log "Warning: no such synthesis strategy $sc_strategy"
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
# TODO: other abc flags passed in by OpenLANE we can adopt:
|
|
309
|
+
# -D: clock period
|
|
310
|
+
# -constr: in the case of OpenLANE, an autogenerated SDC that includes a
|
|
311
|
+
# set_driving_cell and set_load call (but perhaps we should just pass along a
|
|
312
|
+
# user-provided constraint)
|
|
313
|
+
|
|
314
|
+
set abc_args []
|
|
315
|
+
if { [sc_cfg_tool_task_exists var abc_clock_period] } {
|
|
316
|
+
set abc_clock_period [sc_cfg_tool_task_get var abc_clock_period]
|
|
317
|
+
if { [llength $abc_clock_period] != 0 } {
|
|
318
|
+
# assumes units are ps
|
|
319
|
+
lappend abc_args "-D" $abc_clock_period
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if { [file exists $sc_abc_constraints] } {
|
|
323
|
+
lappend abc_args "-constr" $sc_abc_constraints
|
|
324
|
+
}
|
|
325
|
+
if { $script != "" } {
|
|
326
|
+
lappend abc_args "-script" $script
|
|
327
|
+
}
|
|
328
|
+
foreach lib_file $sc_libraries {
|
|
329
|
+
lappend abc_args "-liberty" $lib_file
|
|
330
|
+
}
|
|
331
|
+
set abc_dont_use []
|
|
332
|
+
foreach lib "$sc_logiclibs $sc_macrolibs" {
|
|
333
|
+
foreach cell [sc_cfg_get library $lib asic cells dontuse] {
|
|
334
|
+
lappend abc_dont_use -dont_use $cell
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
yosys abc {*}$abc_args {*}$abc_dont_use
|
|
339
|
+
|
|
340
|
+
########################################################
|
|
341
|
+
# Cleanup
|
|
342
|
+
########################################################
|
|
343
|
+
|
|
344
|
+
yosys clean -purge
|
|
345
|
+
yosys setundef -zero
|
|
346
|
+
|
|
347
|
+
yosys splitnets
|
|
348
|
+
|
|
349
|
+
yosys clean -purge
|
|
350
|
+
|
|
351
|
+
set yosys_hilomap_args []
|
|
352
|
+
if { [has_tie_cell low] } {
|
|
353
|
+
lappend yosys_hilomap_args -locell {*}[get_tie_cell low]
|
|
354
|
+
}
|
|
355
|
+
if { [has_tie_cell high] } {
|
|
356
|
+
lappend yosys_hilomap_args -hicell {*}[get_tie_cell high]
|
|
357
|
+
}
|
|
358
|
+
if { [llength $yosys_hilomap_args] != 0 } {
|
|
359
|
+
yosys hilomap -singleton {*}$yosys_hilomap_args
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if { [has_buffer_cell] && \
|
|
363
|
+
[sc_cfg_tool_task_get var add_buffers] == "true" } {
|
|
364
|
+
yosys insbuf -buf {*}[get_buffer_cell]
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
yosys clean -purge
|
|
368
|
+
|
|
369
|
+
set stat_libs []
|
|
370
|
+
lappend stat_libs "-liberty" $sc_dff_library
|
|
371
|
+
foreach lib_file "$sc_libraries $sc_macro_libraries" {
|
|
372
|
+
lappend stat_libs "-liberty" $lib_file
|
|
373
|
+
}
|
|
374
|
+
# turn off echo to prevent the stat command from showing up in the json file
|
|
375
|
+
yosys echo off
|
|
376
|
+
yosys tee -o ./reports/stat.json stat -json -top $sc_design {*}$stat_libs
|
|
377
|
+
yosys echo on
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file contains a set of procedures that are shared
|
|
2
|
+
# between syn_asic.tcl and syn_fpga.tcl
|
|
3
|
+
|
|
4
|
+
proc post_techmap { { opt_args "" } } {
|
|
5
|
+
# perform techmap in case previous techmaps introduced constructs
|
|
6
|
+
# that need techmapping
|
|
7
|
+
yosys techmap
|
|
8
|
+
# Quick optimization
|
|
9
|
+
yosys opt {*}$opt_args -purge
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
proc sc_map_memory { lib_file techmap_file do_rom } {
|
|
13
|
+
set design_mod 0
|
|
14
|
+
|
|
15
|
+
if { $lib_file != "" } {
|
|
16
|
+
yosys memory_libmap -lib $lib_file
|
|
17
|
+
set design_mod 1
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if { $do_rom } {
|
|
21
|
+
yosys memory_map -rom-only
|
|
22
|
+
set design_mod 1
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if { $techmap_file != "" } {
|
|
26
|
+
yosys techmap -map $techmap_file
|
|
27
|
+
set design_mod 1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return $design_mod
|
|
31
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
from siliconcompiler.tools.yosys.yosys import syn_setup, syn_post_process
|
|
2
|
+
import json
|
|
3
|
+
from siliconcompiler import sc_open
|
|
4
|
+
from siliconcompiler.tools._common import get_tool_task, record_metric
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
######################################################################
|
|
8
|
+
# Make Docs
|
|
9
|
+
######################################################################
|
|
10
|
+
def make_docs(chip):
|
|
11
|
+
chip.set('fpga', 'partname', 'ice40up5k-sg48')
|
|
12
|
+
chip.load_target("fpgaflow_demo")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def setup(chip):
|
|
16
|
+
'''
|
|
17
|
+
Perform FPGA synthesis
|
|
18
|
+
'''
|
|
19
|
+
|
|
20
|
+
# Generic synthesis task setup.
|
|
21
|
+
syn_setup(chip)
|
|
22
|
+
|
|
23
|
+
# FPGA-specific setup.
|
|
24
|
+
setup_fpga(chip)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def setup_fpga(chip):
|
|
28
|
+
''' Helper method for configs specific to FPGA steps (both syn and lec).
|
|
29
|
+
'''
|
|
30
|
+
|
|
31
|
+
tool = 'yosys'
|
|
32
|
+
step = chip.get('arg', 'step')
|
|
33
|
+
index = chip.get('arg', 'index')
|
|
34
|
+
_, task = get_tool_task(chip, step, index)
|
|
35
|
+
design = chip.top()
|
|
36
|
+
|
|
37
|
+
part_name = chip.get('fpga', 'partname')
|
|
38
|
+
|
|
39
|
+
# Require that a lut size is set for FPGA scripts.
|
|
40
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
41
|
+
",".join(['fpga', part_name, 'lutsize']),
|
|
42
|
+
step=step, index=index)
|
|
43
|
+
|
|
44
|
+
if chip.valid('fpga', part_name, 'file', 'yosys_flop_techmap') and \
|
|
45
|
+
chip.get('fpga', part_name, 'file', 'yosys_flop_techmap'):
|
|
46
|
+
|
|
47
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
48
|
+
",".join(['fpga', part_name, 'file', 'yosys_flop_techmap']),
|
|
49
|
+
step=step, index=index)
|
|
50
|
+
|
|
51
|
+
if chip.valid('fpga', part_name, 'file', 'yosys_dsp_techmap') and \
|
|
52
|
+
chip.get('fpga', part_name, 'file', 'yosys_dsp_techmap'):
|
|
53
|
+
|
|
54
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
55
|
+
",".join(['fpga', part_name, 'file', 'yosys_dsp_techmap']),
|
|
56
|
+
step=step, index=index)
|
|
57
|
+
|
|
58
|
+
if chip.valid('fpga', part_name, 'file', 'yosys_extractlib') and \
|
|
59
|
+
chip.get('fpga', part_name, 'file', 'yosys_extractlib'):
|
|
60
|
+
|
|
61
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
62
|
+
",".join(['fpga', part_name, 'file', 'yosys_extractlib']),
|
|
63
|
+
step=step, index=index)
|
|
64
|
+
|
|
65
|
+
if chip.valid('fpga', part_name, 'file', 'yosys_macrolib') and \
|
|
66
|
+
chip.get('fpga', part_name, 'file', 'yosys_macrolib'):
|
|
67
|
+
|
|
68
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
69
|
+
",".join(['fpga', part_name, 'file', 'yosys_macrolib']),
|
|
70
|
+
step=step, index=index)
|
|
71
|
+
|
|
72
|
+
part_name = chip.get('fpga', 'partname')
|
|
73
|
+
for resource in ('yosys_registers', 'yosys_brams', 'yosys_dsps'):
|
|
74
|
+
if not chip.valid('fpga', part_name, 'var', resource):
|
|
75
|
+
continue
|
|
76
|
+
if not chip.get('fpga', part_name, 'var', resource):
|
|
77
|
+
continue
|
|
78
|
+
chip.add('tool', tool, 'task', task, 'require', f'fpga,{part_name},var,{resource}',
|
|
79
|
+
step=step, index=index)
|
|
80
|
+
|
|
81
|
+
# Verify memory techmapping setup. If a memory libmap
|
|
82
|
+
# is provided a memory techmap verilog file is needed too
|
|
83
|
+
if (chip.valid('fpga', part_name, 'file', 'yosys_memory_libmap') and
|
|
84
|
+
chip.get('fpga', part_name, 'file', 'yosys_memory_libmap')) or \
|
|
85
|
+
(chip.valid('fpga', part_name, 'file', 'yosys_memory_techmap') and
|
|
86
|
+
chip.get('fpga', part_name, 'file', 'yosys_memory_techmap')):
|
|
87
|
+
|
|
88
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
89
|
+
",".join(['fpga', part_name, 'file', 'yosys_memory_libmap']),
|
|
90
|
+
step=step, index=index)
|
|
91
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
92
|
+
",".join(['fpga', part_name, 'file', 'yosys_memory_techmap']),
|
|
93
|
+
step=step, index=index)
|
|
94
|
+
|
|
95
|
+
chip.add('tool', tool, 'task', task, 'output', design + '.netlist.json', step=step, index=index)
|
|
96
|
+
chip.add('tool', tool, 'task', task, 'output', design + '.blif', step=step, index=index)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
##################################################
|
|
100
|
+
def post_process(chip):
|
|
101
|
+
step = chip.get('arg', 'step')
|
|
102
|
+
index = chip.get('arg', 'index')
|
|
103
|
+
part_name = chip.get('fpga', 'partname')
|
|
104
|
+
|
|
105
|
+
syn_post_process(chip)
|
|
106
|
+
|
|
107
|
+
with sc_open("reports/stat.json") as f:
|
|
108
|
+
metrics = json.load(f)
|
|
109
|
+
if "design" in metrics:
|
|
110
|
+
metrics = metrics["design"]
|
|
111
|
+
else:
|
|
112
|
+
return
|
|
113
|
+
|
|
114
|
+
if "num_cells_by_type" in metrics:
|
|
115
|
+
metrics = metrics["num_cells_by_type"]
|
|
116
|
+
else:
|
|
117
|
+
return
|
|
118
|
+
|
|
119
|
+
dff_cells = []
|
|
120
|
+
if chip.valid('fpga', part_name, 'var', 'yosys_registers'):
|
|
121
|
+
dff_cells = chip.get('fpga', part_name, 'var', 'yosys_registers')
|
|
122
|
+
brams_cells = []
|
|
123
|
+
if chip.valid('fpga', part_name, 'var', 'yosys_brams'):
|
|
124
|
+
brams_cells = chip.get('fpga', part_name, 'var', 'yosys_brams')
|
|
125
|
+
dsps_cells = []
|
|
126
|
+
if chip.valid('fpga', part_name, 'var', 'yosys_dsps'):
|
|
127
|
+
dsps_cells = chip.get('fpga', part_name, 'var', 'yosys_dsps')
|
|
128
|
+
|
|
129
|
+
data = {
|
|
130
|
+
"registers": 0,
|
|
131
|
+
"luts": 0,
|
|
132
|
+
"dsps": 0,
|
|
133
|
+
"brams": 0
|
|
134
|
+
}
|
|
135
|
+
for cell, count in metrics.items():
|
|
136
|
+
if cell == "$lut":
|
|
137
|
+
data["luts"] += count
|
|
138
|
+
elif cell in dff_cells:
|
|
139
|
+
data["registers"] += count
|
|
140
|
+
elif cell in dsps_cells:
|
|
141
|
+
data["dsps"] += count
|
|
142
|
+
elif cell in brams_cells:
|
|
143
|
+
data["brams"] += count
|
|
144
|
+
|
|
145
|
+
for metric, value in data.items():
|
|
146
|
+
record_metric(chip, step, index, metric, value, "reports/stat.json")
|