drc_check¶
- photonforge.drc_check(source, rules, *, engine=None, args=None, variable_names=None, results_file=None, max_results=None, timeout=None, pre_export_function=None, top_level=None, show_progress=True)¶
Run a design rule check (DRC) on a layout.
For KLayout, the rules file is a DRC runset (
.drcor.lydrc) that callssource($gdsfile)andreport("...", $resultsfile); the results database is then read with KLayout’s own Python module, so the executable must include Python, as the official builds do.For Calibre, the rules file is an SVRF rule deck. Calibre runs a copy of it whose
LAYOUT PATH,LAYOUT SYSTEM,LAYOUT PRIMARY(whensourceis a component),DRC RESULTS DATABASEandDRC SUMMARY REPORT(when the deck declares one) name the files of this check; the deck itself is never edited.- Parameters:
source (Component | str | PathLike) – Component to check, exported to GDSII with default settings, or path to a GDSII or OASIS file.
rules (str | PathLike) – Rules file for the engine.
engine (str | None) – Verification engine,
"klayout"or"calibre".Noneusesconfig.default_drc_lvs_engine, and when that is unset the first engine found (KLayout, then Calibre).args (dict[str, object] | Sequence[str] | None) – For KLayout, extra script variables for the rules file, passed as
-rd name=valuewithstr(value). For Calibre, extra command-line arguments, one per item, such as("-hier", "-turbo", "4").variable_names (dict[str, str] | None) – Names of the file variables used by a KLayout runset when they differ from the defaults. Keys are
"gdsfile"and"resultsfile".results_file (str | PathLike | None) – Keep the engine’s native results database (
.lyrdbfor KLayout, ASCII.dbfor Calibre) at this path.max_results (int | None) – Load at most this many markers. A
RuntimeWarningreports when markers are left out.timeout (float | None) – Seconds allowed for each engine run;
TimeoutErrorwhen one exceeds it.pre_export_function (Callable[[Component], object] | None) – Called with a shallow copy of each component exported from
source, as inwrite_layout().top_level (str | None) – Top cell Calibre checks (its
LAYOUT PRIMARY).Noneuses the component’s name whensourceis a component, otherwise the deck’s own primary, or the layout’s top cell when the deck names none. Calibre only.show_progress (bool) – Show the phase and the elapsed time while the engine runs.
- Returns:
Markers grouped by rule.
- Return type:
- Raises:
RuntimeError – When the engine cannot run, or exits with a non-zero code: a runset that stops at an error leaves a results database holding the rules before it only. The verdict is
is_clean, never the exit code, so a KLayout runset must exit 0.
Note
KLayout is taken from
config.klayout_executablewhen set, then searched inPATHand in common install locations. Calibre is taken fromconfig.calibre_executablewhen set, then searched inPATH,$CALIBRE_HOME/binand$MGC_HOME/bin, and requires a PhotonForge Photonic Canvas license.