Introduce Pheon GDSII parsing and layout review tools

Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.

Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.

Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.

Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
This commit is contained in:
Jan Petykiewicz 2026-11-16 16:21:21 -08:00
commit b3346b40a4
9 changed files with 12956 additions and 1 deletions

View file

@ -0,0 +1,78 @@
{
"cell_changes": [],
"comparison_profile": "klamath-object-v2",
"coordinates": {
"bounds": "coordinate_envelope",
"frame": "cell_local",
"unit": "database_unit"
},
"diagnostics": [],
"exit_code": 0,
"hierarchy": null,
"inputs": {
"new": {
"path": "after.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
},
"old": {
"path": "before.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
}
},
"kind": "diff",
"layer_legend": [],
"layer_name_changes": [],
"library_changes": [],
"producer": {
"name": "pheon",
"version": "test"
},
"report_selection": {
"cell": null,
"emitted_objects": "0",
"filtered_cells": "0",
"filtered_objects": "0",
"layer": null,
"limited_objects": "0",
"max_objects": null,
"truncated": false
},
"result": "equal",
"schema_version": 1,
"scope": {
"cell": null,
"layer": null,
"top": null
},
"status": "complete",
"summary": {
"added_objects": "0",
"changed_cells": "0",
"counts": "exact",
"layer_name_changes": "0",
"library_field_changes": "0",
"removed_objects": "0"
}
}

View file

@ -0,0 +1,64 @@
{
"cell_changes": [],
"comparison_profile": "klamath-object-v2",
"coordinates": {
"bounds": "coordinate_envelope",
"frame": "cell_local",
"unit": "database_unit"
},
"diagnostics": [
{
"byte_offset": null,
"cell": null,
"code": "invalid_input",
"layer": null,
"message": "truncated record",
"severity": "error",
"side": "new",
"target": null
}
],
"exit_code": 2,
"hierarchy": null,
"inputs": {
"new": {
"path": "after.gds",
"path_encoded_hex": null,
"present": null,
"units": null
},
"old": {
"path": "before.gds",
"path_encoded_hex": null,
"present": null,
"units": null
}
},
"kind": "diff",
"layer_legend": [],
"layer_name_changes": [],
"library_changes": [],
"producer": {
"name": "pheon",
"version": "test"
},
"report_selection": {
"cell": null,
"emitted_objects": "0",
"filtered_cells": "0",
"filtered_objects": "0",
"layer": null,
"limited_objects": "0",
"max_objects": null,
"truncated": false
},
"result": "unknown",
"schema_version": 1,
"scope": {
"cell": null,
"layer": null,
"top": null
},
"status": "failed",
"summary": null
}

View file

