Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7ada09f
Read binary liberty files from a cache shared by all designs
eder-matheus Oct 21, 2026
510d23a
Store binary liberty files in one folder per platform
eder-matheus Oct 21, 2026
bebeeae
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
eder-matheus Oct 23, 2026
d41a3c7
use latest openroad
eder-matheus Oct 23, 2026
47cf4c8
Cache binary libs of the design's own libraries per run
eder-matheus Oct 23, 2026
fd5d8a2
Describe the binary liberty variables as the cache now works
eder-matheus Oct 23, 2026
b59119d
Report the most recently written log as the last log
eder-matheus Oct 23, 2026
95f03da
Drop USE_BINARY_LIBS and read libraries without a usable .blib as given
eder-matheus Oct 23, 2026
2b55caa
Merge remote-tracking branch 'origin/master' into secure-blib_shared_…
eder-matheus Oct 26, 2026
22c6307
Keep the OpenROAD version master pins
eder-matheus Oct 26, 2026
56f8167
Keep the .blib cache in objects/ and convert only when a library changes
eder-matheus Oct 26, 2026
a01e937
Read the libraries without checking that they exist, as the Tcl contr…
eder-matheus Oct 26, 2026
baf96ed
use latest openroad
eder-matheus Oct 27, 2026
8c0a9b8
Stop the run when a .blib can't be written, and retry it on the next …
eder-matheus Oct 27, 2026
4850570
Convert the libraries again when a corner library changes
eder-matheus Oct 27, 2026
38b1fcb
update OR submodule
jfgava Nov 4, 2026
2485922
Merge branch 'master' of github.com:The-OpenROAD-Project-private/Open…
jfgava Nov 4, 2026
b9690c2
Keep the OpenROAD version master pins
jfgava Nov 4, 2026
03fe077
Merge branch 'master' of github.com:The-OpenROAD-Project-private/Open…
jfgava Nov 4, 2026
892ef05
Convert the libraries again after clean_all or clean_binary_libs
jfgava Nov 5, 2026
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
29 changes: 29 additions & 0 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,34 @@ $(RESULTS_DIR)/1_1_yosys_canonicalize.rtlil: $(RESULTS_DIR)/memories.json
$(OBJECTS_DIR)/klayout.lyt: $(RESULTS_DIR)/memories.json
endif

# OpenROAD stages read binary liberty (.blib) files from a cache shared by
# all designs in $(WORK_HOME)/objects/binary_libs, see
# scripts/write_binary_libs.tcl. Yosys reads the text libraries.
.PHONY: binary-libs
binary-libs:
$(UNSET_AND_MAKE) do-binary-libs

.PHONY: do-binary-libs
do-binary-libs:
@mkdir -p $(LOG_DIR)
$(RUN_CMD) --log $(abspath $(LOG_DIR)/write_binary_libs.tmp.log) --tee -- $(OPENROAD_CMD) $(SCRIPTS_DIR)/write_binary_libs.tcl
mv $(LOG_DIR)/write_binary_libs.tmp.log $(LOG_DIR)/write_binary_libs.log

# do-binary-libs renames its log into place only when it succeeds, so a
# failed conversion runs again. clean_all and clean_binary_libs delete the
# log with the cache it records, so the next make fills the cache again.
$(LOG_DIR)/write_binary_libs.log: $(LIB_FILES) \
$(foreach corner,$(shell echo $(CORNERS) | tr '[:lower:]' '[:upper:]'),$($(corner)_LIB_FILES))
$(UNSET_AND_MAKE) do-binary-libs

# Order-only, so converting never reruns the flow.
$(RESULTS_DIR)/1_synth.odb: | $(LOG_DIR)/write_binary_libs.log

.PHONY: clean_binary_libs
clean_binary_libs:
rm -rf $(WORK_HOME)/objects/binary_libs
rm -f $(LOG_DIR)/write_binary_libs.log

.PHONY: do-yosys
do-yosys: yosys-dependencies
$(SCRIPTS_DIR)/synth.sh $(SYNTH_SCRIPT) $(LOG_DIR)/1_2_yosys.log
Expand Down Expand Up @@ -852,6 +880,7 @@ clean:
.PHONY: clean_all
clean_all: clean_synth clean_floorplan clean_place clean_cts clean_route clean_finish clean_metadata clean_abstract
rm -rf $(OBJECTS_DIR)
rm -f $(LOG_DIR)/write_binary_libs*.log

