Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 4 additions & 0 deletions docs/user/FlowVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ configuration file.
| <a name="ASAP7_USE_VT"></a>ASAP7_USE_VT| A space separated list of VT options to use with the ASAP7 standard cell library: RVT, LVT, SLVT.| RVT|
| <a name="AUTO_MEMORIES"></a>AUTO_MEMORIES| Experimental. When set to 1, memories that yosys infers in the RTL (`$mem_v2` cells, module boundary only) are detected pre-synthesis, inventoried in `$(RESULTS_DIR)/memories.json`, and — when idiomatic as an SRAM macro — given generated .lib/.lef views under `$(RESULTS_DIR)/memories/`. Synthesis blackboxes those modules and all later stages read the generated views, so an existing design gets macro-based results without a memory compiler. Supported for the asap7 platform only. See docs/user/AutoMemories.md.| 0|
| <a name="BALANCE_ROWS"></a>BALANCE_ROWS| Balance rows during placement.| 0|
| <a name="BINARY_LIBS_DIR"></a>BINARY_LIBS_DIR| Directory of the binary liberty (.blib) cache shared by the designs of each platform, as `<platform>/<library>@<size>-<mtime>-<dirhash>.blib` so that a changed library gets a new entry. Libraries in DESIGN_DIR and libraries the flow generates are cached per run in `$(OBJECTS_DIR)/binary_libs` instead. Set it in the environment or settings.mk, not in a design's config.mk; ORFS clones that set the same directory share their .blib files. `make clean_binary_libs` deletes it.| $(WORK_HOME)/objects/binary_libs|
| <a name="BLOCKS"></a>BLOCKS| Blocks used as hard macros in a hierarchical flow. Do note that you have to specify block-specific inputs file in the directory mentioned by Makefile.| |
| <a name="BUFFER_PORTS_ARGS"></a>BUFFER_PORTS_ARGS| Specify arguments to the buffer_ports call during placement. Only used if DONT_BUFFER_PORTS=0.| |
| <a name="CACHED_REPORTS"></a>CACHED_REPORTS| List of pre-existing report files to copy into the reports directory before synthesis. Used when reusing prior synthesis results with SYNTH_NETLIST_FILES.| |
Expand Down Expand Up @@ -327,6 +328,7 @@ configuration file.
| <a name="TIE_SEPARATION"></a>TIE_SEPARATION| Distance separating tie high/low instances from the load.| 0|
| <a name="TNS_END_PERCENT"></a>TNS_END_PERCENT| Default TNS_END_PERCENT value for post CTS timing repair. Try fixing all violating endpoints by default (reduce to 5% for runtime). Specifies how many percent of violating paths to fix [0-100]. Worst path will always be fixed.| 100|
| <a name="UNSET_ABC9_BOX_CELLS"></a>UNSET_ABC9_BOX_CELLS| List of cells to unset the abc9_box attribute on| |
| <a name="USE_BINARY_LIBS"></a>USE_BINARY_LIBS| Read binary liberty (.blib) files in the OpenROAD stages instead of parsing the text libraries. Before 1_synth the flow converts every library that has no cached .blib, which `make binary-libs` also does on its own. A missing or unusable .blib is read from the text library with a warning. Set to 0 to read LIB_FILES and `<CORNER>_LIB_FILES` as given, for example when bazel-orfs provides binary libraries itself.| 1|
| <a name="USE_FILL"></a>USE_FILL| Whether to perform metal density filling.| 0|
| <a name="VERILOG_DEFINES"></a>VERILOG_DEFINES| Preprocessor defines passed to the language frontend. Example: `-D HPDCACHE_ASSERT_OFF`| |
| <a name="VERILOG_FILES"></a>VERILOG_FILES| The path to the design Verilog/SystemVerilog files providing a description of modules.| |
Expand Down Expand Up @@ -631,12 +633,14 @@ configuration file.
## All stages variables