@ -0,0 +1,360 @@
{
"cell_changes": [
{
"added": [
{
"bounds": [
0,
0,
10,
10
],
"counts": null,
"fields": [
{
"encoding": "uint16",
"name": "layer",
"payload_hex": "0x0001",
"tag": 3330,
"value": [
1
]
},
{
"encoding": "uint16",
"name": "datatype",
"payload_hex": "0x0000",
"tag": 3586,
"value": [
0
]
},
{
"encoding": "xy",
"name": "xy",
"payload_hex": "0x0000000000000000000000000000000a0000000a000000000000000000000000",
"tag": 4099,
"value": [
[
0,
0
],
[
0,
10
],
[
10,
0
],
[
0,
0
]
]
}
],
"id": "c0:new:0",
"kind": "BOUNDARY",
"layer": {
"number": 1,
"purpose": 0
},
"origin": null,
"properties": [],
"source": {
"byte_offset": "382",
"end_offset": "438",
"side": "new"
},
"tag": 2048,
"target": null,
"width": null
}
],
"after": {
"attributes": [],
"byte_offset": "346"
},
"attributes_changed": false,
"before": {
"attributes": [],
"byte_offset": "346"
},
"name": "leaf",
"removed": [
{
"bounds": [
0,
0,
10,
10
],
"counts": null,
"fields": [
{
"encoding": "uint16",
"name": "layer",
"payload_hex": "0x0001",
"tag": 3330,
"value": [
1
]
},
{
"encoding": "uint16",
"name": "datatype",
"payload_hex": "0x0000",
"tag": 3586,
"value": [
0
]
},
{
"encoding": "xy",
"name": "xy",
"payload_hex": "0x0000000000000000000000000000000a0000000a0000000a0000000a000000000000000000000000",
"tag": 4099,
"value": [
[
0,
0
],
[
0,
10
],
[
10,
10
],
[
10,
0
],
[
0,
0
]
]
}
],
"id": "c0:old:0",
"kind": "BOUNDARY",
"layer": {
"number": 1,
"purpose": 0
},
"origin": null,
"properties": [],
"source": {
"byte_offset": "382",
"end_offset": "446",
"side": "old"
},
"tag": 2048,
"target": null,
"width": null
}
],
"replacements": [
{
"added": "c0:new:0",
"explanation": "BOUNDARY modified; coordinate bounds unchanged",
"field_changes": [
{
"after": {
"encoding": "xy",
"name": "xy",
"payload_hex": "0x0000000000000000000000000000000a0000000a000000000000000000000000",
"tag": 4099,
"value": [
[
0,
0
],
[
0,
10
],
[
10,
0
],
[
0,
0
]
]
},
"before": {
"encoding": "xy",
"name": "xy",
"payload_hex": "0x0000000000000000000000000000000a0000000a0000000a0000000a000000000000000000000000",
"tag": 4099,
"value": [
[
0,
0
],
[
0,
10
],
[
10,
10
],
[
10,
0
],
[
0,
0
]
]
},
"tag": 4099
}
],
"match_rule": "unique_kind_layer_bounds",
"properties_changed": false,
"removed": "c0:old:0"
}
]
}
],
"comparison_profile": "klamath-object-v2",
"coordinates": {
"bounds": "coordinate_envelope",
"frame": "cell_local",
"unit": "database_unit"
},
"diagnostics": [],
"exit_code": 1,
"hierarchy": {
"edges": [
{
"after_count": "1",
"before_count": "1",
"parent": "CHIP",
"reference_changed": false,
"target": "left"
},
{
"after_count": "1",
"before_count": "1",
"parent": "CHIP",
"reference_changed": false,
"target": "right"
},
{
"after_count": "2",
"before_count": "2",
"parent": "left",
"reference_changed": false,
"target": "leaf"
},
{
"after_count": "3",
"before_count": "3",
"parent": "right",
"reference_changed": false,
"target": "leaf"
}
],
"nodes": [
{
"after": "included",
"before": "included",
"cell": "CHIP",
"change": "affected"
},
{
"after": "included",
"before": "included",
"cell": "leaf",
"change": "direct"
},
{
"after": "included",
"before": "included",
"cell": "left",
"change": "affected"
},
{
"after": "included",
"before": "included",
"cell": "right",
"change": "affected"
}
]
},
"inputs": {
"new": {
"path": "after.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
},
"old": {
"path": "before.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
}
},
"kind": "diff",
"layer_legend": [],
"layer_name_changes": [],
"library_changes": [],
"producer": {
"name": "pheon",
"version": "test"
},
"report_selection": {
"cell": null,
"emitted_objects": "2",
"filtered_cells": "0",
"filtered_objects": "0",
"layer": null,
"limited_objects": "0",
"max_objects": null,
"truncated": false
},
"result": "different",
"schema_version": 1,
"scope": {
"cell": null,
"layer": null,
"top": null
},
"status": "complete",
"summary": {
"added_objects": "1",
"changed_cells": "1",
"counts": "exact",
"layer_name_changes": "0",
"library_field_changes": "0",
"removed_objects": "1"
}
}

View file

