Skip to content

dpl: easier setting for using negotiation legalizer#4147

Open
openroad-ci wants to merge 9 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-easy-use-negotiation
Open

dpl: easier setting for using negotiation legalizer#4147
openroad-ci wants to merge 9 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-easy-use-negotiation

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Use environment variable for selecting between using new negotiation DPL or not.

The user can now do make USE_NEGOTIATION=1 instead of having the editing scripts.

gudeh added 3 commits April 14, 2026 18:10
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread flow/scripts/cts.tcl Outdated
Comment on lines +49 to +53
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]
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gudeh I agree with this and the similar below.

Comment thread flow/scripts/cts.tcl Outdated
Comment on lines +77 to +81
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]
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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]

Comment thread flow/scripts/detail_place.tcl Outdated
Comment on lines +18 to +22
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]
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

Comment thread flow/scripts/global_route.tcl Outdated
Comment on lines +65 to +69
if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } {
log_cmd detailed_placement -use_negotiation
} else {
log_cmd detailed_placement
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

Comment thread flow/scripts/global_route.tcl Outdated
Comment on lines +87 to +91
if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } {
log_cmd detailed_placement -use_negotiation
} else {
log_cmd detailed_placement
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

@gudeh gudeh requested a review from maliberty April 14, 2026 23:32
Comment thread flow/scripts/cts.tcl Outdated
-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) } {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$::env(USE_NEGOTIATION) suffices

Comment thread flow/scripts/cts.tcl Outdated
}

set result [catch { log_cmd detailed_placement } msg]
if { [env_var_exists_and_non_empty USE_NEGOTIATION] && $::env(USE_NEGOTIATION) } {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define/document USE_NEGOTIATION to variables.yaml

gudeh added 5 commits April 15, 2026 10:24
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>
@gudeh gudeh requested a review from maliberty April 15, 2026 15:58
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh gudeh requested review from maliberty and removed request for maliberty April 15, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants