Skip to content

Commit 7588679

Browse files
committed
Add option of synthesis using 'syn'
Signed-off-by: Martin Povišer <povik@cutebit.org>
1 parent d90873f commit 7588679

5 files changed

Lines changed: 104 additions & 0 deletions

File tree

flow/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,11 @@ floorplan_to_place: $(RESULTS_DIR)/1_synth.odb $(RESULTS_DIR)/1_synth.sdc
404404

405405
# ==============================================================================
406406

407+
ifeq ($(SYNTH_USE_SYN),1)
408+
$(eval $(call do-step,1_synth,$(TECH_LEF) $(SC_LEF) $(ADDITIONAL_LEFS) $(LIB_FILES),synth_syn))
409+
else
407410
$(eval $(call do-step,1_synth,$(RESULTS_DIR)/1_2_yosys.v $(RESULTS_DIR)/1_2_yosys.sdc $(TECH_LEF) $(SC_LEF) $(ADDITIONAL_LEFS) $(LIB_FILES),synth_odb))
411+
endif
408412

409413
$(RESULTS_DIR)/1_synth.sdc: $(RESULTS_DIR)/1_synth.odb
410414

flow/scripts/synth_syn.tcl

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
utl::set_metrics_stage "synth__{}"
2+
source $::env(SCRIPTS_DIR)/load.tcl
3+
erase_non_stage_variables synth
4+
5+
source_env_var_if_exists PLATFORM_TCL
6+
source $::env(SCRIPTS_DIR)/read_liberty.tcl
7+
8+
read_lef $::env(TECH_LEF)
9+
read_lef $::env(SC_LEF)
10+
if { [env_var_exists_and_non_empty ADDITIONAL_LEFS] } {
11+
foreach lef $::env(ADDITIONAL_LEFS) {
12+
read_lef $lef
13+
}
14+
}
15+
set_dont_use $::env(DONT_USE_CELLS)
16+
17+
# Setup verilog include directories
18+
set vIdirsArgs ""
19+
if { [env_var_exists_and_non_empty VERILOG_INCLUDE_DIRS] } {
20+
foreach dir $::env(VERILOG_INCLUDE_DIRS) {
21+
lappend vIdirsArgs "-I$dir"
22+
}
23+
set vIdirsArgs [join $vIdirsArgs]
24+
}
25+
26+
set elaborate_args [list \
27+
-D SYNTHESIS --compat=vcs --ignore-assertions --no-implicit-memories --top $::env(DESIGN_NAME) \
28+
{*}$vIdirsArgs {*}[env_var_or_empty VERILOG_DEFINES]]
29+
30+
lappend elaborate_args {*}$::env(VERILOG_FILES)
31+
32+
# Apply top-level parameters
33+
dict for {key value} [env_var_or_empty VERILOG_TOP_PARAMS] {
34+
lappend elaborate_args -G "$key=$value"
35+
}
36+
37+
# Apply module blackboxing based on module names as they appear
38+
# in the input, that is before any module name mangling done
39+
# by elaboration and synthesis
40+
if { [env_var_exists_and_non_empty SYNTH_BLACKBOXES] } {
41+
foreach m $::env(SYNTH_BLACKBOXES) {
42+
lappend elaborate_args --blackboxed-module "$m"
43+
}
44+
}
45+
46+
lappend elaborate_args {*}$::env(SYNTH_SLANG_ARGS)
47+
48+
# If the sources are solely .v files, enable Verilog compatibility
49+
set has_non_v_files false
50+
foreach fn $::env(VERILOG_FILES) {
51+
if { [file extension [string trim $fn]] != ".v" } {
52+
set has_non_v_files true
53+
}
54+
}
55+
if { !$has_non_v_files } {
56+
lappend elaborate_args --std=1364-2005
57+
}
58+
59+
sv_elaborate {*}$elaborate_args
60+
syn::stats
61+
62+
if {$::env(DESIGN_NAME) == "cva6"} {
63+
syn::remove_ports rvfi_probes_o
64+
}
65+
synthesize
66+
67+
read_sdc $::env(SDC_FILE)
68+
repair_design -pre_placement
69+
70+
report_metrics 1 "synth" false false
71+
72+
orfs_write_db $::env(RESULTS_DIR)/1_synth.odb
73+
# Canonicalize 1_synth.sdc. The original SDC_FILE provided by
74+
# the user could have dependencies, such as sourcing util.tcl,
75+
# which are read in here and a canonicalized version is written
76+
# out by OpenSTA that has no dependencies.
77+
orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc

flow/scripts/variables.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flow/scripts/variables.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ SKIP_REPORT_METRICS:
115115
If set to 1, then metrics, report_metrics does nothing. Useful to speed up
116116
builds.
117117
stages:
118+
- synth
118119
- floorplan
119120
- place
120121
- cts
@@ -180,6 +181,14 @@ SYNTH_HIERARCHICAL:
180181
stages:
181182
- synth
182183
default: 0
184+
SYNTH_USE_SYN:
185+
description: >
186+
If set to 1, run synthesis using the "syn" tool built into OpenROAD
187+
(the synth_syn.tcl flow) instead of the default Yosys-based flow.
188+
Defaults to 0 (Yosys flow).
189+
stages:
190+
- synth
191+
default: 0
183192
SYNTH_MEMORY_MAX_BITS:
184193
description: >
185194
Maximum number of bits for memory synthesis.

flow/util/genMetrics.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ def extract_metrics(
271271
)
272272
metrics_dict["synth__netlist__hash"] = file_sha1(resultPath + "/1_2_yosys.v")
273273

274+
# Merge the synthesis stage metrics emitted by OpenROAD (i.e. the "syn"
275+
# flow in synth_syn.tcl,). This runs after the extractTagFromFile() calls
276+
# above so that, for the syn flow, the JSON values override the "ERR"
277+
# placeholders left when the Yosys-only synth_stat.txt is absent.
278+
merge_jsons(logPath, metrics_dict, "1_*.json")
279+
274280
# Clocks
275281
# =========================================================================
276282
clk_list = read_sdc(resultPath + "/2_floorplan.sdc")

0 commit comments

Comments
 (0)