Skip to content

Commit 12c7d2e

Browse files
authored
Merge pull request #1813 from rovinski/master
syn: move dont_use processing to yosys
2 parents cdaf07d + 35ca286 commit 12c7d2e

File tree

5 files changed

+11
-20
lines changed

5 files changed

+11
-20
lines changed

flow/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ versions.txt:
376376
.SECONDEXPANSION:
377377
$(DONT_USE_LIBS): $$(filter %$$(@F) %$$(@F).gz,$(LIB_FILES))
378378
@mkdir -p $(OBJECTS_DIR)/lib
379-
$(UTILS_DIR)/markDontUse.py -p "$(DONT_USE_CELLS)" -i $^ -o $@
379+
$(UTILS_DIR)/preprocessLib.py -i $^ -o $@
380380

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

flow/scripts/sc/tools/openroad/sc_apr.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set inputs [list]
2929
if {$sc_step == "or_synth"} {
3030
# Pre-synthesis: mark dont-use cells in liberty files, and merge them.
3131
foreach f [split $::env(LIB_FILES)] {
32-
exec $::env(UTILS_DIR)/markDontUse.py -p $::env(DONT_USE_CELLS) -i $f -o "../../[file tail $f]-mod.lib"
32+
exec $::env(UTILS_DIR)/preprocessLib.py -i $f -o "../../[file tail $f]-mod.lib"
3333
}
3434
set merge_cmd $::env(UTILS_DIR)/mergeLib.pl
3535
lappend merge_cmd $::env(PLATFORM)_merged

flow/scripts/sc/util/parse_target_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def parse(chip, platform):
128128
index = '0'
129129
tool = chip.get('flowgraph', 'orflow', step, index, 'tool')
130130
# "Don't use" libraries get pre-processed. TODO: Currently placed in build dir root.
131-
# Also, 'markDontUse.py' is called from TCL; might be easier to do that pp here.
131+
# Also, 'preprocessLib.py' is called from TCL; might be easier to do that pp here.
132132
mod_lib_base = os.path.abspath(os.path.join(chip.get('option', 'builddir'),
133133
config['DESIGN_NAME'],
134134
chip.get('option', 'jobname')))

flow/scripts/synth.tcl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ if {[info exist ::env(LATCH_MAP_FILE)]} {
5353
# At least this is predictable.
5454
renames -wire
5555

56+
set dfflibmap_args ""
57+
foreach cell $::env(DONT_USE_CELLS) {
58+
lappend dfflibmap_args -dont_use $cell
59+
}
60+
5661
# Technology mapping of flip-flops
5762
# dfflibmap only supports one liberty file
5863
if {[info exist ::env(DFF_LIB_FILE)]} {
59-
dfflibmap -liberty $::env(DFF_LIB_FILE)
64+
dfflibmap -liberty $::env(DFF_LIB_FILE) {*}$dfflibmap_args
6065
} else {
61-
dfflibmap -liberty $::env(DONT_USE_SC_LIB)
66+
dfflibmap -liberty $::env(DONT_USE_SC_LIB) {*}$dfflibmap_args
6267
}
6368
opt
6469

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@
77
# Parse and validate arguments
88
# ==============================================================================
99
parser = argparse.ArgumentParser(
10-
description='Replaces occurrences of cells in def or verilog files')
11-
parser.add_argument('--patterns', '-p', required=True,
12-
help='List of search patterns')
10+
description='Preprocesses Liberty files for compatibility with yosys/abc')
1311
parser.add_argument('--inputFile', '-i', required=True,
1412
help='Input File')
1513
parser.add_argument('--outputFile', '-o', required=True,
1614
help='Output File')
1715
args = parser.parse_args()
1816

1917

20-
# Convert * wildcards to regex wildcards
21-
patternList = args.patterns.replace('*','.*').split()
22-
2318
# Read input file
2419
print("Opening file for replace:",args.inputFile)
2520
if args.inputFile.endswith(".gz") or args.inputFile.endswith(".GZ"):
@@ -29,15 +24,6 @@
2924
content = f.read().encode("ascii", "ignore").decode("ascii")
3025
f.close()
3126

32-
# Pattern to match a cell header
33-
pattern = r"(^\s*cell\s*\(\s*([\"]*"+"[\"]*|[\"]*".join(patternList)+"[\"]*)\)\s*\{)"
34-
35-
# print(pattern)
36-
replace = r"\1\n dont_use : true;"
37-
content, count = re.subn(pattern, replace, content, 0, re.M)
38-
print("Marked", count, "cells as dont_use")
39-
40-
4127
# Yosys-abc throws an error if original_pin is found within the liberty file.
4228
# removing
4329
pattern = r"(.*original_pin.*)"

0 commit comments

Comments
 (0)