siliconcompiler 0.28.9__py3-none-any.whl → 0.29.1__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/_metadata.py +1 -1
- siliconcompiler/apps/__init__.py +26 -0
- siliconcompiler/apps/sc_remote.py +15 -14
- siliconcompiler/apps/sc_show.py +5 -5
- siliconcompiler/apps/utils/replay.py +194 -0
- siliconcompiler/checklists/__init__.py +12 -0
- siliconcompiler/core.py +89 -22
- siliconcompiler/flows/__init__.py +34 -0
- siliconcompiler/flows/_common.py +11 -13
- siliconcompiler/flows/asicflow.py +83 -42
- siliconcompiler/flows/showflow.py +1 -1
- siliconcompiler/libs/__init__.py +5 -0
- siliconcompiler/optimizer/__init__.py +199 -0
- siliconcompiler/optimizer/vizier.py +259 -0
- siliconcompiler/pdks/__init__.py +5 -0
- siliconcompiler/remote/__init__.py +11 -0
- siliconcompiler/remote/client.py +753 -815
- siliconcompiler/report/report.py +2 -0
- siliconcompiler/report/summary_table.py +1 -1
- siliconcompiler/scheduler/__init__.py +118 -58
- siliconcompiler/scheduler/send_messages.py +1 -1
- siliconcompiler/schema/schema_cfg.py +16 -4
- siliconcompiler/schema/schema_obj.py +29 -10
- siliconcompiler/schema/utils.py +2 -0
- siliconcompiler/sphinx_ext/__init__.py +85 -0
- siliconcompiler/sphinx_ext/dynamicgen.py +19 -34
- siliconcompiler/sphinx_ext/schemagen.py +3 -2
- siliconcompiler/targets/__init__.py +26 -0
- siliconcompiler/targets/gf180_demo.py +3 -3
- siliconcompiler/templates/replay/replay.py.j2 +62 -0
- siliconcompiler/templates/replay/requirements.txt +7 -0
- siliconcompiler/templates/replay/setup.sh +130 -0
- siliconcompiler/tools/__init__.py +60 -0
- siliconcompiler/tools/_common/__init__.py +15 -1
- siliconcompiler/tools/_common/asic.py +17 -9
- siliconcompiler/tools/builtin/concatenate.py +1 -1
- siliconcompiler/tools/ghdl/ghdl.py +1 -2
- siliconcompiler/tools/klayout/convert_drc_db.py +1 -1
- siliconcompiler/tools/klayout/drc.py +1 -1
- siliconcompiler/tools/klayout/export.py +8 -1
- siliconcompiler/tools/klayout/klayout.py +2 -2
- siliconcompiler/tools/klayout/klayout_convert_drc_db.py +2 -2
- siliconcompiler/tools/klayout/klayout_export.py +7 -5
- siliconcompiler/tools/klayout/klayout_operations.py +4 -3
- siliconcompiler/tools/klayout/klayout_show.py +3 -2
- siliconcompiler/tools/klayout/klayout_utils.py +1 -1
- siliconcompiler/tools/klayout/operations.py +8 -0
- siliconcompiler/tools/klayout/screenshot.py +6 -1
- siliconcompiler/tools/klayout/show.py +8 -1
- siliconcompiler/tools/magic/magic.py +1 -1
- siliconcompiler/tools/openroad/__init__.py +103 -0
- siliconcompiler/tools/openroad/{openroad.py → _apr.py} +415 -423
- siliconcompiler/tools/openroad/antenna_repair.py +78 -0
- siliconcompiler/tools/openroad/clock_tree_synthesis.py +64 -0
- siliconcompiler/tools/openroad/detailed_placement.py +59 -0
- siliconcompiler/tools/openroad/detailed_route.py +62 -0
- siliconcompiler/tools/openroad/endcap_tapcell_insertion.py +52 -0
- siliconcompiler/tools/openroad/fillercell_insertion.py +58 -0
- siliconcompiler/tools/openroad/{dfm.py → fillmetal_insertion.py} +35 -19
- siliconcompiler/tools/openroad/global_placement.py +58 -0
- siliconcompiler/tools/openroad/global_route.py +63 -0
- siliconcompiler/tools/openroad/init_floorplan.py +103 -0
- siliconcompiler/tools/openroad/macro_placement.py +65 -0
- siliconcompiler/tools/openroad/metrics.py +23 -8
- siliconcompiler/tools/openroad/pin_placement.py +56 -0
- siliconcompiler/tools/openroad/power_grid.py +65 -0
- siliconcompiler/tools/openroad/rcx_bench.py +7 -4
- siliconcompiler/tools/openroad/rcx_extract.py +2 -1
- siliconcompiler/tools/openroad/rdlroute.py +4 -4
- siliconcompiler/tools/openroad/repair_design.py +59 -0
- siliconcompiler/tools/openroad/repair_timing.py +63 -0
- siliconcompiler/tools/openroad/screenshot.py +9 -20
- siliconcompiler/tools/openroad/scripts/apr/postamble.tcl +44 -0
- siliconcompiler/tools/openroad/scripts/apr/preamble.tcl +95 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_antenna_repair.tcl +51 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_clock_tree_synthesis.tcl +66 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_detailed_placement.tcl +41 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_detailed_route.tcl +71 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_endcap_tapcell_insertion.tcl +55 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_fillercell_insertion.tcl +27 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_fillmetal_insertion.tcl +36 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_global_placement.tcl +26 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_global_route.tcl +61 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_init_floorplan.tcl +333 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_macro_placement.tcl +123 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_metrics.tcl +22 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_pin_placement.tcl +41 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_power_grid.tcl +60 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_repair_design.tcl +68 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_repair_timing.tcl +83 -0
- siliconcompiler/tools/openroad/scripts/apr/sc_write_data.tcl +125 -0
- siliconcompiler/tools/openroad/scripts/common/debugging.tcl +28 -0
- siliconcompiler/tools/openroad/scripts/common/procs.tcl +727 -0
- siliconcompiler/tools/openroad/scripts/common/read_input_files.tcl +59 -0
- siliconcompiler/tools/openroad/scripts/common/read_liberty.tcl +20 -0
- siliconcompiler/tools/openroad/scripts/common/read_timing_constraints.tcl +16 -0
- siliconcompiler/tools/openroad/scripts/common/reports.tcl +180 -0
- siliconcompiler/tools/openroad/scripts/common/screenshot.tcl +18 -0
- siliconcompiler/tools/openroad/scripts/common/write_images.tcl +395 -0
- siliconcompiler/tools/openroad/scripts/{sc_rcx_bench.tcl → rcx/sc_rcx_bench.tcl} +5 -5
- siliconcompiler/tools/openroad/scripts/{sc_rcx_extract.tcl → rcx/sc_rcx_extract.tcl} +0 -0
- siliconcompiler/tools/openroad/scripts/sc_rcx.tcl +5 -16
- siliconcompiler/tools/openroad/scripts/sc_rdlroute.tcl +51 -51
- siliconcompiler/tools/openroad/scripts/sc_show.tcl +110 -0
- siliconcompiler/tools/openroad/show.py +28 -23
- siliconcompiler/tools/openroad/{export.py → write_data.py} +31 -26
- siliconcompiler/tools/opensta/__init__.py +2 -2
- siliconcompiler/tools/opensta/check_library.py +27 -0
- siliconcompiler/tools/opensta/scripts/sc_check_library.tcl +255 -0
- siliconcompiler/tools/opensta/scripts/sc_timing.tcl +1 -1
- siliconcompiler/tools/sv2v/sv2v.py +1 -2
- siliconcompiler/tools/verilator/verilator.py +6 -7
- siliconcompiler/tools/vivado/vivado.py +1 -1
- siliconcompiler/tools/yosys/__init__.py +149 -0
- siliconcompiler/tools/yosys/lec.py +22 -9
- siliconcompiler/tools/yosys/sc_lec.tcl +94 -49
- siliconcompiler/tools/yosys/sc_syn.tcl +1 -0
- siliconcompiler/tools/yosys/screenshot.py +2 -2
- siliconcompiler/tools/yosys/syn_asic.py +105 -74
- siliconcompiler/tools/yosys/syn_asic.tcl +58 -12
- siliconcompiler/tools/yosys/syn_fpga.py +2 -3
- siliconcompiler/tools/yosys/syn_fpga.tcl +26 -19
- siliconcompiler/toolscripts/_tools.json +5 -5
- siliconcompiler/utils/__init__.py +7 -3
- {siliconcompiler-0.28.9.dist-info → siliconcompiler-0.29.1.dist-info}/METADATA +22 -17
- {siliconcompiler-0.28.9.dist-info → siliconcompiler-0.29.1.dist-info}/RECORD +131 -114
- {siliconcompiler-0.28.9.dist-info → siliconcompiler-0.29.1.dist-info}/WHEEL +1 -1
- {siliconcompiler-0.28.9.dist-info → siliconcompiler-0.29.1.dist-info}/entry_points.txt +13 -0
- siliconcompiler/libs/asap7sc7p5t.py +0 -8
- siliconcompiler/libs/gf180mcu.py +0 -8
- siliconcompiler/libs/interposer.py +0 -8
- siliconcompiler/libs/nangate45.py +0 -8
- siliconcompiler/libs/sg13g2_stdcell.py +0 -8
- siliconcompiler/libs/sky130hd.py +0 -8
- siliconcompiler/libs/sky130io.py +0 -8
- siliconcompiler/pdks/asap7.py +0 -8
- siliconcompiler/pdks/freepdk45.py +0 -8
- siliconcompiler/pdks/gf180.py +0 -8
- siliconcompiler/pdks/ihp130.py +0 -8
- siliconcompiler/pdks/interposer.py +0 -8
- siliconcompiler/pdks/skywater130.py +0 -8
- siliconcompiler/tools/openroad/cts.py +0 -45
- siliconcompiler/tools/openroad/floorplan.py +0 -75
- siliconcompiler/tools/openroad/physyn.py +0 -27
- siliconcompiler/tools/openroad/place.py +0 -41
- siliconcompiler/tools/openroad/route.py +0 -45
- siliconcompiler/tools/openroad/scripts/__init__.py +0 -0
- siliconcompiler/tools/openroad/scripts/sc_apr.tcl +0 -514
- siliconcompiler/tools/openroad/scripts/sc_cts.tcl +0 -68
- siliconcompiler/tools/openroad/scripts/sc_dfm.tcl +0 -22
- siliconcompiler/tools/openroad/scripts/sc_export.tcl +0 -100
- siliconcompiler/tools/openroad/scripts/sc_floorplan.tcl +0 -456
- siliconcompiler/tools/openroad/scripts/sc_metrics.tcl +0 -1
- siliconcompiler/tools/openroad/scripts/sc_physyn.tcl +0 -6
- siliconcompiler/tools/openroad/scripts/sc_place.tcl +0 -84
- siliconcompiler/tools/openroad/scripts/sc_procs.tcl +0 -494
- siliconcompiler/tools/openroad/scripts/sc_report.tcl +0 -189
- siliconcompiler/tools/openroad/scripts/sc_route.tcl +0 -143
- siliconcompiler/tools/openroad/scripts/sc_screenshot.tcl +0 -18
- siliconcompiler/tools/openroad/scripts/sc_write_images.tcl +0 -393
- siliconcompiler/tools/yosys/yosys.py +0 -148
- /siliconcompiler/tools/openroad/scripts/{sc_write.tcl → common/write_data.tcl} +0 -0
- {siliconcompiler-0.28.9.dist-info → siliconcompiler-0.29.1.dist-info}/LICENSE +0 -0
- {siliconcompiler-0.28.9.dist-info → siliconcompiler-0.29.1.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Script adapted from
|
|
2
|
-
# https://github.com/The-OpenROAD-Project/OpenLane/blob/
|
|
2
|
+
# https://github.com/The-OpenROAD-Project/OpenLane/blob/2264b1240bacca90f8dfd74b8f5d62b7d618038e/scripts/yosys/logic_equiv_check.tcl
|
|
3
3
|
|
|
4
4
|
source ./sc_manifest.tcl
|
|
5
5
|
set sc_tool yosys
|
|
@@ -10,71 +10,116 @@ set sc_step [sc_cfg_get arg step]
|
|
|
10
10
|
set sc_index [sc_cfg_get arg index]
|
|
11
11
|
set sc_flow [sc_cfg_get option flow]
|
|
12
12
|
set sc_task [sc_cfg_get flowgraph $sc_flow $sc_step $sc_index task]
|
|
13
|
-
set sc_refdir [sc_cfg_tool_task_get refdir]
|
|
14
13
|
|
|
15
14
|
set sc_design [sc_top]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
set
|
|
20
|
-
set sc_delaymodel [sc_cfg_get asic delaymodel]
|
|
21
|
-
set sc_scenarios [dict keys [sc_cfg_get constraint timing]]
|
|
22
|
-
set sc_libcorner [sc_cfg_get constraint timing [lindex $sc_scenarios 0] libcorner]
|
|
23
|
-
set sc_liberty [sc_cfg_get library $lib output $sc_libcorner $sc_delaymodel]
|
|
24
|
-
|
|
25
|
-
if { [sc_cfg_tool_task_exists "variable" induction_steps] } {
|
|
26
|
-
set sc_induction_steps \
|
|
27
|
-
[lindex [sc_cfg_tool_task_get "variable" induction_steps] 0]
|
|
15
|
+
|
|
16
|
+
set sc_libraries [sc_cfg_tool_task_get {file} synthesis_libraries]
|
|
17
|
+
if { [dict exists $sc_cfg tool $sc_tool task $sc_task {file} synthesis_libraries_macros] } {
|
|
18
|
+
set sc_macro_libraries [sc_cfg_tool_task_get {file} synthesis_libraries_macros]
|
|
28
19
|
} else {
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
set sc_macro_libraries []
|
|
21
|
+
}
|
|
22
|
+
set sc_blackboxes []
|
|
23
|
+
foreach lib [sc_cfg_get asic macrolib] {
|
|
24
|
+
if { [sc_cfg_exists library $lib output blackbox verilog] } {
|
|
25
|
+
foreach lib_f [sc_cfg_get library $lib output blackbox verilog] {
|
|
26
|
+
lappend sc_blackboxes $lib_f
|
|
27
|
+
}
|
|
28
|
+
}
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
set sc_induction_steps [lindex [sc_cfg_tool_task_get {var} induction_steps] 0]
|
|
32
|
+
|
|
33
|
+
proc prepare_libraries { } {
|
|
34
|
+
global sc_libraries
|
|
35
|
+
global sc_macro_libraries
|
|
36
|
+
global sc_blackboxes
|
|
37
|
+
|
|
38
|
+
foreach lib_file "$sc_libraries $sc_macro_libraries" {
|
|
39
|
+
yosys read_liberty -ignore_miss_func -ignore_miss_dir $lib_file
|
|
40
|
+
}
|
|
41
|
+
foreach bb_file $sc_blackboxes {
|
|
42
|
+
puts "Reading blackbox model file: $bb_file"
|
|
43
|
+
yosys read_verilog -sv $bb_file
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
set sc_logiclibs [sc_cfg_get asic logiclib]
|
|
47
|
+
set sc_macrolibs [sc_cfg_get asic macrolib]
|
|
48
|
+
|
|
49
|
+
foreach lib "$sc_logiclibs $sc_macrolibs" {
|
|
50
|
+
foreach phy_type "filler decap antenna tap" {
|
|
51
|
+
if { [sc_cfg_exists library $lib asic cells $phy_type] } {
|
|
52
|
+
foreach cells [sc_cfg_get library $lib asic cells $phy_type] {
|
|
53
|
+
puts "Generating $cells for $lib"
|
|
54
|
+
yosys hierarchy -generate $cells
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
39
59
|
}
|
|
40
|
-
yosys read_verilog $source
|
|
41
60
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
yosys hierarchy -auto-top
|
|
46
|
-
yosys flatten
|
|
61
|
+
proc prepare_design { type v_files } {
|
|
62
|
+
global sc_cfg
|
|
63
|
+
global sc_design
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
yosys
|
|
65
|
+
puts "Preparing \"$type\" design"
|
|
66
|
+
foreach f_file $v_files {
|
|
67
|
+
puts "Reading verilog file: $f_file"
|
|
68
|
+
yosys read_verilog -sv $f_file
|
|
69
|
+
}
|
|
52
70
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
########################################################
|
|
72
|
+
# Override top level parameters
|
|
73
|
+
########################################################
|
|
74
|
+
|
|
75
|
+
yosys chparam -list
|
|
76
|
+
if { [dict exists $sc_cfg option param] } {
|
|
77
|
+
dict for {key value} [sc_cfg_get option param] {
|
|
78
|
+
if { ![string is integer $value] } {
|
|
79
|
+
set value [concat \"$value\"]
|
|
80
|
+
}
|
|
81
|
+
yosys chparam -set $key $value $sc_design
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
prepare_libraries
|
|
86
|
+
|
|
87
|
+
yosys proc
|
|
88
|
+
yosys rmports
|
|
89
|
+
yosys splitnets -ports
|
|
90
|
+
yosys hierarchy -top $sc_design
|
|
91
|
+
yosys async2sync
|
|
92
|
+
yosys flatten
|
|
93
|
+
|
|
94
|
+
yosys setattr -set keep 1
|
|
95
|
+
yosys stat
|
|
96
|
+
yosys rename -top $type
|
|
97
|
+
yosys design -stash $type
|
|
59
98
|
}
|
|
60
|
-
yosys read_verilog $netlist
|
|
61
99
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
100
|
+
# Gold netlist
|
|
101
|
+
if { [file exists "inputs/${sc_design}.v"] } {
|
|
102
|
+
set gold_source "inputs/${sc_design}.v"
|
|
103
|
+
} else {
|
|
104
|
+
set gold_source [sc_cfg_get input rtl verilog]
|
|
105
|
+
}
|
|
106
|
+
prepare_design gold $gold_source
|
|
67
107
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
108
|
+
# Gate netlist
|
|
109
|
+
if { [file exists "inputs/${sc_design}.lec.vg"] } {
|
|
110
|
+
set gate_source "inputs/${sc_design}.lec.vg"
|
|
111
|
+
} elseif { [file exists "inputs/${sc_design}.vg"] } {
|
|
112
|
+
set gate_source "inputs/${sc_design}.vg"
|
|
113
|
+
} else {
|
|
114
|
+
set gate_source [sc_cfg_get input netlist verilog]
|
|
115
|
+
}
|
|
116
|
+
prepare_design gate $gate_source
|
|
72
117
|
|
|
73
118
|
yosys design -copy-from gold -as gold gold
|
|
74
119
|
yosys design -copy-from gate -as gate gate
|
|
75
120
|
|
|
76
121
|
# Rebuild the database due to -stash
|
|
77
|
-
|
|
122
|
+
prepare_libraries
|
|
78
123
|
|
|
79
124
|
yosys equiv_make gold gate equiv
|
|
80
125
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from siliconcompiler.tools.yosys
|
|
1
|
+
from siliconcompiler.tools.yosys import setup as tool_setup
|
|
2
2
|
import os
|
|
3
3
|
import siliconcompiler.tools.yosys.prepareLib as prepareLib
|
|
4
4
|
from siliconcompiler.tools._common.asic import get_libraries
|
|
5
5
|
from siliconcompiler.tools._common import get_tool_task
|
|
6
|
-
from siliconcompiler.targets import asap7_demo
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
def make_docs(chip):
|
|
9
|
+
from siliconcompiler.targets import asap7_demo
|
|
10
10
|
chip.use(asap7_demo)
|
|
11
11
|
|
|
12
12
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
from siliconcompiler.tools.yosys
|
|
2
|
+
from siliconcompiler.tools.yosys import syn_setup, syn_post_process
|
|
3
3
|
import os
|
|
4
|
+
import json
|
|
4
5
|
import re
|
|
5
|
-
|
|
6
|
+
from siliconcompiler.tools.yosys.prepareLib import processLibertyFile
|
|
6
7
|
from siliconcompiler import sc_open
|
|
7
8
|
from siliconcompiler import utils
|
|
8
|
-
from siliconcompiler.tools._common.asic import set_tool_task_var, get_libraries, get_mainlib
|
|
9
|
+
from siliconcompiler.tools._common.asic import set_tool_task_var, get_libraries, get_mainlib, \
|
|
10
|
+
CellArea
|
|
9
11
|
from siliconcompiler.tools._common import get_tool_task
|
|
10
|
-
from siliconcompiler.targets import asap7_demo
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
def make_docs(chip):
|
|
15
|
+
from siliconcompiler.targets import asap7_demo
|
|
14
16
|
chip.use(asap7_demo)
|
|
15
17
|
|
|
16
18
|
|
|
@@ -108,6 +110,13 @@ def setup_asic(chip):
|
|
|
108
110
|
chip.add('tool', tool, 'task', task, 'require',
|
|
109
111
|
",".join(['library', mainlib, 'option', 'file', 'yosys_addermap']),
|
|
110
112
|
step=step, index=index)
|
|
113
|
+
library_has_tbufmap = \
|
|
114
|
+
chip.valid('library', mainlib, 'option', 'file', 'yosys_tbufmap') and \
|
|
115
|
+
chip.get('library', mainlib, 'option', 'file', 'yosys_tbufmap')
|
|
116
|
+
if library_has_tbufmap:
|
|
117
|
+
chip.add('tool', tool, 'task', task, 'require',
|
|
118
|
+
",".join(['library', mainlib, 'option', 'file', 'yosys_tbufmap']),
|
|
119
|
+
step=step, index=index)
|
|
111
120
|
|
|
112
121
|
for var0, var1 in [('memory_libmap', 'memory_techmap')]:
|
|
113
122
|
key0 = ['tool', tool, 'tak', task, 'file', var0]
|
|
@@ -151,9 +160,6 @@ def setup_asic(chip):
|
|
|
151
160
|
'true/false, techmap adders in Yosys', field='help')
|
|
152
161
|
chip.set('tool', tool, 'task', task, 'var', 'synthesis_corner',
|
|
153
162
|
'Timing corner to use for synthesis', field='help')
|
|
154
|
-
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty',
|
|
155
|
-
'Liberty file to use for flip-flop mapping, if not specified the first in the '
|
|
156
|
-
'logiclib is used', field='help')
|
|
157
163
|
chip.set('tool', tool, 'task', task, 'var', 'abc_constraint_driver',
|
|
158
164
|
'Buffer that drives the abc techmapping, defaults to first buffer specified',
|
|
159
165
|
field='help')
|
|
@@ -167,8 +173,6 @@ def setup_asic(chip):
|
|
|
167
173
|
'values between 0 and 1', field='help')
|
|
168
174
|
chip.set('tool', tool, 'task', task, 'file', 'techmap',
|
|
169
175
|
'File to use for techmapping in Yosys', field='help')
|
|
170
|
-
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty_file',
|
|
171
|
-
'File to use for the DFF mapping stage of Yosys', field='help')
|
|
172
176
|
chip.set('tool', tool, 'task', task, 'var', 'add_buffers',
|
|
173
177
|
'true/false, flag to indicate whether to add buffers or not.', field='help')
|
|
174
178
|
|
|
@@ -181,6 +185,14 @@ def setup_asic(chip):
|
|
|
181
185
|
'Instance limit for the number of cells in a module to preserve.',
|
|
182
186
|
field='help')
|
|
183
187
|
|
|
188
|
+
set_tool_task_var(chip, 'map_clockgates',
|
|
189
|
+
default_value=False,
|
|
190
|
+
schelp='Map clockgates during synthesis.')
|
|
191
|
+
|
|
192
|
+
set_tool_task_var(chip, 'min_clockgate_fanout',
|
|
193
|
+
default_value=8,
|
|
194
|
+
schelp='Minimum clockgate fanout.')
|
|
195
|
+
|
|
184
196
|
chip.set('tool', tool, 'task', task, 'var', 'strategy',
|
|
185
197
|
'ABC synthesis strategy. Allowed values are DELAY0-4, AREA0-3, or if the strategy '
|
|
186
198
|
'starts with a + it is assumed to be actual commands for ABC.',
|
|
@@ -209,22 +221,13 @@ def prepare_synthesis_libraries(chip):
|
|
|
209
221
|
corners = chip.get('tool', tool, 'task', task, 'var', 'synthesis_corner',
|
|
210
222
|
step=step, index=index)
|
|
211
223
|
|
|
212
|
-
|
|
213
|
-
dff_liberty_file = chip.find_files('tool', tool, 'task', task, 'file', 'dff_liberty',
|
|
214
|
-
step=step, index=index)[0]
|
|
215
|
-
yosys_dff_file = chip.get('tool', tool, 'task', task, 'file', 'dff_liberty_file',
|
|
216
|
-
step=step, index=index)[0]
|
|
217
|
-
|
|
218
|
-
with open(yosys_dff_file, 'w') as f:
|
|
219
|
-
f.write(prepareLib.processLibertyFile(
|
|
220
|
-
dff_liberty_file,
|
|
221
|
-
logger=None if chip.get('option', 'quiet', step=step, index=index) else chip.logger
|
|
222
|
-
))
|
|
224
|
+
logger = None if chip.get('option', 'quiet', step=step, index=index) else chip.logger
|
|
223
225
|
|
|
224
226
|
# Clear in case of rerun
|
|
225
227
|
for libtype in ('synthesis_libraries', 'synthesis_libraries_macros'):
|
|
226
228
|
chip.set('tool', tool, 'task', task, 'file', libtype, [],
|
|
227
229
|
step=step, index=index)
|
|
230
|
+
chip.set('tool', tool, 'task', task, 'file', libtype, False, field='copy')
|
|
228
231
|
|
|
229
232
|
# Generate synthesis_libraries and synthesis_macro_libraries for Yosys use
|
|
230
233
|
|
|
@@ -237,9 +240,11 @@ def prepare_synthesis_libraries(chip):
|
|
|
237
240
|
return chip.find_files(*keypath, step=step, index=index)
|
|
238
241
|
return []
|
|
239
242
|
|
|
243
|
+
lib_file_map = {}
|
|
240
244
|
for libtype in ('logic', 'macro'):
|
|
241
245
|
for lib in get_libraries(chip, libtype):
|
|
242
246
|
lib_content = {}
|
|
247
|
+
lib_map = {}
|
|
243
248
|
# Mark dont use
|
|
244
249
|
for lib_file in get_synthesis_libraries(lib):
|
|
245
250
|
# Ensure a unique name is used for library
|
|
@@ -255,15 +260,11 @@ def prepare_synthesis_libraries(chip):
|
|
|
255
260
|
lib_file_name = f'{lib_file_name_base}_{unique_ident}'
|
|
256
261
|
unique_ident += 1
|
|
257
262
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
lib_content[lib_file_name] = prepareLib.processLibertyFile(
|
|
264
|
-
lib_file,
|
|
265
|
-
logger=None if chip.get('option', 'quiet',
|
|
266
|
-
step=step, index=index) else chip.logger)
|
|
263
|
+
lib_content[lib_file_name] = processLibertyFile(
|
|
264
|
+
lib_file,
|
|
265
|
+
logger=logger
|
|
266
|
+
)
|
|
267
|
+
lib_map[lib_file_name] = lib_file
|
|
267
268
|
|
|
268
269
|
if not lib_content:
|
|
269
270
|
continue
|
|
@@ -278,6 +279,7 @@ def prepare_synthesis_libraries(chip):
|
|
|
278
279
|
'inputs',
|
|
279
280
|
f'sc_{libtype}_{lib}_{file}.lib'
|
|
280
281
|
)
|
|
282
|
+
lib_file_map[lib_map[file]] = output_file
|
|
281
283
|
|
|
282
284
|
with open(output_file, 'w') as f:
|
|
283
285
|
f.write(content)
|
|
@@ -376,42 +378,6 @@ def _get_synthesis_library_key(chip, lib, corners):
|
|
|
376
378
|
return ('library', lib, 'output', corners[0], delaymodel)
|
|
377
379
|
|
|
378
380
|
|
|
379
|
-
def get_dff_liberty_file(chip):
|
|
380
|
-
tool = 'yosys'
|
|
381
|
-
step = chip.get('arg', 'step')
|
|
382
|
-
index = chip.get('arg', 'index')
|
|
383
|
-
_, task = get_tool_task(chip, step, index)
|
|
384
|
-
|
|
385
|
-
dff_liberty = None
|
|
386
|
-
if chip.valid('tool', tool, 'task', task, 'file', 'dff_liberty'):
|
|
387
|
-
dff_liberty = chip.find_files('tool', tool, 'task', task, 'file', 'dff_liberty',
|
|
388
|
-
step=step, index=index)
|
|
389
|
-
if dff_liberty:
|
|
390
|
-
return dff_liberty[0]
|
|
391
|
-
|
|
392
|
-
mainlib = get_mainlib(chip)
|
|
393
|
-
if chip.valid('library', mainlib, 'option', 'file', 'yosys_dff_liberty'):
|
|
394
|
-
dff_liberty = chip.find_files('library', mainlib, 'option', 'file', 'yosys_dff_liberty')
|
|
395
|
-
if dff_liberty:
|
|
396
|
-
return dff_liberty[0]
|
|
397
|
-
|
|
398
|
-
corners = get_synthesis_corner(chip)
|
|
399
|
-
if corners is None:
|
|
400
|
-
return None
|
|
401
|
-
|
|
402
|
-
# if dff liberty file is not set, use the first liberty file defined
|
|
403
|
-
for lib in get_libraries(chip, 'logic'):
|
|
404
|
-
if not chip.valid(*_get_synthesis_library_key(chip, lib, corners)):
|
|
405
|
-
continue
|
|
406
|
-
|
|
407
|
-
lib_files = chip.find_files(*_get_synthesis_library_key(chip, lib, corners),
|
|
408
|
-
step=step, index=index)
|
|
409
|
-
if len(lib_files) > 0:
|
|
410
|
-
return lib_files[0]
|
|
411
|
-
|
|
412
|
-
return None
|
|
413
|
-
|
|
414
|
-
|
|
415
381
|
def get_abc_period(chip):
|
|
416
382
|
|
|
417
383
|
tool = 'yosys'
|
|
@@ -543,17 +509,10 @@ def pre_process(chip):
|
|
|
543
509
|
chip.add('tool', tool, 'task', task, 'file', 'techmap', techmap, step=step, index=index)
|
|
544
510
|
|
|
545
511
|
# Constants needed by yosys, do not allow overriding of values so force clobbering
|
|
546
|
-
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty_file',
|
|
547
|
-
f"{chip.getworkdir(step=step, index=index)}/inputs/sc_dff_library.lib",
|
|
548
|
-
step=step, index=index, clobber=True)
|
|
549
512
|
chip.set('tool', tool, 'task', task, 'file', 'abc_constraint_file',
|
|
550
513
|
f"{chip.getworkdir(step=step, index=index)}/inputs/sc_abc.constraints",
|
|
551
514
|
step=step, index=index, clobber=True)
|
|
552
|
-
|
|
553
|
-
dff_liberty_file = get_dff_liberty_file(chip)
|
|
554
|
-
if dff_liberty_file:
|
|
555
|
-
chip.set('tool', tool, 'task', task, 'file', 'dff_liberty', dff_liberty_file,
|
|
556
|
-
step=step, index=index, clobber=False)
|
|
515
|
+
chip.set('tool', tool, 'task', task, 'file', 'abc_constraint_file', False, field='copy')
|
|
557
516
|
|
|
558
517
|
abc_clock_period = get_abc_period(chip)
|
|
559
518
|
if abc_clock_period:
|
|
@@ -562,8 +521,80 @@ def pre_process(chip):
|
|
|
562
521
|
|
|
563
522
|
prepare_synthesis_libraries(chip)
|
|
564
523
|
create_abc_synthesis_constraints(chip)
|
|
565
|
-
return
|
|
566
524
|
|
|
567
525
|
|
|
568
526
|
def post_process(chip):
|
|
569
527
|
syn_post_process(chip)
|
|
528
|
+
_generate_cell_area_report(chip)
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def _generate_cell_area_report(chip):
|
|
532
|
+
design = "gcd"
|
|
533
|
+
if not os.path.exists('reports/stat.json'):
|
|
534
|
+
return
|
|
535
|
+
if not os.path.exists(f'outputs/{design}.netlist.json'):
|
|
536
|
+
return
|
|
537
|
+
|
|
538
|
+
with sc_open('reports/stat.json') as fd:
|
|
539
|
+
stat = json.load(fd)
|
|
540
|
+
|
|
541
|
+
with sc_open(f'outputs/{design}.netlist.json') as fd:
|
|
542
|
+
netlist = json.load(fd)
|
|
543
|
+
modules = []
|
|
544
|
+
for module in stat["modules"].keys():
|
|
545
|
+
if module[0] == "\\":
|
|
546
|
+
modules.append(module[1:])
|
|
547
|
+
|
|
548
|
+
cellarea_report = CellArea()
|
|
549
|
+
|
|
550
|
+
def get_area_count(module):
|
|
551
|
+
if f"\\{module}" not in stat["modules"]:
|
|
552
|
+
return 0.0, 0
|
|
553
|
+
info = stat["modules"][f"\\{module}"]
|
|
554
|
+
|
|
555
|
+
count = info["num_cells"]
|
|
556
|
+
area = 0.0
|
|
557
|
+
if "area" in info:
|
|
558
|
+
area = info["area"]
|
|
559
|
+
|
|
560
|
+
for cell, inst_count in info["num_cells_by_type"].items():
|
|
561
|
+
# print(module, cell, inst_count)
|
|
562
|
+
|
|
563
|
+
cell_area, cell_count = get_area_count(cell)
|
|
564
|
+
|
|
565
|
+
count += cell_count * inst_count
|
|
566
|
+
if cell_count > 0:
|
|
567
|
+
count -= inst_count
|
|
568
|
+
area += cell_area * inst_count
|
|
569
|
+
|
|
570
|
+
return area, count
|
|
571
|
+
|
|
572
|
+
def handle_heir(level_info, prefix):
|
|
573
|
+
cells = list(level_info["cells"])
|
|
574
|
+
|
|
575
|
+
for cell in cells:
|
|
576
|
+
cell_type = level_info["cells"][cell]["type"]
|
|
577
|
+
if cell_type in modules:
|
|
578
|
+
area, count = get_area_count(cell_type)
|
|
579
|
+
cellarea_report.addCell(
|
|
580
|
+
name=f"{prefix}{cell}",
|
|
581
|
+
module=cell_type,
|
|
582
|
+
cellcount=count,
|
|
583
|
+
cellarea=area)
|
|
584
|
+
handle_heir(netlist["modules"][cell_type], f"{prefix}{cell}.")
|
|
585
|
+
|
|
586
|
+
count = stat["design"]["num_cells"]
|
|
587
|
+
area = 0.0
|
|
588
|
+
if "area" in stat["design"]:
|
|
589
|
+
area = stat["design"]["area"]
|
|
590
|
+
cellarea_report.addCell(
|
|
591
|
+
name=design,
|
|
592
|
+
module=design,
|
|
593
|
+
cellarea=area,
|
|
594
|
+
cellcount=count
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
handle_heir(netlist["modules"][design], "")
|
|
598
|
+
|
|
599
|
+
if cellarea_report.size() > 0:
|
|
600
|
+
cellarea_report.writeReport("reports/hierarchical_cell_area.json")
|
|
@@ -92,8 +92,6 @@ if { [sc_cfg_tool_task_exists {file} synthesis_libraries_macros] } {
|
|
|
92
92
|
}
|
|
93
93
|
set sc_mainlib [lindex $sc_logiclibs 0]
|
|
94
94
|
|
|
95
|
-
set sc_dff_library \
|
|
96
|
-
[lindex [sc_cfg_tool_task_get {file} dff_liberty_file] 0]
|
|
97
95
|
set sc_abc_constraints \
|
|
98
96
|
[lindex [sc_cfg_tool_task_get {file} abc_constraint_file] 0]
|
|
99
97
|
|
|
@@ -120,7 +118,7 @@ if { [sc_cfg_tool_task_exists file memory_techmap] } {
|
|
|
120
118
|
# Schema helper functions
|
|
121
119
|
#########################
|
|
122
120
|
|
|
123
|
-
proc
|
|
121
|
+
proc sc_has_tie_cell { type } {
|
|
124
122
|
upvar sc_cfg sc_cfg
|
|
125
123
|
upvar sc_mainlib sc_mainlib
|
|
126
124
|
upvar sc_tool sc_tool
|
|
@@ -131,7 +129,7 @@ proc has_tie_cell { type } {
|
|
|
131
129
|
}]
|
|
132
130
|
}
|
|
133
131
|
|
|
134
|
-
proc
|
|
132
|
+
proc sc_get_tie_cell { type } {
|
|
135
133
|
upvar sc_cfg sc_cfg
|
|
136
134
|
upvar sc_mainlib sc_mainlib
|
|
137
135
|
upvar sc_tool sc_tool
|
|
@@ -209,6 +207,18 @@ yosys hierarchy -top $sc_design
|
|
|
209
207
|
# Mark modules to keep from getting removed in flattening
|
|
210
208
|
preserve_modules
|
|
211
209
|
|
|
210
|
+
# Handle tristate buffers
|
|
211
|
+
set sc_tbuf "false"
|
|
212
|
+
if {
|
|
213
|
+
[sc_cfg_exists library $sc_mainlib option file yosys_tbufmap] &&
|
|
214
|
+
[llength [sc_cfg_get library $sc_mainlib option file yosys_tbufmap]] != 0
|
|
215
|
+
} {
|
|
216
|
+
set sc_tbuf "true"
|
|
217
|
+
|
|
218
|
+
yosys tribuf
|
|
219
|
+
yosys stat
|
|
220
|
+
}
|
|
221
|
+
|
|
212
222
|
set flatten_design [expr {
|
|
213
223
|
[lindex [sc_cfg_tool_task_get var flatten] 0]
|
|
214
224
|
== "true"
|
|
@@ -253,6 +263,10 @@ yosys synth {*}$synth_args -top $sc_design -run fine:check
|
|
|
253
263
|
# Some place and route tools cannot handle these in the output Verilog,
|
|
254
264
|
# so remove them here.
|
|
255
265
|
yosys delete {*/t:$print}
|
|
266
|
+
yosys chformal -remove
|
|
267
|
+
|
|
268
|
+
# Recheck hierarchy to remove all unused modules
|
|
269
|
+
yosys hierarchy -top $sc_design
|
|
256
270
|
|
|
257
271
|
yosys opt -purge
|
|
258
272
|
|
|
@@ -260,6 +274,15 @@ yosys opt -purge
|
|
|
260
274
|
# Technology Mapping
|
|
261
275
|
########################################################
|
|
262
276
|
|
|
277
|
+
# Handle tristate buffers
|
|
278
|
+
if { $sc_tbuf == "true" } {
|
|
279
|
+
set sc_tbuf_techmap \
|
|
280
|
+
[lindex [sc_cfg_get library $sc_mainlib option file yosys_tbufmap] 0]
|
|
281
|
+
# Map tristate buffers
|
|
282
|
+
yosys techmap -map $sc_tbuf_techmap
|
|
283
|
+
post_techmap -fast
|
|
284
|
+
}
|
|
285
|
+
|
|
263
286
|
if { [sc_cfg_tool_task_get var map_adders] == "true" } {
|
|
264
287
|
set sc_adder_techmap \
|
|
265
288
|
[lindex [sc_cfg_get library $sc_mainlib option {file} yosys_addermap] 0]
|
|
@@ -284,14 +307,36 @@ if { [sc_cfg_tool_task_get var autoname] == "true" } {
|
|
|
284
307
|
yosys rename -wire
|
|
285
308
|
}
|
|
286
309
|
|
|
310
|
+
if { [lindex [sc_cfg_tool_task_get var map_clockgates] 0] == "true" } {
|
|
311
|
+
set clockgate_dont_use []
|
|
312
|
+
foreach lib "$sc_logiclibs $sc_macrolibs" {
|
|
313
|
+
foreach cell [sc_cfg_get library $lib asic cells dontuse] {
|
|
314
|
+
lappend clockgate_dont_use -dont_use $cell
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
set clockgate_liberty []
|
|
318
|
+
foreach lib_file "$sc_libraries $sc_macro_libraries" {
|
|
319
|
+
lappend clockgate_dont_use "-liberty" $lib_file
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
yosys clockgate \
|
|
323
|
+
{*}$clockgate_dont_use \
|
|
324
|
+
{*}$clockgate_liberty \
|
|
325
|
+
-min_net_size [lindex [sc_cfg_tool_task_get var min_clockgate_fanout] 0]
|
|
326
|
+
}
|
|
327
|
+
|
|
287
328
|
set dfflibmap_dont_use []
|
|
288
329
|
foreach lib "$sc_logiclibs $sc_macrolibs" {
|
|
289
330
|
foreach cell [sc_cfg_get library $lib asic cells dontuse] {
|
|
290
331
|
lappend dfflibmap_dont_use -dont_use $cell
|
|
291
332
|
}
|
|
292
333
|
}
|
|
334
|
+
set dfflibmap_liberty []
|
|
335
|
+
foreach lib_file "$sc_libraries $sc_macro_libraries" {
|
|
336
|
+
lappend dfflibmap_liberty "-liberty" $lib_file
|
|
337
|
+
}
|
|
293
338
|
|
|
294
|
-
yosys dfflibmap {*}$dfflibmap_dont_use
|
|
339
|
+
yosys dfflibmap {*}$dfflibmap_dont_use {*}$dfflibmap_liberty
|
|
295
340
|
|
|
296
341
|
# perform final techmap and opt in case previous techmaps introduced constructs that need
|
|
297
342
|
# techmapping
|
|
@@ -337,8 +382,10 @@ foreach lib_file $sc_libraries {
|
|
|
337
382
|
}
|
|
338
383
|
set abc_dont_use []
|
|
339
384
|
foreach lib "$sc_logiclibs $sc_macrolibs" {
|
|
340
|
-
foreach
|
|
341
|
-
|
|
385
|
+
foreach group "dontuse hold clkbuf clkgate clklogic" {
|
|
386
|
+
foreach cell [sc_cfg_get library $lib asic cells $group] {
|
|
387
|
+
lappend abc_dont_use -dont_use $cell
|
|
388
|
+
}
|
|
342
389
|
}
|
|
343
390
|
}
|
|
344
391
|
|
|
@@ -356,11 +403,11 @@ yosys splitnets
|
|
|
356
403
|
yosys clean -purge
|
|
357
404
|
|
|
358
405
|
set yosys_hilomap_args []
|
|
359
|
-
if { [
|
|
360
|
-
lappend yosys_hilomap_args -locell {*}[
|
|
406
|
+
if { [sc_has_tie_cell low] } {
|
|
407
|
+
lappend yosys_hilomap_args -locell {*}[sc_get_tie_cell low]
|
|
361
408
|
}
|
|
362
|
-
if { [
|
|
363
|
-
lappend yosys_hilomap_args -hicell {*}[
|
|
409
|
+
if { [sc_has_tie_cell high] } {
|
|
410
|
+
lappend yosys_hilomap_args -hicell {*}[sc_get_tie_cell high]
|
|
364
411
|
}
|
|
365
412
|
if { [llength $yosys_hilomap_args] != 0 } {
|
|
366
413
|
yosys hilomap -singleton {*}$yosys_hilomap_args
|
|
@@ -376,7 +423,6 @@ if {
|
|
|
376
423
|
yosys clean -purge
|
|
377
424
|
|
|
378
425
|
set stat_libs []
|
|
379
|
-
lappend stat_libs "-liberty" $sc_dff_library
|
|
380
426
|
foreach lib_file "$sc_libraries $sc_macro_libraries" {
|
|
381
427
|
lappend stat_libs "-liberty" $lib_file
|
|
382
428
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from siliconcompiler.tools.yosys
|
|
1
|
+
from siliconcompiler.tools.yosys import syn_setup, syn_post_process
|
|
2
2
|
import json
|
|
3
3
|
from siliconcompiler import sc_open
|
|
4
4
|
from siliconcompiler.tools._common import get_tool_task, record_metric
|
|
5
|
-
from siliconcompiler.targets import fpgaflow_demo
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
######################################################################
|
|
9
8
|
# Make Docs
|
|
10
9
|
######################################################################
|
|
11
10
|
def make_docs(chip):
|
|
11
|
+
from siliconcompiler.targets import fpgaflow_demo
|
|
12
12
|
chip.set('fpga', 'partname', 'ice40up5k-sg48')
|
|
13
13
|
chip.use(fpgaflow_demo)
|
|
14
14
|
|
|
@@ -93,7 +93,6 @@ def setup_fpga(chip):
|
|
|
93
93
|
",".join(['fpga', part_name, 'file', 'yosys_memory_techmap']),
|
|
94
94
|
step=step, index=index)
|
|
95
95
|
|
|
96
|
-
chip.add('tool', tool, 'task', task, 'output', design + '.netlist.json', step=step, index=index)
|
|
97
96
|
chip.add('tool', tool, 'task', task, 'output', design + '.blif', step=step, index=index)
|
|
98
97
|
|
|
99
98
|
|