diff --git a/docs/tutorials/FlowTutorial.md b/docs/tutorials/FlowTutorial.md index b212df6f94..18e37fa285 100644 --- a/docs/tutorials/FlowTutorial.md +++ b/docs/tutorials/FlowTutorial.md @@ -306,26 +306,28 @@ abc.constr klayout.lyt klayout_tech.lef lib Reports directory, which contains congestion report, DRC report, design statistics and antenna log for reference. -| `reports` | | | -|-------------------|---------------------|------------------------| -| `congestion.rpt` | `VDD.rpt` | `VSS.rpt` | -| `5_route_drc.rpt` | `final_clocks.webp` | `final_placement.webp` | -| `antenna.log` | `final_clocks.webp` | `final.webp` | -| `synth_stat.txt` | `synth_check.txt` | `final_resizer.webp` | - -The table below briefly describes the reports directory files. - -| File Name | Description | -|------------------------|----------------------------------------------------------| -| `congestion.rpt` | Global routing congestion if occurred. | -| `5_route_drc.rpt` | DRC violations if occurred. | -| `final_clocks.webp` | OR extracted image reference after clock tree synthesis. | -| `final_resizer.webp` | OR extracted image reference after resizer. | -| `synth_check.txt` | Synthesis warning/error messages. | -| `antenna.log` | Antenna check log report. | -| `final_placement.webp` | Extracted image after final placement. | -| `final.webp` | Extracted image after routing. | -| `synth_stat.txt` | Post synthesis design statistics log saved here. | +| `reports` | | | +|-------------------|--------------------|-----------------------| +| `congestion.rpt` | `VDD.rpt` | `VSS.rpt` | +| `5_route_drc.rpt` | `final_clocks.png` | `final_placement.png` | +| `antenna.log` | `final_all.png` | `final_routing.png` | +| `synth_stat.txt` | `synth_check.txt` | `final_resizer.png` | + +The table below briefly describes the reports directory files. The images +are `.webp` instead when `SAVE_IMAGES_VIEWER=qt`. + +| File Name | Description | +|-----------------------|----------------------------------------------------------| +| `congestion.rpt` | Global routing congestion if occurred. | +| `5_route_drc.rpt` | DRC violations if occurred. | +| `final_clocks.png` | OR extracted image reference after clock tree synthesis. | +| `final_resizer.png` | OR extracted image reference after resizer. | +| `synth_check.txt` | Synthesis warning/error messages. | +| `antenna.log` | Antenna check log report. | +| `final_placement.png` | Extracted image after final placement. | +| `final_all.png` | Extracted image after routing with power/ground nets. | +| `final_routing.png` | Extracted image after routing. | +| `synth_stat.txt` | Post synthesis design statistics log saved here. | The flow completes with the message below by creating a merged final GDS file. diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index 4d44b0b25b..0084e69df8 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -272,6 +272,7 @@ configuration file. | RTLMP_WIRELENGTH_WT| Weight for half-perimiter wirelength.| 100.0| | RUN_LOG_NAME_STEM| Stem of the log file name, the log file will be named `$(LOG_DIR)/$(RUN_LOG_NAME_STEM).log`.| run| | RUN_SCRIPT| Path to script to run from `make run`, python or tcl script detected by .py or .tcl extension.| | +| 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.| web| | SC_LEF| Path to technology standard cell LEF file.| | | SDC_FILE| The path to design constraint (SDC) file.| | | SEAL_GDS| Seal macro to place around the design.| | @@ -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) diff --git a/flow/designs/nangate45/gcd/config.mk b/flow/designs/nangate45/gcd/config.mk index 76cca1b8bc..ab6bdb3f06 100644 --- a/flow/designs/nangate45/gcd/config.mk +++ b/flow/designs/nangate45/gcd/config.mk @@ -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 ?= qt + # This needs a smaller pitch to accomodate a small block export PDN_TCL ?= $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NAME)/grid_strategy-M1-M4-M7.tcl diff --git a/flow/scripts/final_outputs.tcl b/flow/scripts/final_outputs.tcl index 520b9d0374..daca878dbc 100644 --- a/flow/scripts/final_outputs.tcl +++ b/flow/scripts/final_outputs.tcl @@ -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 } diff --git a/flow/scripts/save_images.tcl b/flow/scripts/save_images.tcl index 2f6c06d17b..e1505016c5 100644 --- a/flow/scripts/save_images.tcl +++ b/flow/scripts/save_images.tcl @@ -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 +} + gui::save_display_controls set height [[[ord::get_db_block] getBBox] getDY] @@ -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 } @@ -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" @@ -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 } } } @@ -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 @@ -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 @@ -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 diff --git a/flow/scripts/variables.json b/flow/scripts/variables.json index cb678fa68e..b7bff91dad 100644 --- a/flow/scripts/variables.json +++ b/flow/scripts/variables.json @@ -1124,6 +1124,13 @@ "RUN_SCRIPT": { "description": "Path to script to run from `make run`, python or tcl script detected by .py or .tcl extension.\n" }, + "SAVE_IMAGES_VIEWER": { + "default": "web", + "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.\n", + "stages": [ + "final" + ] + }, "SC_LEF": { "description": "Path to technology standard cell LEF file.\n" }, diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index 62a5bcf355..8bae3d8795 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -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: web + stages: + - final FILL_CELLS: description: > Fill cells are used to fill empty sites. If not set or empty, fill cell diff --git a/flow/util/genReportTable.py b/flow/util/genReportTable.py index f5f8b0b801..a241afc02d 100755 --- a/flow/util/genReportTable.py +++ b/flow/util/genReportTable.py @@ -120,12 +120,21 @@ def image_view_name(file): def collect_images(): """Map design -> platform -> view -> image path, relative to reports/.""" images = defaultdict(lambda: defaultdict(dict)) + # A view saved as both .webp and .png (SAVE_IMAGES_VIEWER changed between + # runs) shows the newer one. + mtimes = {} for parents, dirs, files in sorted(os.walk("reports", topdown=False)): for file in files: if file.lower().endswith(IMAGE_EXTENSIONS): + mtime = os.path.getmtime(os.path.join(parents, file)) path = os.path.join(parents, file).replace("reports", ".") platform, design = path.split(os.sep)[1:3] - images[design][platform][image_view_name(file)] = path + view = image_view_name(file) + key = (design, platform, view) + if key in mtimes and mtimes[key] >= mtime: + continue + mtimes[key] = mtime + images[design][platform][view] = path return images