From eddefa79eefa16bb675513dfe06a7b1464e9c7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 2 Apr 2026 06:42:31 +0200 Subject: [PATCH 1/3] fix: use stat -hierarchy for hierarchical synth to report area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When SYNTH_HIERARCHICAL=1, the yosys stat command reports zero area for the top module because all cells are in submodules. Adding -hierarchy makes stat include submodule area, so synth__design__instance__area__stdcell is no longer N/A. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Øyvind Harboe --- flow/scripts/synth.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flow/scripts/synth.tcl b/flow/scripts/synth.tcl index 8554f6d61c..bc1a4db0d1 100644 --- a/flow/scripts/synth.tcl +++ b/flow/scripts/synth.tcl @@ -226,7 +226,11 @@ if { $::env(SYNTH_INSBUF) } { # Reports tee -o $::env(REPORTS_DIR)/synth_check.txt check -tee -o $::env(REPORTS_DIR)/synth_stat.txt stat {*}$lib_args +if { $::env(SYNTH_HIERARCHICAL) } { + tee -o $::env(REPORTS_DIR)/synth_stat.txt stat -hierarchy {*}$lib_args +} else { + tee -o $::env(REPORTS_DIR)/synth_stat.txt stat {*}$lib_args +} # check the design is composed exclusively of target cells, and # check for other problems From 658cd90905d39cb94d6b852788db0774873e636a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Tue, 7 Apr 2026 21:37:42 +0200 Subject: [PATCH 2/3] fix: always use stat -hierarchy for synth area reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no harm in always using -hierarchy flag. It reports the same results for flat designs and correctly includes submodule area for hierarchical designs. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Øyvind Harboe --- flow/scripts/synth.tcl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/flow/scripts/synth.tcl b/flow/scripts/synth.tcl index bc1a4db0d1..6d444a7174 100644 --- a/flow/scripts/synth.tcl +++ b/flow/scripts/synth.tcl @@ -226,11 +226,7 @@ if { $::env(SYNTH_INSBUF) } { # Reports tee -o $::env(REPORTS_DIR)/synth_check.txt check -if { $::env(SYNTH_HIERARCHICAL) } { - tee -o $::env(REPORTS_DIR)/synth_stat.txt stat -hierarchy {*}$lib_args -} else { - tee -o $::env(REPORTS_DIR)/synth_stat.txt stat {*}$lib_args -} +tee -o $::env(REPORTS_DIR)/synth_stat.txt stat -hierarchy {*}$lib_args # check the design is composed exclusively of target cells, and # check for other problems From 4561e853fc184d1f11b459112d1b153ac081a521 Mon Sep 17 00:00:00 2001 From: Matt Liberty Date: Mon, 13 Apr 2026 22:05:19 +0000 Subject: [PATCH 3/3] Adjust regex for synth__design__instance__count__stdcell for -hierarchical Signed-off-by: Matt Liberty --- flow/util/genMetrics.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flow/util/genMetrics.py b/flow/util/genMetrics.py index 536bfeb4fb..937b2fb0f7 100755 --- a/flow/util/genMetrics.py +++ b/flow/util/genMetrics.py @@ -228,11 +228,12 @@ def extract_metrics( # Synthesis # ========================================================================= - # The new format (>= 0.57) is: cells + # The new format (>= 0.57) with -hierarchy is: + # cells extractTagFromFile( "synth__design__instance__count__stdcell", metrics_dict, - "^\\s+(\\d+)\\s+[-0-9.]+\\s+cells$", + "^\\s+(\\d+)\\s+[-0-9.]+\\s+\\S+\\s+\\S+\\s+cells$", rptPath + "/synth_stat.txt", )