mirror of
https://github.com/The-OpenROAD-Project/OpenLane.git
synced 2026-05-29 00:23:55 +08:00
* In run_non_interactive_mode make -no_lvs -no_drc -no_antennacheck into flags These don't need an argument and the code was already looking in flags_map. Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu> * in ioplacer.tcl use proper commands rather than internals Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu> * Add DFF_LIB_SYNTH optional variable for dfflibmap dfflibmap can only take a single liberty file. If LIB_SYNTH has multiple files then DFF_LIB_SYNTH is the one with all the sequential elements. If unset then LIB_SYNTH will be used for backward compatability. Needed for asap7 which uses multiple liberty files. Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu> * Handle multiple liberty files and empty CELL_PAD_EXCLUDE for asap7x Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu> * Thanks, GitHub Actions Team Co-authored-by: Donn <me@donn.website>
73 lines
2.3 KiB
Python
73 lines
2.3 KiB
Python
#!/usr/bin/python3
|
|
# Copyright 2020-2021 Efabless Corporation
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Direct-translated from Perl to Python by Donn.
|
|
|
|
import re
|
|
import click
|
|
|
|
|
|
@click.command()
|
|
@click.option("-c", "--cell-file", required=True, help="Cell file")
|
|
@click.option("-o", "--output", required=True, help="Output liberty file")
|
|
@click.argument("input_lib_files", nargs=-1)
|
|
def cli(cell_file, output, input_lib_files):
|
|
excluded_cells = list(
|
|
map(lambda x: x.strip(), open(cell_file).read().strip().split("\n"))
|
|
)
|
|
|
|
output_file_handle = open(output, "w")
|
|
|
|
def write(string):
|
|
print(string, file=output_file_handle)
|
|
|
|
cell_start_rx = re.compile(r"(\s*)cell\s*\(\"?(.*?)\"?\)\s*\{")
|
|
|
|
state = 0
|
|
brace_count = 0
|
|
for file in input_lib_files:
|
|
input_lib_str = open(file).read()
|
|
input_lib_lines = input_lib_str.split("\n")
|
|
for line in input_lib_lines:
|
|
if state == 0:
|
|
cell_m = cell_start_rx.search(line)
|
|
if cell_m is not None:
|
|
whitespace = cell_m[1]
|
|
cell_name = cell_m[2]
|
|
if cell_name in excluded_cells:
|
|
state = 2
|
|
write(f"{whitespace}/* removed {cell_name} */")
|
|
else:
|
|
state = 1
|
|
write(line)
|
|
brace_count = 1
|
|
else:
|
|
write(line)
|
|
elif state in [1, 2]:
|
|
if "{" in line:
|
|
brace_count += 1
|
|
if "}" in line:
|
|
brace_count -= 1
|
|
if state == 1:
|
|
write(line)
|
|
if brace_count == 0:
|
|
state = 0
|
|
|
|
output_file_handle.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
cli()
|