auto generate drc run_set
diff --git a/sky130/Makefile.in b/sky130/Makefile.in index 9fabc6c..ed67f89 100644 --- a/sky130/Makefile.in +++ b/sky130/Makefile.in
@@ -380,6 +380,8 @@ rm -f ${KLAYOUT_STAGING_A}/${SKY130A}.lyt ${CPP} ${SKY130A_DEFS} klayout/${TECH}.lyp > ${KLAYOUT_STAGING_A}/${SKY130A}.lyp ${CPP} ${SKY130A_DEFS} klayout/${TECH}.lyt > ${KLAYOUT_STAGING_A}/${SKY130A}.lyt + ${CPP} ${SKY130A_DEFS} klayout/${TECH}.lydrc > ${KLAYOUT_STAGING_A}/${SKY130A}.lydrc + ./custom/scripts/gen_run_drc.py -l ${KLAYOUT_STAGING_A}/${SKY130A}.lydrc -o ${KLAYOUT_STAGING_A}/${SKY130A}.drc openlane-a: openlane/common_pdn.tcl openlane/config.tcl openlane/sky130_fd_sc_hd/config.tcl openlane/sky130_fd_sc_hs/config.tcl openlane/sky130_fd_sc_ms/config.tcl openlane/sky130_fd_sc_ls/config.tcl openlane/sky130_fd_sc_hdll/config.tcl openlane/sky130_osu_sc_t18/config.tcl mkdir -p ${OPENLANETOP_STAGING_A}
diff --git a/sky130/custom/scripts/gen_run_drc.py b/sky130/custom/scripts/gen_run_drc.py new file mode 100755 index 0000000..cc8c4c0 --- /dev/null +++ b/sky130/custom/scripts/gen_run_drc.py
@@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# Copyright 2020 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. + +# This script is for the sake of DRC batch running, since batch running only requires the text section of .lydrc +# I thought it would be better to have open_pdks handle this in a case by case basis (pdk by pdk) instead of having +# that code somewhwere in OpenLANE as this is more PDK related. + +import os +import argparse + + +parser = argparse.ArgumentParser( + description='The script parses a lydrc klayout xml database and extracts the runnable text section inside it') + +parser.add_argument('--lydrc', '-l',required=True, + help='lydrc klayout xml database.') + +parser.add_argument('--output_script', '-o',required=True, + help="outputs the script to be used to run klayout drc.") + + +args = parser.parse_args() +lydrc = args.lydrc +output_script = args.output_script + +def cleanup(text): + return str(text).replace(">",">").replace("<","<").replace("&","&") + +def make_verbose(text): + return str(text).replace("verbose(false)","verbose(true)") + +if(os.path.exists(lydrc)): + lydrcFileOpener = open(lydrc, "r", encoding="utf-8") + if lydrcFileOpener.mode == 'r': + lydrcContent = lydrcFileOpener.read() + lydrcFileOpener.close() + sections = lydrcContent.split("<text>") + if len(sections) == 2: + text = sections[1].split("</text>")[0] + output_scriptFileOpener = open(output_script,"w", encoding="utf-8") + output_scriptFileOpener.write(make_verbose(cleanup(text))) + output_scriptFileOpener.close()