.PHONY: nuke
nuke: clean_test clean_issues
Expand Down
4 changes: 2 additions & 2 deletions flow/scripts/read_liberty.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ if { [env_var_exists_and_non_empty CORNERS] } {
foreach corner $::env(CORNERS) {
set LIBKEY "[string toupper $corner]_LIB_FILES"
foreach libFile $::env($LIBKEY) {
log_cmd read_liberty -corner $corner $libFile
log_cmd read_liberty -corner $corner [lib_file_to_read $libFile]
}
unset LIBKEY
}
unset corner
} else {
## no corner
foreach libFile $::env(LIB_FILES) {
log_cmd read_liberty $libFile
log_cmd read_liberty [lib_file_to_read $libFile]
}
}

Expand Down
43 changes: 43 additions & 0 deletions flow/scripts/util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,46 @@ proc synth_verilog_files { } {
}
return $copies
}

# Entry of lib_file in the binary liberty (.blib) cache shared by all designs:
# objects/binary_libs/<platform>/<library>@<size>-<mtime>-<dirhash>.blib, so a
# changed library gets a new entry and same-named libraries from different
# directories don't collide. Libraries in the design's directory and those the
# flow generates are cached per run.
proc binary_lib_path { lib_file } {
set source [file normalize $lib_file]
set objects [file join $::env(WORK_HOME) objects]
set root [file join $objects binary_libs $::env(PLATFORM)]
set run_dirs [list $::env(DESIGN_DIR) $objects [file join $::env(WORK_HOME) results]]
foreach dir $run_dirs {
if { [string first "[file normalize $dir]/" $source] == 0 } {
set root [file join $::env(OBJECTS_DIR) binary_libs]
break
}
}
set name [file tail $source]
regsub {\.gz$} $name "" name
set name [file rootname $name]
set dir_hash [format %08x [zlib crc32 [file dirname $source] 0]]
return [file join $root "$name@[file size $source]-[file mtime $source]-$dir_hash.blib"]
}

# Whether this OpenROAD reads blib. An entry missing or written by another
# version is expected, so its error is not reported.
proc binary_lib_usable { blib } {
suppress_message STA 1900
suppress_message STA 1902
set usable [expr { ![catch { liberty_binary_info $blib }] }]
unsuppress_message STA 1900
unsuppress_message STA 1902
return $usable
}

# The cached .blib for lib_file, or lib_file when there is no usable .blib
proc lib_file_to_read { lib_file } {
set blib [binary_lib_path $lib_file]
if { [binary_lib_usable $blib] } {
return $blib
}
return $lib_file
}
40 changes: 40 additions & 0 deletions flow/scripts/write_binary_libs.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Fill the binary liberty (.blib) cache with the libraries the OpenROAD stages read
source $::env(SCRIPTS_DIR)/util.tcl

set lib_files {}
if { [env_var_exists_and_non_empty CORNERS] } {
foreach corner $::env(CORNERS) {
lappend lib_files {*}$::env([string toupper $corner]_LIB_FILES)
}
} else {
lappend lib_files {*}$::env(LIB_FILES)
}

set written 0
set cached 0
array set seen {}
foreach lib_file $lib_files {
set blib [binary_lib_path $lib_file]
if { [info exists seen($blib)] } {
continue
}
set seen($blib) 1
if { [binary_lib_usable $blib] } {
incr cached
continue
}
# Publish with a rename, so concurrent flows never read a partial file
set tmp "$blib.tmp.[info hostname].[pid]"
if {
[catch {
file mkdir [file dirname $blib]
log_cmd write_liberty_binary $lib_file $tmp
file rename -force $tmp $blib
} msg]
} {
file delete -force $tmp
error "Could not write $blib: $msg"
}
incr written
}
puts "Binary liberty files: $written written, $cached already cached"
8 changes: 5 additions & 3 deletions flow/util/genReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,15 @@ def write_summary():
# check if design ran to completion without errors or warnings
d["log_errors"] = list()
d["log_warnings"] = list()
d["last_log"] = ""
d["last_log"] = max(
(name for name in files if name.endswith(".log")),
key=lambda name: os.path.getmtime(os.path.join(log_dir, name)),
default="",
)
for name_ in sorted(files):
temp_e, temp_w = parse_messages(os.path.join(log_dir, name_))
d["log_errors"] += temp_e
d["log_warnings"] += temp_w
if name_.endswith(".log"):
d["last_log"] = name_
d["finished"] = any(name in files for name in LAST_EXPECTED_LOG)

# check if metrics generation had issues
Expand Down