mirror of
https://github.com/The-OpenROAD-Project/OpenLane.git
synced 2026-06-17 00:44:15 +08:00
+ add `generate_blackbox_verilog` that generates a black-boxed header file from a list of Verilog models + add `scripts/synth/blackbox.tcl` for `generate_blackbox_verilog` + use `generate_blackbox_verilog` with `VERILOG_FILES_BLACKBOX` and PDK verilog models + disable `UNDRIVEN` and `UNUSEDSIGNAL` for PDK verilog files + add `YOSYS_IN`, `YOSYS_OUT`, `YOSYS_DEFINES` which are used in blackbox.tcl to internal variables in ci variables documentation workflow ~ enable `LINTER_INCLUDE_PDK_MODELS` Co-authored-by: Donn <me@donn.website>
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
# Copyright 2023 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.
|
|
import re
|
|
import click
|
|
from enum import Enum
|
|
|
|
|
|
@click.command()
|
|
@click.option("-o", "--output", default=None)
|
|
@click.argument(
|
|
"file_in",
|
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
required=True,
|
|
)
|
|
def clean_models(output, file_in):
|
|
class State(Enum):
|
|
output = 0
|
|
primitive = 1
|
|
|
|
out_file = None
|
|
if output is not None:
|
|
out_file = open(output, "w", encoding="utf8")
|
|
bad_yosys_line = re.compile(r"^\s+\S+\s*\(.*\).*;")
|
|
state = State.output
|
|
for line in open(file_in, "r", encoding="utf8"):
|
|
if state == State.output:
|
|
if line.strip().startswith("primitive"):
|
|
state = State.primitive
|
|
elif bad_yosys_line.search(line) is None:
|
|
print(line.strip("\n"), file=out_file)
|
|
elif state == State.primitive:
|
|
if line.strip().startswith("endprimitive"):
|
|
print("/* removed primitive */", file=out_file)
|
|
state = State.output
|
|
|
|
|
|
if __name__ == "__main__":
|
|
clean_models()
|