Skip to content

Commit a29bd30

Browse files
authored
Merge pull request #3741 from The-OpenROAD-Project-staging/synth-slang-top-params
Fix top params option for slang, demo on asap7/uart
2 parents 432a91a + 0b5c918 commit a29bd30

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

‎flow/designs/asap7/uart/config.mk‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export TNS_END_PERCENT = 100
1313
export EQUIVALENCE_CHECK ?= 1
1414
export REMOVE_CELLS_FOR_EQY = TAPCELL*
1515
export SKIP_GATE_CLONING = 1
16-
export VERILOG_TOP_PARAMS = DATA_WIDTH 8
16+
export VERILOG_TOP_PARAMS = DATA_WIDTH 8
17+
export SYNTH_HDL_FRONTEND = slang

‎flow/designs/asap7/uart/rules-base.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"compare": ">="
101101
},
102102
"finish__timing__setup__tns": {
103-
"value": -1190.0,
103+
"value": -1310.0,
104104
"compare": ">="
105105
},
106106
"finish__timing__hold__ws": {

‎flow/scripts/synth_canonicalize.tcl‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
source $::env(SCRIPTS_DIR)/synth_preamble.tcl
22
read_design_sources
33

4-
dict for {key value} [env_var_or_empty VERILOG_TOP_PARAMS] {
5-
# Apply toplevel parameters
6-
chparam -set $key $value $::env(DESIGN_NAME)
7-
}
8-
94
hierarchy -check -top $::env(DESIGN_NAME)
105

116
source_env_var_if_exists SYNTH_CANONICALIZE_TCL

‎flow/scripts/synth_preamble.tcl‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,25 @@ proc read_design_sources { } {
4444
}
4545

4646
if { [env_var_equals SYNTH_HDL_FRONTEND slang] } {
47-
# slang requires all files at once
4847
plugin -i slang
49-
yosys read_slang -D SYNTHESIS --keep-hierarchy --compat=vcs \
50-
--ignore-assertions {*}$::env(SYNTH_SLANG_ARGS) --top $::env(DESIGN_NAME) \
51-
{*}$vIdirsArgs {*}$::env(VERILOG_FILES) {*}[env_var_or_empty VERILOG_DEFINES]
48+
49+
set slang_args [list \
50+
-D SYNTHESIS --keep-hierarchy --compat=vcs --ignore-assertions --top $::env(DESIGN_NAME) \
51+
{*}$vIdirsArgs {*}[env_var_or_empty VERILOG_DEFINES]]
52+
53+
# slang requires all files at once
54+
lappend slang_args {*}$::env(VERILOG_FILES)
55+
56+
# Apply top-level parameters
57+
dict for {key value} [env_var_or_empty VERILOG_TOP_PARAMS] {
58+
lappend slang_args -G "$key=$value"
59+
}
60+
61+
# Add user arguments
62+
lappend slang_args {*}$::env(SYNTH_SLANG_ARGS)
63+
64+
yosys read_slang {*}$slang_args
65+
5266
# Workaround for yosys-slang#119
5367
setattr -unset init
5468
} elseif { [env_var_equals SYNTH_HDL_FRONTEND verific] } {
@@ -60,6 +74,11 @@ proc read_design_sources { } {
6074
}
6175
verific -sv2012 {*}$::env(VERILOG_FILES)
6276
verific -import -no-split-complex-ports $::env(DESIGN_NAME)
77+
78+
dict for {key value} [env_var_or_empty VERILOG_TOP_PARAMS] {
79+
# Apply top-level parameters
80+
chparam -set $key $value $::env(DESIGN_NAME)
81+
}
6382
} elseif { ![env_var_exists_and_non_empty SYNTH_HDL_FRONTEND] } {
6483
verilog_defaults -push
6584
if { [env_var_exists_and_non_empty VERILOG_DEFINES] } {
@@ -69,6 +88,11 @@ proc read_design_sources { } {
6988
read_verilog -defer -sv {*}$vIdirsArgs $file
7089
}
7190
verilog_defaults -pop
91+
92+
dict for {key value} [env_var_or_empty VERILOG_TOP_PARAMS] {
93+
# Apply top-level parameters
94+
chparam -set $key $value $::env(DESIGN_NAME)
95+
}
7296
} else {
7397
error "Unrecognized HDL frontend: $::env(SYNTH_HDL_FRONTEND)"
7498
}

0 commit comments

Comments
 (0)