@ -0,0 +1,105 @@
{
"cell_changes": [],
"comparison_profile": "klamath-object-v2",
"coordinates": {
"bounds": "coordinate_envelope",
"frame": "cell_local",
"unit": "database_unit"
},
"diagnostics": [
{
"byte_offset": "158",
"cell": "CHIP",
"code": "unsupported_record",
"layer": {
"number": 1,
"purpose": 0
},
"message": "cell \"CHIP\": at byte 158: unsupported record 0x7f02 in BOUNDARY",
"severity": "error",
"side": "old",
"target": null
},
{
"byte_offset": "158",
"cell": "CHIP",
"code": "unsupported_record",
"layer": {
"number": 1,
"purpose": 0
},
"message": "cell \"CHIP\": at byte 158: unsupported record 0x7f02 in BOUNDARY",
"severity": "error",
"side": "new",
"target": null
}
],
"exit_code": 2,
"hierarchy": null,
"inputs": {
"new": {
"path": "after.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
},
"old": {
"path": "before.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
}
},
"kind": "diff",
"layer_legend": [],
"layer_name_changes": [],
"library_changes": [],
"producer": {
"name": "pheon",
"version": "test"
},
"report_selection": {
"cell": null,
"emitted_objects": "0",
"filtered_cells": "0",
"filtered_objects": "0",
"layer": null,
"limited_objects": "0",
"max_objects": null,
"truncated": false
},
"result": "unknown",
"schema_version": 1,
"scope": {
"cell": null,
"layer": null,
"top": null
},
"status": "incomplete",
"summary": {
"added_objects": "0",
"changed_cells": "0",
"counts": "observed",
"layer_name_changes": "0",
"library_field_changes": "0",
"removed_objects": "0"
}
}

View file

@ -0,0 +1,87 @@
{
"cell_changes": [],
"comparison_profile": "klamath-object-v2",
"coordinates": {
"bounds": "coordinate_envelope",
"frame": "cell_local",
"unit": "database_unit"
},
"diagnostics": [],
"exit_code": 1,
"hierarchy": null,
"inputs": {
"new": {
"path": "after.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
},
"old": {
"path": "before.gds",
"path_encoded_hex": null,
"present": true,
"units": {
"encoding": "real8",
"name": "UNITS",
"payload_hex": "0x3e4189374bc6a7f03944b82fa09b5a54",
"tag": 773,
"value": [
0.001,
1e-9
]
}
}
},
"kind": "diff",
"layer_legend": [],
"layer_name_changes": [
{
"after": "CORE:WG",
"before": "WG",
"layer": {
"number": 1,
"purpose": 0
}
}
],
"library_changes": [],
"producer": {
"name": "pheon",
"version": "test"
},
"report_selection": {
"cell": null,
"emitted_objects": "0",
"filtered_cells": "0",
"filtered_objects": "0",
"layer": null,
"limited_objects": "0",
"max_objects": null,
"truncated": false
},
"result": "different",
"schema_version": 1,
"scope": {
"cell": null,
"layer": null,
"top": null
},
"status": "complete",
"summary": {
"added_objects": "0",
"changed_cells": "0",
"counts": "exact",
"layer_name_changes": "1",
"library_field_changes": "0",
"removed_objects": "0"
}
}

View file

@ -0,0 +1,9 @@
profile klamath-object-v2
scope top=all cell=all layer=all
coordinates: integer database units; bounds: coordinate envelopes
HEADER=[600]
LIBNAME="test"
UNITS=[0.001, 1e-9] raw=0x3e4189374bc6a7f03944b82fa09b5a54
layer 1/0 name="WG"
cell "CHIP"
BOUNDARY layer=1 datatype=0 xy=[0, 0, 0, 10, 10, 10, 10, 0, 0, 0]

View file

@ -0,0 +1,7 @@
profile klamath-object-v2
scope top=all cell=all layer=all
cell "CHIP" old@Some(62) new@Some(62)
~ BOUNDARY modified; coordinate bounds unchanged
- @98 bbox=Some([0, 0, 10, 10]) BOUNDARY layer=1 datatype=0 xy=[0, 0, 0, 10, 10, 10, 10, 0, 0, 0]
+ @98 bbox=Some([0, 0, 10, 10]) BOUNDARY layer=1 datatype=0 xy=[0, 0, 0, 10, 10, 0, 0, 0]
1 changed cells; 2 of 2 object changes shown; 0 layer-name changes

View file

@ -0,0 +1,10 @@
flowchart TD
%% scope top=all cell=all layer=all
n0["CHIP [affected]"]
n1["leaf [cell changed]"]
n2["left [affected]"]
n3["right [affected]"]
n0 -->|"x1"| n2
n0 -->|"x1"| n3
n2 -->|"x2"| n1
n3 -->|"x3"| n1

View file

@ -0,0 +1,6 @@
scope top=all cell=all layer=all
"CHIP" x1 [affected]
"left" x1 [affected]
"leaf" x2 [cell changed]
"right" x1 [affected]
"leaf" x3 [cell changed] [shown above]