Skip to content

Commit bab1020

Browse files
authored
Merge pull request #3263 from Pinata-Consulting/variables-cleanup
variables: cleanup
2 parents 27c67bf + 0b7828e commit bab1020

File tree

8 files changed

+19
-14
lines changed

8 files changed

+19
-14
lines changed

flow/scripts/global_place.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ proc do_placement {global_placement_args} {
3939
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT)] \
4040
$global_placement_args]
4141

42-
lappend all_args {*}$::env(GLOBAL_PLACEMENT_ARGS)
42+
lappend all_args {*}[env_var_or_empty GLOBAL_PLACEMENT_ARGS]
4343

4444
log_cmd global_placement {*}$all_args
4545
}

flow/scripts/global_place_skip_io.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if { [env_var_exists_and_non_empty FLOORPLAN_DEF] } {
88
log_cmd global_placement -skip_io -density [place_density_with_lb_addon] \
99
-pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
1010
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
11-
{*}$::env(GLOBAL_PLACEMENT_ARGS)
11+
{*}[env_var_or_empty GLOBAL_PLACEMENT_ARGS]
1212
}
1313

1414
write_db $::env(RESULTS_DIR)/3_1_place_gp_skip_io.odb

flow/scripts/io_placement.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if {![env_var_exists_and_non_empty FLOORPLAN_DEF] && \
88
log_cmd place_pins \
99
-hor_layers $::env(IO_PLACER_H) \
1010
-ver_layers $::env(IO_PLACER_V) \
11-
{*}$::env(PLACE_PINS_ARGS)
11+
{*}[env_var_or_empty PLACE_PINS_ARGS]
1212
write_db $::env(RESULTS_DIR)/3_2_place_iop.odb
1313
write_pin_placement $::env(RESULTS_DIR)/3_2_place_iop.tcl
1414
} else {

flow/scripts/synth.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if {[env_var_exists_and_non_empty SYNTH_HIER_SEPARATOR]} {
2121
scratchpad -set flatten.separator $::env(SYNTH_HIER_SEPARATOR)
2222
}
2323

24-
set synth_full_args $::env(SYNTH_ARGS)
24+
set synth_full_args [env_var_or_empty SYNTH_ARGS]
2525
if {[env_var_exists_and_non_empty SYNTH_OPERATIONS_ARGS]} {
2626
set synth_full_args [concat $synth_full_args $::env(SYNTH_OPERATIONS_ARGS)]
2727
} else {

flow/scripts/synth_canonicalize.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source $::env(SCRIPTS_DIR)/synth_preamble.tcl
22
read_design_sources
33

4-
dict for {key value} $::env(VERILOG_TOP_PARAMS) {
4+
dict for {key value} [env_var_or_empty VERILOG_TOP_PARAMS] {
55
# Apply toplevel parameters
66
chparam -set $key $value $::env(DESIGN_NAME)
77
}

flow/scripts/synth_preamble.tcl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,22 @@ proc read_design_sources {} {
4848
plugin -i slang
4949
yosys read_slang -D SYNTHESIS --keep-hierarchy --compat=vcs \
5050
--ignore-assertions --top $::env(DESIGN_NAME) \
51-
{*}$vIdirsArgs {*}$::env(VERILOG_FILES) {*}$::env(VERILOG_DEFINES)
51+
{*}$vIdirsArgs {*}$::env(VERILOG_FILES) {*}[env_var_or_empty VERILOG_DEFINES]
5252
# Workaround for yosys-slang#119
5353
setattr -unset init
5454
} elseif {[env_var_equals SYNTH_HDL_FRONTEND verific]} {
5555
if {[env_var_exists_and_non_empty VERILOG_INCLUDE_DIRS]} {
56-
verific -vlog-incdir {*}$::env(VERILOG_INCLUDE_DIRS)
56+
verific -vlog-incdir {*}$::env(VERILOG_INCLUDE_DIRS)
5757
}
5858
if {[env_var_exists_and_non_empty VERILOG_DEFINES]} {
59-
verific -vlog-define {*}$::env(VERILOG_DEFINES)
59+
verific -vlog-define {*}$::env(VERILOG_DEFINES)
6060
}
6161
verific -sv2012 {*}$::env(VERILOG_FILES)
6262
} elseif {![env_var_exists_and_non_empty SYNTH_HDL_FRONTEND]} {
6363
verilog_defaults -push
64-
verilog_defaults -add {*}$::env(VERILOG_DEFINES)
64+
if {[env_var_exists_and_non_empty VERILOG_DEFINES]} {
65+
verilog_defaults -add {*}$::env(VERILOG_DEFINES)
66+
}
6567
foreach file $::env(VERILOG_FILES) {
6668
read_verilog -defer -sv {*}$vIdirsArgs $file
6769
}

flow/scripts/util.tcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ proc append_env_var {list_name var_name prefix has_arg} {
124124
}
125125
}
126126

127+
# Non-empty defaults should go into variables.yaml, generally
128+
proc env_var_or_empty {env_var} {
129+
if {[env_var_exists_and_non_empty $env_var]} {
130+
return $::env($env_var)
131+
}
132+
return ""
133+
}
134+
127135
proc find_macros {} {
128136
set macros ""
129137

flow/scripts/variables.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ PLACE_PINS_ARGS:
377377
Arguments to place_pins
378378
stages:
379379
- place
380-
default: ""
381380
PLACE_DENSITY:
382381
description: >
383382
The desired average placement density of cells: 1.0 = dense, 0.0 = widely spread.
@@ -407,7 +406,6 @@ GLOBAL_PLACEMENT_ARGS:
407406
description: >
408407
Use additional tuning parameters during global placement other than default
409408
args defined in global_place.tcl.
410-
default: ""
411409
ENABLE_DPO:
412410
description: |
413411
Enable detail placement with improve_placement feature.
@@ -603,7 +601,6 @@ VERILOG_DEFINES:
603601
description: >
604602
Preprocessor defines passed to the language frontend.
605603
Example: `-D HPDCACHE_ASSERT_OFF`
606-
default: ""
607604
stages:
608605
- synth
609606
SDC_FILE:
@@ -683,7 +680,6 @@ SYNTH_KEEP_MODULES:
683680
SYNTH_ARGS:
684681
description: |
685682
Optional synthesis variables for yosys.
686-
default: ""
687683
SYNTH_HIER_SEPARATOR:
688684
description: |
689685
Separator used for the synthesis flatten stage.
@@ -693,7 +689,6 @@ VERILOG_TOP_PARAMS:
693689
Apply toplevel params (if exist).
694690
stages:
695691
- synth
696-
default: ""
697692
CORE_ASPECT_RATIO:
698693
description: >
699694
The core aspect ratio (height / width). This value is ignored if

0 commit comments

Comments
 (0)