Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/user/FlowVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ configuration file.
| <a name="RTLMP_WIRELENGTH_WT"></a>RTLMP_WIRELENGTH_WT| Weight for half-perimiter wirelength.| 100.0|
| <a name="RUN_LOG_NAME_STEM"></a>RUN_LOG_NAME_STEM| Stem of the log file name, the log file will be named `$(LOG_DIR)/$(RUN_LOG_NAME_STEM).log`.| run|
| <a name="RUN_SCRIPT"></a>RUN_SCRIPT| Path to script to run from `make run`, python or tcl script detected by .py or .tcl extension.| |
| <a name="SAVE_IMAGES_VIEWER"></a>SAVE_IMAGES_VIEWER| Which viewer draws the images of the final report: qt for the Qt GUI in an offscreen window, or web for the web viewer, which needs no display. OpenROAD built without Qt always uses the web viewer.| qt|
| <a name="SC_LEF"></a>SC_LEF| Path to technology standard cell LEF file.| |
| <a name="SDC_FILE"></a>SDC_FILE| The path to design constraint (SDC) file.| |
| <a name="SEAL_GDS"></a>SEAL_GDS| Seal macro to place around the design.| |
Expand Down Expand Up @@ -624,6 +625,7 @@ configuration file.
- [REPORT_CLOCK_SKEW](#REPORT_CLOCK_SKEW)
- [REPORT_ENDPOINT_SLACK](#REPORT_ENDPOINT_SLACK)
- [ROUTING_LAYER_ADJUSTMENT](#ROUTING_LAYER_ADJUSTMENT)
- [SAVE_IMAGES_VIEWER](#SAVE_IMAGES_VIEWER)
- [SEC_CHECK](#SEC_CHECK)
- [SKIP_DETAILED_ROUTE](#SKIP_DETAILED_ROUTE)
- [SKIP_REPORT_METRICS](#SKIP_REPORT_METRICS)
Expand Down
3 changes: 3 additions & 0 deletions flow/designs/nangate45/gcd/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ export TNS_END_PERCENT = 100
export GPL_PLACE_IOS = 1
export SYNTH_REPEATABLE_BUILD ?= 1

# CI runs the non-default image viewer on this design.
export SAVE_IMAGES_VIEWER ?= web

# This needs a smaller pitch to accomodate a small block
export PDN_TCL ?= $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NAME)/grid_strategy-M1-M4-M7.tcl
11 changes: 9 additions & 2 deletions flow/scripts/final_outputs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ report_metrics 6 "finish"

source_step_tcl POST FINAL_REPORT

# Save a final image if openroad is compiled with the gui
if { [ord::openroad_gui_compiled] } {
# Save the final images: in a Qt window already open, in an offscreen one, or
# with the web viewer, which OpenROAD built without Qt always uses.
set images_viewer $::env(SAVE_IMAGES_VIEWER)
if { $images_viewer ni {qt web} } {
utl::error FLW 34 "SAVE_IMAGES_VIEWER must be qt or web, not $images_viewer."
}
if { $images_viewer eq "web" || ![ord::openroad_gui_compiled] || [gui::has_ui] } {
source $::env(SCRIPTS_DIR)/save_images.tcl
} else {
gui::show "source $::env(SCRIPTS_DIR)/save_images.tcl" false
}
31 changes: 20 additions & 11 deletions flow/scripts/save_images.tcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
source $::env(SCRIPTS_DIR)/util.tcl

# With no Qt window up, the web viewer draws the images; it writes only PNG.
if { [gui::has_ui] } {
set web_flag {}
set ext webp
} else {
set web_flag -web
set ext png
}
Comment on lines +4 to +10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

When OpenROAD is compiled without GUI support ([ord::openroad_gui_compiled] is false), the gui namespace and its commands (like gui::has_ui) do not exist. Calling [gui::has_ui] directly will cause a Tcl error and crash the flow. Additionally, other GUI/Widget-specific commands like get_scenes, save_clocktree_image, and various gui:: commands will be missing and cause crashes.\n\nTo prevent this, we should check [ord::openroad_gui_compiled] first and safely stub the missing GUI and widget commands when running without a UI.

set has_ui 0
if { [ord::openroad_gui_compiled] } {
  if { [gui::has_ui] } {
    set has_ui 1
  }
}

if { $has_ui } {
  set web_flag {}
  set ext webp
} else {
  set web_flag -web
  set ext png

  # Stub GUI/Widget commands that are not available without UI
  if { [info commands save_image] eq "" } {
    proc save_image {args} {}
  }
  if { [info commands get_scenes] eq "" } {
    proc get_scenes {} { return {} }
  }
  if { [info commands save_clocktree_image] eq "" } {
    proc save_clocktree_image {args} {}
  }
  if { ![namespace exists ::gui] } {
    namespace eval ::gui {}
  }
  foreach cmd {
    save_display_controls restore_display_controls set_display_controls
    clear_highlights clear_selections fit show_worst_path set_heatmap
    show_widget hide_widget select_clockviewer_clock select_marker_category
  } {
    if { [info commands ::gui::$cmd] eq "" } {
      proc ::gui::$cmd {args} {}
    }
  }
}


gui::save_display_controls

set height [[[ord::get_db_block] getBBox] getDY]
Expand Down Expand Up @@ -30,22 +39,22 @@ gui::set_display_controls "Misc/Highlight selected" visible true
gui::set_display_controls "Misc/Detailed view" visible true

# The routing view
save_image -resolution $resolution $::env(REPORTS_DIR)/final_all.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_all.$ext
gui::set_display_controls "Nets/Power" visible false
gui::set_display_controls "Nets/Ground" visible false
save_image -resolution $resolution $::env(REPORTS_DIR)/final_routing.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_routing.$ext

# The placement view without routing
gui::set_display_controls "Shape Types/Routing/*" visible false
gui::set_display_controls "Instances/Physical/Fill cell" visible false
gui::set_display_controls "Misc/Instances/*" visible false
save_image -resolution $resolution $::env(REPORTS_DIR)/final_placement.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_placement.$ext

if { [env_var_exists_and_non_empty PWR_NETS_VOLTAGES] } {
gui::set_display_controls "Heat Maps/IR Drop" visible true
gui::set_heatmap IRDrop Layer $::env(IR_DROP_LAYER)
gui::set_heatmap IRDrop ShowLegend 1
save_image -resolution $resolution $::env(REPORTS_DIR)/final_ir_drop.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_ir_drop.$ext
gui::set_display_controls "Heat Maps/IR Drop" visible false
}

Expand All @@ -58,7 +67,7 @@ gui::set_display_controls "Instances/StdCells/Clock tree/*" visible true
gui::set_display_controls "Instances/StdCells/Sequential" visible true
gui::set_display_controls "Instances/Macro" visible true
select -name "clk*" -type Inst
save_image -resolution $resolution $::env(REPORTS_DIR)/final_clocks.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_clocks.$ext
gui::clear_selections

gui::show_widget "Clock Tree Viewer"
Expand All @@ -70,10 +79,10 @@ foreach scene [get_scenes] {
save_clocktree_image -clock $clock_name \
-width 1024 -height 1024 \
-scene $scene \
$::env(REPORTS_DIR)/cts_${scene_name}_${clock_name}.webp
$::env(REPORTS_DIR)/cts_${scene_name}_${clock_name}.$ext
gui::select_clockviewer_clock $clock_name
save_image -resolution $resolution \
$::env(REPORTS_DIR)/cts_${scene_name}_${clock_name}_layout.webp
save_image {*}$web_flag -resolution $resolution \
$::env(REPORTS_DIR)/cts_${scene_name}_${clock_name}_layout.$ext
}
}
}
Expand All @@ -98,7 +107,7 @@ select -name "wire*" -type Inst -highlight 3
select -name "rebuffer*" -type Inst -highlight 4 ;# red
select -name "split*" -type Inst -highlight 5 ;# dark green

save_image -resolution $resolution $::env(REPORTS_DIR)/final_resizer.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_resizer.$ext

gui::clear_highlights -1
gui::clear_selections
Expand All @@ -109,7 +118,7 @@ gui::set_display_controls "Instances/Physical/*" visible false
gui::set_display_controls "Nets/*" visible false
gui::set_display_controls "Heat Maps/Routing Congestion" visible true

save_image -resolution $resolution $::env(REPORTS_DIR)/final_congestion.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_congestion.$ext

# The worst timing path view
gui::set_display_controls "Heat Maps/Routing Congestion" visible false
Expand All @@ -119,7 +128,7 @@ gui::set_display_controls "Instances/*" visible true
gui::set_display_controls "Shape Types/Routing/*" visible false

gui::show_worst_path
save_image -resolution $resolution $::env(REPORTS_DIR)/final_worst_path.webp
save_image {*}$web_flag -resolution $resolution $::env(REPORTS_DIR)/final_worst_path.$ext
gui::set_display_controls "Timing Path/*" visible false

gui::restore_display_controls
7 changes: 7 additions & 0 deletions flow/scripts/variables.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flow/scripts/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,14 @@ GUI_TIMING:
quite time consuming. Useful to disable when investigating non-timing
aspects like floorplan, placement, routing, etc.
default: 1
SAVE_IMAGES_VIEWER:
description: >
Which viewer draws the images of the final report: qt for the Qt GUI in
an offscreen window, or web for the web viewer, which needs no display.
OpenROAD built without Qt always uses the web viewer.
default: qt
stages:
- final
FILL_CELLS:
description: >
Fill cells are used to fill empty sites. If not set or empty, fill cell
Expand Down