diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index ab445ebd9b..e2ea5ae6ee 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -74,7 +74,10 @@ proc recover_power_helper { } { } proc extract_stage { input_file } { - if { ![regexp {/([0-9])_(([0-9])_)?} $input_file match num1 _ num2] } { + # Match the stage prefix on the basename, not the full path: an ancestor + # dir like ".../4_something/3_place.odb" would otherwise match "4_" -> stage 4. + set stage_file [file tail $input_file] + if { ![regexp {^([0-9])_(?:([0-9])_)?} $stage_file match num1 num2] } { puts "Error: Could not determine design stage from $input_file" exit 1 }