4.5. DRC Testingο
Tip
This section provides instructions for testing SG13G2-DRC using KLayout.
For detailed steps and resources, please refer to Testing directory.
4.5.1. Folder Structureο
π testing
β£ πREADME.md This file to document the regression.
β£ πrun_regression.py Main regression script used for DRC testing.
β£ πtestcases All testcases used in regression.
4.5.2. Usage Guideο
4.5.2.1. Golden Results (For Developers Only)ο
Note
This section is intended for developers. If you are an end user, you can safely ignore it.
Golden unit tests are generated for all implemented and verified DRC rules and are stored in the unit_golden directory. These serve as the reference (βgoldenβ) results to validate the correctness of the DRC implementation.
To regenerate golden results based on the current rule implementation, use the following script:
gen_golden.py (--help | -h)
gen_golden.py [--table_name=<table_name>] [--run_dir=<dir>] [--mp=<num>] [--keep]
Example:
python3 gen_golden.py --table_name=activ --run_dir=testcases/unit_golden
Options
-h, --help show this help message and exit
--table_name TABLE_NAME
Target rule table name to generate golden results for.
--run_dir RUN_DIR Directory to store output. If not specified, a timestamped folder will be created.
--mp MP The number of cores used in the run. [default: 1]
--keep Keep output logs and intermediate files after processing.
4.5.2.2. Regression Testingο
Use the regression script to validate current rule outputs against the golden references.
run_regression.py (--help | -h)
run_regression.py [--run_dir=<run_dir>] [--table_name=<table_name>] [--mp=<num>]
Example:
python3 run_regression.py --table_name=activ --run_dir=activ_regression
Options
-h, --help show this help message and exit
--run_dir RUN_DIR Run directory to save all the results. If not provided, a timestamped directory will be created.
--table_name TABLE_NAME
Target specific rule table to run.
--mp MP The number of parts to split the rule deck for parallel execution. [default: 1]
4.5.2.2.1. DRC Regression Outputsο
You could find the regression run results at your run directory if you previously specified it through βrun_name=<run_name>. Default path of run directory is unit_tests_<date>_<time> in current directory.
Folder Structure of regression run results
π unit_tests_<date>_<time>
β£ π unit_tests_<date>_<time>.log
β£ π all_test_cases_results.csv
β π rule_deck_rules.csv
β π <table_name>
β£ π drc_run_<date>_<time>.log
β£ π <table_name>_drc.log
β£ π <table_name>_main_markers_merged_analysis.log
β£ π <table_name>.drc
β£ π <table_name>_main_analysis.drc
β£ π <table_name>_main.lyrdb
β£ π <table_name>_main_markers_merged_final.lyrdb
β£ π <table_name>_main_markers.gds
β£ π <table_name>_main_markers_merged.gds
The result is a database file (<table_name>_main_markers_merged_final.lyrdb) contains all violations. You could view it on your file using: klayout <table_name>_main_markers_merged.gds -m <table_name>_main_markers_merged_final.lyrdb, or you could view it on your gds file via marker browser option in tools menu using klayout GUI.
4.5.2.2.2. π§Ύ Output Regression Logο
After completing a DRC regression run, a summary log is generated that provides detailed insights into the comparison between the golden reference and the actual DRC results from the tested rule deck.
4.5.2.2.2.1. π Sample Regression Outputο
15-Jun-2025 10:31:37 | INFO | # Final analysis table:
table_name rule_name viol_not_golden golden_not_viol in_tests in_rule_deck run_status rule_status
0 activ Act.a 0 0 1 1 completed Passed
1 activ Act.b 0 0 1 1 completed Passed
15-Jun-2025 10:31:37 | INFO | # Failing test cases:
Empty DataFrame
Columns: [table_name, rule_name, viol_not_golden, golden_not_viol, in_tests, in_rule_deck, run_status, rule_status]
Index: []
15-Jun-2025 10:31:37 | INFO | # All testcases passed.
15-Jun-2025 10:31:37 | INFO | Test completed successfully.
15-Jun-2025 10:31:37 | INFO | Total DRC Regression Run time: 8.26 seconds
4.5.2.2.2.2. π Explanation of Result Columnsο
4.5.2.2.2.3. β Summary Insightsο
A successful DRC regression run typically shows:
No mismatches between the test and golden results:
viol_not_golden = 0for all rules (no unexpected violations).golden_not_viol = 0for all rules (no missing expected violations).
All rules pass: Every
rule_statusshould bePassed.No failing test cases: The Failing test cases section should be empty.
If mismatches are detected:
False positives occur when a rule violates in the test but not in the golden reference (
viol_not_golden > 0).False negatives occur when a rule is violated in the golden but missing in the test result (
golden_not_viol > 0).
The regression also validates:
Test coverage: Ensures each rule exists in the unit tests (
in_tests = 1).Rule deck integrity: Confirms the rule is present in the rule deck (
in_rule_deck = 1).