- [ASAP7_USE_VT](#ASAP7_USE_VT)
- [BINARY_LIBS_DIR](#BINARY_LIBS_DIR)
- [CORNERS](#CORNERS)
- [KEEP_VARS](#KEEP_VARS)
- [NUM_CORES](#NUM_CORES)
- [OPENROAD_HIERARCHICAL](#OPENROAD_HIERARCHICAL)
- [SWAP_ARITH_OPERATORS](#SWAP_ARITH_OPERATORS)
- [SYNTH_WRAPPED_OPERATORS](#SYNTH_WRAPPED_OPERATORS)
- [USE_BINARY_LIBS](#USE_BINARY_LIBS)
- [WRITE_ODB_AND_SDC_EACH_STAGE](#WRITE_ODB_AND_SDC_EACH_STAGE)

## generate_abstract variables
Expand Down
17 changes: 17 additions & 0 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,23 @@ $(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, see scripts/write_binary_libs.tcl. Yosys reads the text libraries.
ifeq ($(USE_BINARY_LIBS),1)
.PHONY: binary-libs do-binary-libs
binary-libs: do-binary-libs
do-binary-libs:
@mkdir -p $(LOG_DIR)
$(RUN_CMD) --log $(abspath $(LOG_DIR)/write_binary_libs.log) --tee -- $(OPENROAD_CMD) $(SCRIPTS_DIR)/write_binary_libs.tcl

# Order-only, so filling the cache never reruns the flow.
$(RESULTS_DIR)/1_synth.odb: | do-binary-libs
endif

.PHONY: clean_binary_libs
clean_binary_libs:
rm -rf $(if $(strip $(BINARY_LIBS_DIR)),$(BINARY_LIBS_DIR),$(error BINARY_LIBS_DIR is empty))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If BINARY_LIBS_DIR contains spaces, the rm -rf command will undergo word splitting, potentially leading to accidental deletion of unintended files or directories. Quoting the expanded path prevents this issue.

	rm -rf "$(if $(strip $(BINARY_LIBS_DIR)),$(BINARY_LIBS_DIR),$(error BINARY_LIBS_DIR is empty))"


.PHONY: do-yosys
do-yosys: yosys-dependencies
$(SCRIPTS_DIR)/synth.sh $(SYNTH_SCRIPT) $(LOG_DIR)/1_2_yosys.log
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 @@ -468,3 +468,46 @@ proc source_step_tcl { hook_type step_name } {
set env_var "${hook_type}_${step_name}_TCL"
source_env_var_if_exists $env_var
}

# Entry of lib_file in the binary liberty (.blib) cache:
# <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 root [file join $::env(BINARY_LIBS_DIR) $::env(PLATFORM)]
set run_dirs [list \
[file join $::env(WORK_HOME) objects] [file join $::env(WORK_HOME) results]]
if { [env_var_exists_and_non_empty DESIGN_DIR] } {
lappend run_dirs $::env(DESIGN_DIR)
}
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"]
}

# The cached .blib for lib_file, or lib_file when the .blib is missing or unusable
proc lib_file_to_read { lib_file } {
if { ![env_var_equals USE_BINARY_LIBS 1] || ![file exists $lib_file] } {
return $lib_file
}
set blib [binary_lib_path $lib_file]
if { ![file exists $blib] } {
utl::warn FLW 26 "$blib not found, reading $lib_file."
return $lib_file
}
if { [catch { liberty_binary_info $blib } msg] } {
utl::warn FLW 27 "$blib is unusable, reading $lib_file: $msg"
return $lib_file
}
return $blib
}
14 changes: 14 additions & 0 deletions flow/scripts/variables.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions flow/scripts/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,29 @@ LIB_FILES:
A Liberty file of the standard cell library with PVT characterization,
input and output characteristics, timing and power definitions for each
cell.
BINARY_LIBS_DIR:
description: >
Directory of the binary liberty (.blib) cache shared by the designs of
each platform, as `<platform>/<library>@<size>-<mtime>-<dirhash>.blib`
so that a changed library gets a new entry. Libraries in DESIGN_DIR and
libraries the flow generates are cached per run in
`$(OBJECTS_DIR)/binary_libs` instead. Set it in the environment or
settings.mk, not in a design's config.mk; ORFS clones that set the same
directory share their .blib files. `make clean_binary_libs` deletes it.
default: $(WORK_HOME)/objects/binary_libs
stages:
- All stages
USE_BINARY_LIBS:
description: >
Read binary liberty (.blib) files in the OpenROAD stages instead of
parsing the text libraries. Before 1_synth the flow converts every
library that has no cached .blib, which `make binary-libs` also does on
its own. A missing or unusable .blib is read from the text library with
a warning. Set to 0 to read LIB_FILES and `<CORNER>_LIB_FILES` as given,
for example when bazel-orfs provides binary libraries itself.
default: 1
stages:
- All stages
LIB_MODEL:
description: >
Selects between NLDM and CCS timing models for the ASAP7 platform.
Expand Down
45 changes: 45 additions & 0 deletions flow/scripts/write_binary_libs.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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 {
# Libraries the flow has not generated yet are converted on a later run
if { ![file exists $lib_file] } {
continue
}
set blib [binary_lib_path $lib_file]
if { [info exists seen($blib)] } {
continue
}
set seen($blib) 1
if { [file exists $blib] && ![catch { liberty_binary_info $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
utl::warn FLW 28 "Could not write $blib: $msg"
continue
}
incr written
}
puts "Binary liberty files: $written written, $cached already cached"
2 changes: 1 addition & 1 deletion tools/OpenROAD
Submodule OpenROAD updated 742 files