Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass multiple lib files to ABC #2139

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions docs/user/BuildWithPrebuilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Please ensure the Klayout version (denoted with `klayoutVersion` variable) is co

Instructions for installing:
- [Klayout>=0.28.8](https://www.klayout.de/build.html)
- [Yosys>=0.39](https://github.com/YosysHQ/oss-cad-suite-build/blob/master/README.md#installation)
- [Yosys>=0.41](https://github.com/YosysHQ/oss-cad-suite-build/blob/master/README.md#installation)

```{tip} Unfortunately KLayout maintainers do not provide Debian 10/11 compatible packages. You can follow the build-from-sources instruction (Version >=0.25) and Ubuntu 22 instructions [here](https://www.klayout.de/build.html#:~:text=Building%20KLayout%20on%20Linux%20(Version%20%3E%3D%200.25)).
```
Expand Down Expand Up @@ -39,7 +39,7 @@ Please ensure the Klayout version (denoted with `klayoutVersion` variable) is co

Instructions for installing:
- [Klayout>=0.28.8](https://www.klayout.de/build.html)
- [Yosys>=0.39](https://github.com/YosysHQ/oss-cad-suite-build/blob/master/README.md#installation)
- [Yosys>=0.41](https://github.com/YosysHQ/oss-cad-suite-build/blob/master/README.md#installation)

```{tip} Unfortunately KLayout maintainers do not provide Debian 10/11 compatible packages. You can follow the build-from-sources instruction (Version >=0.25) and Ubuntu 22 instructions [here](https://www.klayout.de/build.html#:~:text=Building%20KLayout%20on%20Linux%20(Version%20%3E%3D%200.25)).
```
Expand Down
11 changes: 4 additions & 7 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ WRAPPED_LIBS = $(foreach lib,$(notdir $(WRAP_LIBS)),$(OBJECTS_DIR)/$(lib:.lib=_m
export ADDITIONAL_LEFS += $(WRAPPED_LEFS) $(WRAP_LEFS)
export LIB_FILES += $(WRAP_LIBS) $(WRAPPED_LIBS)

export DONT_USE_LIBS = $(patsubst %.lib.gz, %.lib, $(addprefix $(OBJECTS_DIR)/lib/, $(notdir $(LIB_FILES))))
export DONT_USE_SC_LIB ?= $(firstword $(DONT_USE_LIBS))
export PROCESSED_LIBS = $(patsubst %.lib.gz, %.lib, $(addprefix $(OBJECTS_DIR)/lib/, $(notdir $(LIB_FILES))))
export PROCESSED_SC_LIB ?= $(firstword $(PROCESSED_LIBS))

# Stream system used for final result (GDS is default): GDS, GSDII, GDS2, OASIS, or OAS
STREAM_SYSTEM ?= GDS
Expand Down Expand Up @@ -384,13 +384,10 @@ versions.txt:
# Create temporary Liberty files which have the proper dont_use properties set
# For use with Yosys and ABC
.SECONDEXPANSION:
$(DONT_USE_LIBS): $$(filter %$$(@F) %$$(@F).gz,$(LIB_FILES))
$(PROCESSED_LIBS): $$(filter %$$(@F) %$$(@F).gz,$(LIB_FILES))
@mkdir -p $(OBJECTS_DIR)/lib
$(UTILS_DIR)/preprocessLib.py -i $^ -o $@

$(OBJECTS_DIR)/lib/merged.lib:
$(UTILS_DIR)/mergeLib.pl $(PLATFORM)_merged $(DONT_USE_LIBS) > $@

# Pre-process KLayout tech
# ==============================================================================
$(OBJECTS_DIR)/klayout_tech.lef: $(TECH_LEF)
Expand Down Expand Up @@ -496,7 +493,7 @@ $(SDC_FILE_CLOCK_PERIOD): $(SDC_FILE)
echo $(ABC_CLOCK_PERIOD_IN_PS) > $@

.PHONY: yosys-dependencies
yosys-dependencies: $(DONT_USE_LIBS) $(WRAPPED_LIBS) $(DONT_USE_SC_LIB) $(DFF_LIB_FILE) $(VERILOG_FILES) $(CACHED_NETLIST) $(LATCH_MAP_FILE) $(ADDER_MAP_FILE)
yosys-dependencies: $(PROCESSED_LIBS) $(WRAPPED_LIBS) $(PROCESSED_SC_LIB) $(DFF_LIB_FILE) $(VERILOG_FILES) $(CACHED_NETLIST) $(LATCH_MAP_FILE) $(ADDER_MAP_FILE)

.PHONY: do-yosys
do-yosys: yosys-dependencies
Expand Down
2 changes: 1 addition & 1 deletion flow/platforms/asap7/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ endif
export LIB_FILES += $($(CORNER)_$(LIB_MODEL)_LIB_FILES)
export LIB_FILES += $(ADDITIONAL_LIBS)
export DB_FILES += $(realpath $($(CORNER)_DB_FILES))
export DFF_LIB_FILE = $($(CORNER)_$(LIB_MODEL)_DFF_LIB_FILE)
export TEMPERATURE = $($(CORNER)_TEMPERATURE)
export VOLTAGE = $($(CORNER)_VOLTAGE)
export DONT_USE_SC_LIB = $(OBJECTS_DIR)/lib/merged.lib

# ---------------------------------------------------------
# IR Drop
Expand Down
4 changes: 2 additions & 2 deletions flow/scripts/floorplan.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ if { [info exist ::env(RESYNTH_TIMING_RECOVER)] && $::env(RESYNTH_TIMING_RECOVER

write_verilog $::env(RESULTS_DIR)/2_pre_abc_timing.v

restructure -target timing -liberty_file $::env(DONT_USE_SC_LIB) \
restructure -target timing -liberty_file $::env(PROCESSED_SC_LIB) \
-work_dir $::env(RESULTS_DIR)

write_verilog $::env(RESULTS_DIR)/2_post_abc_timing.v
Expand Down Expand Up @@ -163,7 +163,7 @@ if { [info exist ::env(RESYNTH_AREA_RECOVER)] && $::env(RESYNTH_AREA_RECOVER) ==
set tiehi_lib_name [get_name [get_property [lindex [get_lib_cell $tiehi_cell_name] 0] library]]
set tiehi_port $tiehi_lib_name/$tiehi_cell_name/[lindex $env(TIEHI_CELL_AND_PORT) 1]

restructure -liberty_file $::env(DONT_USE_SC_LIB) -target "area" \
restructure -liberty_file $::env(PROCESSED_SC_LIB) -target "area" \
-tiehi_port $tiehi_port \
-tielo_port $tielo_port \
-work_dir $::env(RESULTS_DIR)
Expand Down
2 changes: 1 addition & 1 deletion flow/scripts/sc/tools/openroad/sc_apr.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if {$sc_step == "or_synth"} {
}
set merge_cmd $::env(UTILS_DIR)/mergeLib.pl
lappend merge_cmd $::env(PLATFORM)_merged
foreach ff [regexp -all -inline {\S+} $::env(DONT_USE_LIBS)] {
foreach ff [regexp -all -inline {\S+} $::env(PROCESSED_LIBS)] {
lappend merge_cmd $ff
}
exec {*}$merge_cmd > ../../merged.lib
Expand Down
4 changes: 2 additions & 2 deletions flow/scripts/sc/util/parse_target_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def parse(chip, platform):
dontuse_l = []
for lf in libs:
dontuse_l.append(os.path.join(mod_lib_base, f'{os.path.split(lf)[1]}-mod.lib'))
merged_config['DONT_USE_LIBS'] = ' '.join(dontuse_l)
merged_config['DONT_USE_SC_LIB'] = os.path.join('..', '..', 'merged.lib')
merged_config['PROCESSED_LIBS'] = ' '.join(dontuse_l)
merged_config['PROCESSED_SC_LIB'] = os.path.join('..', '..', 'merged.lib')

# Set config environment values to be set during sc flow.
for key, val in merged_config.items():
Expand Down
2 changes: 1 addition & 1 deletion flow/scripts/synth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ foreach cell $::env(DONT_USE_CELLS) {
if {[info exist ::env(DFF_LIB_FILE)]} {
dfflibmap -liberty $::env(DFF_LIB_FILE) {*}$dfflibmap_args
} else {
dfflibmap -liberty $::env(DONT_USE_SC_LIB) {*}$dfflibmap_args
dfflibmap -liberty $::env(PROCESSED_SC_LIB) {*}$dfflibmap_args
}
opt

Expand Down
2 changes: 1 addition & 1 deletion flow/scripts/synth_hier_report.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ techmap
if {[info exist ::env(DFF_LIB_FILE)]} {
dfflibmap -liberty $::env(DFF_LIB_FILE)
} else {
dfflibmap -liberty $::env(DONT_USE_SC_LIB)
dfflibmap -liberty $::env(PROCESSED_SC_LIB)
}
puts "abc [join $abc_args " "]"
abc {*}$abc_args
Expand Down
13 changes: 7 additions & 6 deletions flow/scripts/synth_preamble.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ foreach file $::env(VERILOG_FILES) {

# Read standard cells and macros as blackbox inputs
# These libs have their dont_use properties set accordingly
read_liberty -lib {*}$::env(DONT_USE_LIBS)
read_liberty -lib {*}$::env(PROCESSED_LIBS)

# Apply toplevel parameters (if exist)
if {[info exist ::env(VERILOG_TOP_PARAMS)]} {
Expand Down Expand Up @@ -64,10 +64,11 @@ if {$::env(ABC_AREA)} {
}

# Technology mapping for cells
# ABC supports multiple liberty files, but the hook from Yosys to ABC doesn't
set abc_args [list -script $abc_script \
-liberty $::env(DONT_USE_SC_LIB) \
-constr $::env(OBJECTS_DIR)/abc.constr]
set abc_args [list -script $abc_script -constr $::env(OBJECTS_DIR)/abc.constr]

foreach lib $::env(PROCESSED_LIBS) {
lappend abc_args -liberty $lib
}

# Exclude dont_use cells. This includes macros that are specified via
# LIB_FILES and ADDITIONAL_LIBS that are included in LIB_FILES.
Expand All @@ -90,7 +91,7 @@ if {[info exist ::env(SDC_FILE_CLOCK_PERIOD)] && [file isfile $::env(SDC_FILE_CL

# Create argument list for stat
set stat_libs ""
foreach lib $::env(DONT_USE_LIBS) {
foreach lib $::env(PROCESSED_LIBS) {
append stat_libs "-liberty $lib "
}

Expand Down
Loading