Skip to content

Commit

Permalink
Merge pull request #2537 from Pinata-Consulting/synth-stats-naming
Browse files Browse the repository at this point in the history
synthesis: simpler more consistent naming for gathering statistics
  • Loading branch information
maliberty authored Oct 31, 2024
2 parents 38b66e0 + 08a8f86 commit f4e241a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 5 additions & 5 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ include $(PLATFORM_DIR)/config.mk
# Enables hierarchical yosys
export SYNTH_HIERARCHICAL ?= 0
export SYNTH_STATS = $(RESULTS_DIR)/synth_stats.txt
export HIER_REPORT_SCRIPT = $(SCRIPTS_DIR)/synth_hier_report.tcl
export SYNTH_STATS_SCRIPT = $(SCRIPTS_DIR)/synth_stats.tcl
export MAX_UNGROUP_SIZE ?= 0

# Enables Re-synthesis for area reclaim
Expand Down Expand Up @@ -475,11 +475,11 @@ memory:
export SYNTH_SCRIPT ?= $(SCRIPTS_DIR)/synth.tcl
export SYNTH_MEMORY_MAX_BITS ?= 4096

.PHONY: do-yosys-keep-hierarchy
do-yosys-keep-hierarchy:
.PHONY: do-yosys-stats
do-yosys-stats:
mkdir -p $(RESULTS_DIR) $(LOG_DIR) $(REPORTS_DIR)
(export VERILOG_FILES=$(RESULTS_DIR)/1_synth.rtlil; \
$(TIME_CMD) $(YOSYS_EXE) $(YOSYS_FLAGS) -c $(HIER_REPORT_SCRIPT)) 2>&1 | tee $(abspath $(LOG_DIR)/1_1_yosys_hier_report.log)
$(TIME_CMD) $(YOSYS_EXE) $(YOSYS_FLAGS) -c $(SYNTH_STATS_SCRIPT)) 2>&1 | tee $(abspath $(LOG_DIR)/1_1_yosys_stats.log)

export SDC_FILE_CLOCK_PERIOD = $(RESULTS_DIR)/clock_period.txt

Expand Down Expand Up @@ -507,7 +507,7 @@ $(RESULTS_DIR)/1_synth.rtlil: $(YOSYS_DEPENDENCIES)
$(UNSET_AND_MAKE) do-yosys-canonicalize

$(RESULTS_DIR)/1_1_yosys.v: $(RESULTS_DIR)/1_synth.rtlil
$(UNSET_AND_MAKE) do-yosys-keep-hierarchy do-yosys
$(UNSET_AND_MAKE) do-yosys-stats do-yosys

.PHONY: do-synth
do-synth:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Gather statistics, if needed. Gathering the statistics is
# time consuming, because it requires a full synthesis run.
#
# The statistics is needed for SYNTH_HIERARCHICAL=1 flattening/keep
# module policy, and write to $::env(SYNTH_STATS)
source $::env(SCRIPTS_DIR)/util.tcl

proc write_keep_hierarchy {} {
Expand Down Expand Up @@ -51,8 +56,8 @@ proc write_keep_hierarchy {} {

set areas {}
foreach module $module_list {
tee -o $::env(OBJECTS_DIR)/synth_hier_stat_temp_module.txt stat -top "$module" {*}$stat_libs
set fptr1 [open $::env(OBJECTS_DIR)/synth_hier_stat_temp_module.txt r]
tee -o $::env(OBJECTS_DIR)/synth_stat_temp_module.txt stat -top "$module" {*}$stat_libs
set fptr1 [open $::env(OBJECTS_DIR)/synth_stat_temp_module.txt r]
set contents1 [read -nonewline $fptr1]
close $fptr1
set split_cont1 [split $contents1 "\n"]
Expand All @@ -61,7 +66,7 @@ proc write_keep_hierarchy {} {
lappend areas "$area $module_name"
}
}
file delete -force $::env(OBJECTS_DIR)/synth_hier_stat_temp_module.txt
file delete -force $::env(OBJECTS_DIR)/synth_stat_temp_module.txt
}
set areas [lsort -index 0 -real $areas]

Expand Down

0 comments on commit f4e241a

Please sign in to comment.