dpl: easier setting for using negotiation legalizer#4147
dpl: easier setting for using negotiation legalizer#4147openroad-ci wants to merge 9 commits intoThe-OpenROAD-Project:masterfrom
Conversation
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
There was a problem hiding this comment.
Code Review
This pull request introduces conditional support for the -use_negotiation flag in the detailed_placement command across several scripts, including cts.tcl, detail_place.tcl, and global_route.tcl, based on the USE_NEGOTIATION environment variable. The feedback suggests refactoring the repetitive if/else blocks to use the append_env_var helper function, which is more idiomatic for this repository and improves maintainability. Additionally, there are minor issues with indentation and trailing whitespace in the newly added code blocks that should be addressed.
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { | ||
| set result [catch { log_cmd detailed_placement -use_negotiation } msg] | ||
| } else { | ||
| set result [catch { log_cmd detailed_placement } msg] | ||
| } |
There was a problem hiding this comment.
The logic for conditionally adding the -use_negotiation flag is repeated multiple times across different scripts. Using the append_env_var helper to build an argument list is more idiomatic in this repository and improves maintainability by avoiding if/else duplication.
set dpl_args {}
append_env_var dpl_args USE_NEGOTIATION -use_negotiation 0
set result [catch { log_cmd detailed_placement {*}$dpl_args } msg]
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { | ||
| set result [catch { log_cmd detailed_placement -use_negotiation } msg] | ||
| } else { | ||
| set result [catch { log_cmd detailed_placement } msg] | ||
| } |
There was a problem hiding this comment.
This block has incorrect indentation; it should be aligned with the surrounding code inside the if { !$::env(SKIP_CTS_REPAIR_TIMING) } block. Additionally, using append_env_var would simplify the implementation and remove the trailing space on line 81.
set dpl_args {}
append_env_var dpl_args USE_NEGOTIATION -use_negotiation 0
set result [catch { log_cmd detailed_placement {*}$dpl_args } msg]
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { | ||
| log_cmd detailed_placement -use_negotiation {*}[env_var_or_empty DETAIL_PLACEMENT_ARGS] | ||
| } else { | ||
| log_cmd detailed_placement {*}[env_var_or_empty DETAIL_PLACEMENT_ARGS] | ||
| } |
There was a problem hiding this comment.
This logic can be simplified by using the append_env_var helper to build the argument list. This avoids duplicating the log_cmd call and handles the environment variable check more cleanly.
set dpl_args [env_var_or_empty DETAIL_PLACEMENT_ARGS]
append_env_var dpl_args USE_NEGOTIATION -use_negotiation 0
log_cmd detailed_placement {*}$dpl_args
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { | ||
| log_cmd detailed_placement -use_negotiation | ||
| } else { | ||
| log_cmd detailed_placement | ||
| } |
There was a problem hiding this comment.
Avoid duplicating the log_cmd detailed_placement call. You can use append_env_var to conditionally add the flag to an argument list, which is the standard pattern in these scripts and removes the trailing space on line 69.
set dpl_args {}
append_env_var dpl_args USE_NEGOTIATION -use_negotiation 0
log_cmd detailed_placement {*}$dpl_args
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { | ||
| log_cmd detailed_placement -use_negotiation | ||
| } else { | ||
| log_cmd detailed_placement | ||
| } |
There was a problem hiding this comment.
This logic is duplicated from earlier in the file. Refactoring to use append_env_var for building command arguments would improve consistency and maintainability while removing the trailing space on line 91.
set dpl_args {}
append_env_var dpl_args USE_NEGOTIATION -use_negotiation 0
log_cmd detailed_placement {*}$dpl_args
| -right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT) | ||
|
|
||
| set result [catch { log_cmd detailed_placement } msg] | ||
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { |
There was a problem hiding this comment.
$::env(USE_NEGOTIATION) suffices
| } | ||
|
|
||
| set result [catch { log_cmd detailed_placement } msg] | ||
| if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } { |
There was a problem hiding this comment.
Define/document USE_NEGOTIATION to variables.yaml
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Use environment variable for selecting between using new negotiation DPL or not.
The user can now do
make USE_NEGOTIATION=1instead of having the editing scripts.